summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--CMakeLists.txt267
-rw-r--r--README.md4
-rw-r--r--cmake/Modules/FindLibavahi.cmake29
-rw-r--r--customer-specific/pasa/src/appMain/smartDeviceLink.ini177
-rw-r--r--src/3rd_party-static/MessageBroker/include/mb_controller.hpp9
-rw-r--r--src/3rd_party-static/MessageBroker/src/client/mb_controller.cpp3
-rw-r--r--src/3rd_party-static/MessageBroker/src/lib_messagebroker/CMessageBrokerRegistry.cpp2
-rw-r--r--src/3rd_party-static/MessageBroker/src/lib_messagebroker/system.cpp8
-rw-r--r--src/3rd_party-static/gmock-1.7.0/include/gmock/gmock-spec-builders.h41
-rw-r--r--src/3rd_party-static/gmock-1.7.0/src/gmock-spec-builders.cc162
-rw-r--r--src/appMain/CMakeLists.txt15
-rwxr-xr-x[-rw-r--r--]src/appMain/hmi_capabilities.json32
-rw-r--r--src/appMain/life_cycle.cc396
-rw-r--r--src/appMain/life_cycle.h15
-rw-r--r--src/appMain/log4cxx.properties88
-rw-r--r--src/appMain/main.cc46
-rw-r--r--src/appMain/sdl_preloaded_pt.json4596
-rw-r--r--src/appMain/signal_handlers.cc2
-rw-r--r--src/appMain/smartDeviceLink.ini130
-rw-r--r--src/components/CMakeLists.txt4
-rw-r--r--src/components/HMI/app/controller/PhoneController.js34
-rw-r--r--src/components/HMI/app/controller/sdl/RPCController.js65
-rw-r--r--src/components/HMI/app/view/phone/dialpadView.js71
-rw-r--r--src/components/HMI/ffw/BasicCommunicationRPC.js26
-rw-r--r--src/components/application_manager/CMakeLists.txt41
-rw-r--r--src/components/application_manager/include/application_manager/application.h1211
-rw-r--r--src/components/application_manager/include/application_manager/application_data_impl.h6
-rw-r--r--src/components/application_manager/include/application_manager/application_impl.h200
-rw-r--r--src/components/application_manager/include/application_manager/application_manager.h198
-rw-r--r--src/components/application_manager/include/application_manager/application_manager_impl.h2500
-rw-r--r--src/components/application_manager/include/application_manager/application_state.h159
-rw-r--r--src/components/application_manager/include/application_manager/commands/command_request_impl.h30
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h (renamed from src/components/application_manager/include/application_manager/commands/hmi/on_play_tone_notification.h)25
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h (renamed from src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h)25
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_event_changed_notification.h (renamed from src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h)22
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h3
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h2
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/alert_request.h24
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/change_registration_request.h90
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h20
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h73
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h7
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h51
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h37
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h41
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h36
-rw-r--r--src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h34
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event.h4
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h60
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h127
-rw-r--r--src/components/application_manager/include/application_manager/event_engine/event_observer.h10
-rw-r--r--src/components/application_manager/include/application_manager/hmi_capabilities.h40
-rw-r--r--src/components/application_manager/include/application_manager/hmi_language_handler.h179
-rw-r--r--src/components/application_manager/include/application_manager/hmi_state.h388
-rw-r--r--src/components/application_manager/include/application_manager/message_helper.h924
-rw-r--r--src/components/application_manager/include/application_manager/mobile_command_factory.h2
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler.h174
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler_interface.h54
-rw-r--r--src/components/application_manager/include/application_manager/policies/policy_handler_observer.h8
-rw-r--r--src/components/application_manager/include/application_manager/request_controller.h10
-rw-r--r--src/components/application_manager/include/application_manager/request_info.h33
-rw-r--r--src/components/application_manager/include/application_manager/resume_ctrl.h525
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resume_ctrl.h464
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data.h282
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_db.h844
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_data_json.h241
-rw-r--r--src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h135
-rw-r--r--src/components/application_manager/include/application_manager/smart_object_keys.h8
-rw-r--r--src/components/application_manager/include/application_manager/state_context.h2
-rw-r--r--src/components/application_manager/include/application_manager/state_controller.h864
-rw-r--r--src/components/application_manager/include/application_manager/telemetry_observer.h (renamed from src/components/application_manager/include/application_manager/time_metric_observer.h)4
-rw-r--r--src/components/application_manager/include/application_manager/usage_statistics.h19
-rw-r--r--src/components/application_manager/src/application_data_impl.cc10
-rw-r--r--src/components/application_manager/src/application_impl.cc586
-rw-r--r--src/components/application_manager/src/application_manager_impl.cc1883
-rw-r--r--src/components/application_manager/src/application_state.cc249
-rw-r--r--src/components/application_manager/src/commands/command_request_impl.cc131
-rw-r--r--src/components/application_manager/src/commands/hmi/basic_communication_on_awake_sdl.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/dial_number_request.cc (renamed from src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc)18
-rw-r--r--src/components/application_manager/src/commands/hmi/dial_number_response.cc (renamed from src/components/application_manager/src/commands/hmi/ui_set_icon_response.cc)20
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_audio_start_stream_request.cc93
-rw-r--r--src/components/application_manager/src/commands/hmi/navi_start_stream_request.cc19
-rw-r--r--src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc7
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc63
-rw-r--r--src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc42
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc8
-rw-r--r--src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc95
-rw-r--r--src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc20
-rw-r--r--src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc (renamed from src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc)12
-rw-r--r--src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc48
-rw-r--r--src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc64
-rw-r--r--src/components/application_manager/src/commands/hmi/on_received_policy_update.cc11
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_status_update_notification.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/on_system_context_notification.cc15
-rw-r--r--src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc13
-rw-r--r--src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc15
-rw-r--r--src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc18
-rw-r--r--src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc78
-rw-r--r--src/components/application_manager/src/commands/hmi/tts_get_language_response.cc26
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_get_language_response.cc26
-rw-r--r--src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc2
-rw-r--r--src/components/application_manager/src/commands/hmi/vr_get_language_response.cc27
-rw-r--r--src/components/application_manager/src/commands/mobile/add_command_request.cc305
-rw-r--r--src/components/application_manager/src/commands/mobile/add_sub_menu_request.cc53
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_maneuver_request.cc97
-rw-r--r--src/components/application_manager/src/commands/mobile/alert_request.cc191
-rw-r--r--src/components/application_manager/src/commands/mobile/change_registration_request.cc209
-rw-r--r--src/components/application_manager/src/commands/mobile/create_interaction_choice_set_request.cc166
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_command_request.cc144
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_file_response.cc5
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc96
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_request.cc29
-rw-r--r--src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc1
-rw-r--r--src/components/application_manager/src/commands/mobile/diagnostic_message_request.cc27
-rw-r--r--src/components/application_manager/src/commands/mobile/dial_number_request.cc95
-rw-r--r--src/components/application_manager/src/commands/mobile/dial_number_response.cc54
-rw-r--r--src/components/application_manager/src/commands/mobile/get_vehicle_data_request.cc166
-rw-r--r--src/components/application_manager/src/commands/mobile/list_files_request.cc18
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_event_notification.cc23
-rw-r--r--src/components/application_manager/src/commands/mobile/on_button_press_notification.cc21
-rw-r--r--src/components/application_manager/src/commands/mobile/on_command_notification.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc51
-rw-r--r--src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc23
-rw-r--r--src/components/application_manager/src/commands/mobile/on_system_request_notification.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc12
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_audio_pass_thru_request.cc95
-rw-r--r--src/components/application_manager/src/commands/mobile/perform_interaction_request.cc540
-rw-r--r--src/components/application_manager/src/commands/mobile/put_file_request.cc8
-rw-r--r--src/components/application_manager/src/commands/mobile/read_did_request.cc14
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_request.cc696
-rw-r--r--src/components/application_manager/src/commands/mobile/register_app_interface_response.cc35
-rw-r--r--src/components/application_manager/src/commands/mobile/reset_global_properties_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/scrollable_message_request.cc23
-rw-r--r--src/components/application_manager/src/commands/mobile/send_location_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/set_app_icon_request.cc106
-rw-r--r--src/components/application_manager/src/commands/mobile/set_global_properties_request.cc427
-rw-r--r--src/components/application_manager/src/commands/mobile/set_icon_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/set_icon_response.cc2
-rw-r--r--src/components/application_manager/src/commands/mobile/show_constant_tbt_request.cc9
-rw-r--r--src/components/application_manager/src/commands/mobile/show_request.cc51
-rw-r--r--src/components/application_manager/src/commands/mobile/slider_request.cc61
-rw-r--r--src/components/application_manager/src/commands/mobile/speak_request.cc48
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_button_request.cc10
-rw-r--r--src/components/application_manager/src/commands/mobile/subscribe_vehicle_data_request.cc169
-rw-r--r--src/components/application_manager/src/commands/mobile/system_request.cc76
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc4
-rw-r--r--src/components/application_manager/src/commands/mobile/unsubscribe_vehicle_data_request.cc174
-rw-r--r--src/components/application_manager/src/commands/mobile/update_turn_list_request.cc77
-rw-r--r--src/components/application_manager/src/event_engine/event.cc8
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher.cc138
-rw-r--r--src/components/application_manager/src/event_engine/event_dispatcher_impl.cc126
-rw-r--r--src/components/application_manager/src/event_engine/event_observer.cc14
-rw-r--r--src/components/application_manager/src/hmi_capabilities.cc579
-rw-r--r--src/components/application_manager/src/hmi_command_factory.cc38
-rw-r--r--src/components/application_manager/src/hmi_language_handler.cc324
-rw-r--r--src/components/application_manager/src/hmi_state.cc204
-rw-r--r--src/components/application_manager/src/message_helper/message_helper.cc (renamed from src/components/application_manager/src/message_helper.cc)1884
-rw-r--r--src/components/application_manager/src/mobile_command_factory.cc209
-rw-r--r--src/components/application_manager/src/mobile_message_handler.cc78
-rw-r--r--src/components/application_manager/src/policies/delegates/app_permission_delegate.cc2
-rw-r--r--src/components/application_manager/src/policies/delegates/statistics_delegate.cc2
-rw-r--r--src/components/application_manager/src/policies/policy_event_observer.cc8
-rw-r--r--src/components/application_manager/src/policies/policy_handler.cc780
-rw-r--r--src/components/application_manager/src/request_controller.cc149
-rw-r--r--src/components/application_manager/src/request_info.cc38
-rw-r--r--src/components/application_manager/src/resume_ctrl.cpp1311
-rw-r--r--src/components/application_manager/src/resumption/resume_ctrl.cc776
-rw-r--r--src/components/application_manager/src/resumption/resumption_data.cc220
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_db.cc2838
-rw-r--r--src/components/application_manager/src/resumption/resumption_data_json.cc519
-rw-r--r--src/components/application_manager/src/resumption/resumption_sql_queries.cc967
-rw-r--r--src/components/application_manager/src/state_controller.cc764
-rw-r--r--src/components/application_manager/src/usage_statistics.cc59
-rw-r--r--src/components/application_manager/test/CMakeLists.txt165
-rw-r--r--src/components/application_manager/test/command_impl_test.cc76
-rw-r--r--src/components/application_manager/test/event_engine_test.cc179
-rw-r--r--src/components/application_manager/test/hmi_capabilities.json460
-rw-r--r--src/components/application_manager/test/libPolicy.sobin0 -> 11508236 bytes
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt60
-rwxr-xr-xsrc/components/application_manager/test/message_helper/CMakeLists.txt.user189
-rwxr-xr-xsrc/components/application_manager/test/message_helper/message_helper_test.cc865
-rw-r--r--src/components/application_manager/test/mobile_message_handler_test.cc297
-rw-r--r--src/components/application_manager/test/mobile_message_handler_v1_test.cc131
-rw-r--r--src/components/application_manager/test/mock/event_observer_mock.h52
l---------src/components/application_manager/test/mock/include/application_manager/application.h1
l---------src/components/application_manager/test/mock/include/application_manager/application_data_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/application_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/application_manager.h1
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h434
l---------src/components/application_manager/test/mock/include/application_manager/commands/command.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/command_notification_from_mobile_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/command_notification_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/command_response_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/add_statistics_info_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_from_hmi.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_to_hmi.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_activated_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_deactivated_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_changed_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_consent_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_registered_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_unregistered_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_event_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_press_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_subscription_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_chosen_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_state_changed_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_driver_distraction_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_all_applications_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_application_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_file_removed_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_find_applications.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_play_tone_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_policy_update.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_put_file_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ready_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_received_policy_update.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_record_start_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_resume_audio_source_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_close_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_start_device_discovery.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_status_update_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_context_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_error_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_info_changed_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_request_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_language_change_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_started_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_stopped_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_command_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_language_change_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_touch_event_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_update_device_list.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_belt_status_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_body_information_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_device_status_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_gps_data_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_my_key_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_odometer_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_prndl_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_rpm_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_speed_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vin_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_command_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_language_change_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_started_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_stopped_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_from_hmi.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_to_hmi.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_from_hmi.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_to_hmi.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/dial_number_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/generic_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_event_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_press_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_command_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_driver_distraction_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hash_change_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_keyboard_input_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_language_change_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_permissions_change_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_system_request_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_tbt_client_state_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_touch_event_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_vehicle_data_notification.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_request.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_response.h1
l---------src/components/application_manager/test/mock/include/application_manager/commands/pending.h1
l---------src/components/application_manager/test/mock/include/application_manager/event_engine/event.h1
l---------src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher.h1
l---------src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/event_engine/event_observer.h1
l---------src/components/application_manager/test/mock/include/application_manager/hmi_capabilities.h1
l---------src/components/application_manager/test/mock/include/application_manager/hmi_command_factory.h1
l---------src/components/application_manager/test/mock/include/application_manager/hmi_state.h1
l---------src/components/application_manager/test/mock/include/application_manager/message.h1
l---------src/components/application_manager/test/mock/include/application_manager/message_helper.h1
l---------src/components/application_manager/test/mock/include/application_manager/mobile_command_factory.h1
l---------src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h1
-rw-r--r--src/components/application_manager/test/mock/include/application_manager/mock_statistics_manager.h63
l---------src/components/application_manager/test/mock/include/application_manager/policies/delegates/app_permission_delegate.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/delegates/statistics_delegate.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/policy_event_observer.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/policy_handler_observer.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/policy_retry_sequence.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_ext.h1
l---------src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h1
l---------src/components/application_manager/test/mock/include/application_manager/request_controller.h1
l---------src/components/application_manager/test/mock/include/application_manager/request_info.h1
l---------src/components/application_manager/test/mock/include/application_manager/resume_ctrl.h1
l---------src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h1
l---------src/components/application_manager/test/mock/include/application_manager/state_context.h1
l---------src/components/application_manager/test/mock/include/application_manager/state_controller.h1
l---------src/components/application_manager/test/mock/include/application_manager/time_metric_observer.h1
l---------src/components/application_manager/test/mock/include/application_manager/usage_statistics.h1
l---------src/components/application_manager/test/mock/include/application_manager/vehicle_info_data.h1
-rw-r--r--src/components/application_manager/test/mock/mock_telemetry_observer.h (renamed from src/components/transport_manager/test/mock_transport_adapter.cc)31
-rw-r--r--src/components/application_manager/test/mock/policy_handler_interface_mock.h53
-rw-r--r--src/components/application_manager/test/mock_message_helper.cc302
-rw-r--r--src/components/application_manager/test/mock_message_helper.h154
-rw-r--r--src/components/application_manager/test/request_info_test.cc537
-rw-r--r--src/components/application_manager/test/resumption/include/application_mock.h266
-rw-r--r--src/components/application_manager/test/resumption/include/resumption_data_mock.h2
-rw-r--r--src/components/application_manager/test/resumption/include/resumption_data_test.h2
-rw-r--r--src/components/application_manager/test/resumption/resume_ctrl_test.cc937
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_db_test.cc105
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_json_test.cc394
-rw-r--r--src/components/application_manager/test/resumption/resumption_data_test.cc64
-rwxr-xr-xsrc/components/application_manager/test/resumption/resumption_data_test.h133
-rw-r--r--src/components/application_manager/test/resumption_sql_queries_test.cc2421
-rw-r--r--src/components/application_manager/test/sdl_preloaded_pt.json1944
-rw-r--r--src/components/application_manager/test/sdl_pt_update.json1722
-rw-r--r--src/components/application_manager/test/smartDeviceLink_test.ini39
-rw-r--r--src/components/application_manager/test/smartDeviceLink_test2.ini28
-rw-r--r--src/components/application_manager/test/state_controller/CMakeLists.txt7
-rw-r--r--src/components/application_manager/test/state_controller/include/application_manager_mock.h25
-rw-r--r--src/components/application_manager/test/state_controller/include/application_mock.h516
-rw-r--r--src/components/application_manager/test/state_controller/include/state_controller_mock.h26
-rw-r--r--src/components/application_manager/test/state_controller/include/statistics_manager_mock.h6
-rw-r--r--src/components/application_manager/test/state_controller/state_controller_test.cc1823
-rw-r--r--src/components/application_manager/test/usage_statistics_test.cc174
-rw-r--r--src/components/application_manager/test/zero_request_amount_test.cc176
-rw-r--r--src/components/config_profile/CMakeLists.txt2
-rw-r--r--src/components/config_profile/include/config_profile/profile.h133
-rw-r--r--src/components/config_profile/src/ini_file.cc3
-rw-r--r--src/components/config_profile/src/profile.cc279
-rw-r--r--src/components/config_profile/test/ini_file_test.cc135
-rw-r--r--src/components/config_profile/test/profile_test.cc273
-rw-r--r--src/components/connection_handler/CMakeLists.txt4
-rw-r--r--src/components/connection_handler/include/connection_handler/connection.h9
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler.h86
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_impl.h192
-rw-r--r--src/components/connection_handler/include/connection_handler/connection_handler_observer.h8
-rw-r--r--src/components/connection_handler/include/connection_handler/heartbeat_monitor.h25
-rw-r--r--src/components/connection_handler/src/connection.cc23
-rw-r--r--src/components/connection_handler/src/connection_handler_impl.cc321
-rw-r--r--src/components/connection_handler/src/device.cc5
-rw-r--r--src/components/connection_handler/src/heartbeat_monitor.cc51
-rw-r--r--src/components/connection_handler/test/CMakeLists.txt5
-rw-r--r--src/components/connection_handler/test/connection_handler_impl_test.cc450
-rw-r--r--src/components/connection_handler/test/connection_test.cc320
-rw-r--r--src/components/connection_handler/test/heart_beat_monitor_test.cc124
-rw-r--r--src/components/dbus/src/dbus_adapter.cc4
-rw-r--r--src/components/formatters/CMakeLists.txt9
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonBase.h (renamed from src/components/formatters/include/formatters/CFormatterJsonBase.hpp)0
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h (renamed from src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.hpp)4
-rw-r--r--src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h (renamed from src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.hpp)4
-rw-r--r--src/components/formatters/include/formatters/CSmartFactory.h (renamed from src/components/formatters/include/formatters/CSmartFactory.hpp)0
-rw-r--r--src/components/formatters/include/formatters/formatter_json_rpc.h4
-rw-r--r--src/components/formatters/include/formatters/generic_json_formatter.h2
-rw-r--r--src/components/formatters/src/CFormatterJsonBase.cc (renamed from src/components/formatters/src/CFormatterJsonBase.cpp)16
-rw-r--r--src/components/formatters/src/CFormatterJsonSDLRPCv1.cc (renamed from src/components/formatters/src/CFormatterJsonSDLRPCv1.cpp)68
-rw-r--r--src/components/formatters/src/CFormatterJsonSDLRPCv2.cc (renamed from src/components/formatters/src/CFormatterJsonSDLRPCv2.cpp)2
-rw-r--r--src/components/formatters/src/CSmartFactory.cc (renamed from src/components/formatters/src/CSmartFactory.cpp)2
-rw-r--r--src/components/formatters/src/formatter_json_rpc.cc87
-rw-r--r--src/components/formatters/test/CFormatterJsonBase_test.cc38
-rw-r--r--src/components/formatters/test/CSmartFactory_test.cc2
-rw-r--r--src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc2
-rw-r--r--src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc2
-rw-r--r--src/components/formatters/test/formatter_json_rpc_test.cc329
-rw-r--r--src/components/formatters/test/include/SmartFactoryTestHelper.h2
-rw-r--r--src/components/formatters/test/include/create_smartSchema.h2
-rw-r--r--src/components/formatters/test/include/meta_formatter_test_helper.h4
-rw-r--r--src/components/hmi_message_handler/CMakeLists.txt9
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h4
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h29
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h70
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h9
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h29
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h4
-rw-r--r--src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h4
-rw-r--r--src/components/hmi_message_handler/src/dbus_message_adapter.cc10
-rw-r--r--src/components/hmi_message_handler/src/hmi_message_adapter_impl.cc (renamed from src/components/hmi_message_handler/src/hmi_message_adapter.cc)13
-rw-r--r--src/components/hmi_message_handler/src/hmi_message_handler_impl.cc58
-rw-r--r--src/components/hmi_message_handler/src/messagebroker_adapter.cc56
-rw-r--r--src/components/hmi_message_handler/src/mqueue_adapter.cc2
-rw-r--r--src/components/hmi_message_handler/test/CMakeLists.txt12
-rw-r--r--src/components/hmi_message_handler/test/hmi_message_adapter_test.cc78
-rw-r--r--src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc135
-rw-r--r--src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h (renamed from src/components/media_manager/test/media_adapter_impl_test.cc)31
-rw-r--r--src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_observer.h58
-rw-r--r--src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.cc81
-rw-r--r--src/components/include/connection_handler/connection_handler_settings.h56
-rw-r--r--src/components/include/hmi_message_handler/hmi_message_handler_settings.h50
-rw-r--r--src/components/include/protocol_handler/protocol_handler.h6
-rw-r--r--src/components/include/protocol_handler/protocol_handler_settings.h47
-rw-r--r--src/components/include/protocol_handler/session_observer.h30
-rw-r--r--src/components/include/security_manager/crypto_manager.h35
-rw-r--r--src/components/include/security_manager/security_manager.h5
-rw-r--r--src/components/include/security_manager/security_manager_listener.h6
-rw-r--r--src/components/include/security_manager/security_manager_settings.h58
-rw-r--r--src/components/include/security_manager/ssl_context.h58
-rw-r--r--src/components/include/telemetry_monitor/telemetry_observable.h43
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler.h112
-rw-r--r--src/components/include/test/connection_handler/mock_connection_handler_settings.h (renamed from src/components/transport_manager/test/include/mock_transport_adapter.h)37
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h54
-rw-r--r--src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h52
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler.h66
-rw-r--r--src/components/include/test/protocol_handler/mock_protocol_handler_settings.h (renamed from src/components/transport_manager/test/include/mock_connection_factory.h)63
-rw-r--r--src/components/include/test/protocol_handler/mock_session_observer.h111
-rw-r--r--src/components/include/test/security_manager/mock_crypto_manager.h (renamed from src/components/transport_manager/test/include/mock_application.h)55
-rw-r--r--src/components/include/test/security_manager/mock_security_manager.h173
-rw-r--r--src/components/include/test/security_manager/mock_security_manager_listener.h56
-rw-r--r--src/components/include/test/security_manager/mock_security_manager_settings.h60
-rw-r--r--src/components/include/test/security_manager/mock_ssl_context.h70
-rw-r--r--src/components/include/test/telemetry_monitor/mock_telemetry_observable.h (renamed from src/components/transport_manager/test/mock_connection_factory.cc)40
-rw-r--r--src/components/include/test/telemetry_monitor/mock_telemetry_observer.h (renamed from src/components/transport_manager/test/include/time_metric_observer_mock.h)19
-rw-r--r--src/components/include/test/transport_manager/transport_manager_mock.h (renamed from src/components/transport_manager/test/include/transport_manager_mock.h)54
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter.h8
-rw-r--r--src/components/include/transport_manager/transport_adapter/transport_adapter_event.h1
-rw-r--r--src/components/include/transport_manager/transport_manager.h10
-rw-r--r--src/components/include/transport_manager/transport_manager_listener.h11
-rw-r--r--src/components/include/transport_manager/transport_manager_listener_empty.h53
-rw-r--r--src/components/include/utils/atomic_object.h112
-rw-r--r--src/components/include/utils/custom_string.h219
-rw-r--r--src/components/include/utils/date_time.h22
-rw-r--r--src/components/include/utils/lock.h7
-rw-r--r--src/components/include/utils/logger.h124
-rw-r--r--src/components/include/utils/macro.h15
-rw-r--r--src/components/include/utils/message_queue.h50
-rw-r--r--src/components/include/utils/messagemeter.h2
-rw-r--r--src/components/include/utils/prioritized_queue.h19
-rw-r--r--src/components/include/utils/push_log.h7
-rw-r--r--src/components/include/utils/scope_guard.h332
-rw-r--r--src/components/include/utils/shared_ptr.h12
-rw-r--r--src/components/include/utils/threads/message_loop_thread.h37
-rw-r--r--src/components/include/utils/threads/thread.h5
-rw-r--r--src/components/include/utils/timer_thread.h449
-rw-r--r--src/components/interfaces/HMI_API.xml160
-rw-r--r--src/components/interfaces/MOBILE_API.xml18
-rw-r--r--src/components/interfaces/QT_HMI_API.xml236
-rw-r--r--src/components/media_manager/CMakeLists.txt14
-rw-r--r--src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/audio/file_audio_streamer_adapter.h48
-rw-r--r--src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/audio/pipe_audio_streamer_adapter.h13
-rw-r--r--src/components/media_manager/include/media_manager/audio/socket_audio_streamer_adapter.h14
-rw-r--r--src/components/media_manager/include/media_manager/file_streamer_adapter.h68
-rw-r--r--src/components/media_manager/include/media_manager/media_adapter.h2
-rw-r--r--src/components/media_manager/include/media_manager/media_manager_impl.h10
-rw-r--r--src/components/media_manager/include/media_manager/pipe_streamer_adapter.h90
-rw-r--r--src/components/media_manager/include/media_manager/socket_streamer_adapter.h125
-rw-r--r--src/components/media_manager/include/media_manager/streamer_adapter.h102
-rw-r--r--src/components/media_manager/include/media_manager/video/file_video_streamer_adapter.h48
-rw-r--r--src/components/media_manager/include/media_manager/video/pipe_video_streamer_adapter.h13
-rw-r--r--src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h15
-rw-r--r--src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h113
-rw-r--r--src/components/media_manager/src/audio/a2dp_source_player_adapter.cc24
-rw-r--r--src/components/media_manager/src/audio/audio_stream_sender_thread.cc10
-rw-r--r--src/components/media_manager/src/audio/file_audio_streamer_adapter.cc45
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_adapter.cc6
-rw-r--r--src/components/media_manager/src/audio/from_mic_recorder_listener.cc2
-rw-r--r--src/components/media_manager/src/audio/from_mic_to_file_recorder_thread.cc2
-rw-r--r--src/components/media_manager/src/audio/pipe_audio_streamer_adapter.cc13
-rw-r--r--src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc25
-rw-r--r--src/components/media_manager/src/file_streamer_adapter.cc111
-rw-r--r--src/components/media_manager/src/media_adapter_impl.cc2
-rw-r--r--src/components/media_manager/src/media_manager_impl.cc40
-rw-r--r--src/components/media_manager/src/pipe_streamer_adapter.cc212
-rw-r--r--src/components/media_manager/src/socket_streamer_adapter.cc299
-rw-r--r--src/components/media_manager/src/streamer_adapter.cc173
-rw-r--r--src/components/media_manager/src/streamer_listener.cc4
-rw-r--r--src/components/media_manager/src/video/file_video_streamer_adapter.cc45
-rw-r--r--src/components/media_manager/src/video/pipe_video_streamer_adapter.cc12
-rw-r--r--src/components/media_manager/src/video/socket_video_streamer_adapter.cc24
-rw-r--r--src/components/media_manager/src/video/video_stream_to_file_adapter.cc4
-rw-r--r--src/components/media_manager/test/CMakeLists.txt8
-rw-r--r--src/components/media_manager/test/include/media_adapter_impl_mock.h74
-rw-r--r--src/components/media_manager/test/include/media_adapter_listener_mock.h65
-rw-r--r--src/components/media_manager/test/include/media_adapter_mock.h64
-rw-r--r--src/components/media_manager/test/media_manager_impl_test.cc109
-rw-r--r--src/components/policy/src/policy/CMakeLists.txt9
-rw-r--r--src/components/policy/src/policy/include/policy/cache_manager.h126
-rw-r--r--src/components/policy/src/policy/include/policy/cache_manager_interface.h48
-rw-r--r--src/components/policy/src/policy/include/policy/policy_helper.h2
-rw-r--r--src/components/policy/src/policy/include/policy/policy_listener.h36
-rw-r--r--src/components/policy/src/policy/include/policy/policy_manager.h50
-rw-r--r--src/components/policy/src/policy/include/policy/policy_manager_impl.h40
-rw-r--r--src/components/policy/src/policy/include/policy/policy_types.h28
-rw-r--r--src/components/policy/src/policy/include/policy/pt_representation.h30
-rw-r--r--src/components/policy/src/policy/include/policy/sql_pt_queries.h3
-rw-r--r--src/components/policy/src/policy/include/policy/sql_pt_representation.h36
-rw-r--r--src/components/policy/src/policy/include/policy/update_status_manager.h7
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct/types.cc288
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct/types.h38
-rw-r--r--src/components/policy/src/policy/policy_table/table_struct/validation.cc7
-rw-r--r--src/components/policy/src/policy/src/cache_manager.cc332
-rw-r--r--src/components/policy/src/policy/src/policy_helper.cc325
-rw-r--r--src/components/policy/src/policy/src/policy_manager_impl.cc239
-rw-r--r--src/components/policy/src/policy/src/policy_table.cc6
-rw-r--r--src/components/policy/src/policy/src/sql_pt_ext_queries.cc3
-rw-r--r--src/components/policy/src/policy/src/sql_pt_ext_representation.cc173
-rw-r--r--src/components/policy/src/policy/src/sql_pt_queries.cc25
-rw-r--r--src/components/policy/src/policy/src/sql_pt_representation.cc250
-rw-r--r--src/components/policy/src/policy/src/update_status_manager.cc19
-rw-r--r--src/components/policy/src/policy/usage_statistics/include/usage_statistics/app_stopwatch.h50
-rw-r--r--src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h47
-rw-r--r--src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h77
-rw-r--r--src/components/policy/src/policy/usage_statistics/src/counter.cc90
-rw-r--r--src/components/policy/test/CMakeLists.txt58
-rw-r--r--src/components/policy/test/PTU.json1949
-rw-r--r--src/components/policy/test/PTU2.json1953
-rw-r--r--src/components/policy/test/PTU3.json1951
-rw-r--r--src/components/policy/test/PTU4.json1954
-rw-r--r--src/components/policy/test/counter_test.cc (renamed from src/components/policy/test/usage_statistics_test.cc)126
-rw-r--r--src/components/policy/test/generated_code_test.cc10
-rw-r--r--src/components/policy/test/include.cmake6
-rw-r--r--src/components/policy/test/include/mock_app_stopwatch.h54
-rw-r--r--src/components/policy/test/include/mock_cache_manager.h28
-rw-r--r--src/components/policy/test/include/mock_policy_listener.h40
-rw-r--r--src/components/policy/test/include/mock_policy_manager.h158
-rw-r--r--src/components/policy/test/include/mock_pt_ext_representation.h2
-rw-r--r--src/components/policy/test/include/mock_pt_representation.h6
-rw-r--r--src/components/policy/test/include/mock_statistics_manager.h37
-rw-r--r--src/components/policy/test/policy.sql295
-rw-r--r--src/components/policy/test/policy/CMakeLists.txt86
-rw-r--r--src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt29
-rw-r--r--src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt27
-rw-r--r--src/components/policy/test/policy/usage_statistics/CMakeLists.txt17
-rw-r--r--src/components/policy/test/policy_manager_impl_stress_test.cc289
-rw-r--r--src/components/policy/test/policy_manager_impl_test.cc853
-rw-r--r--src/components/policy/test/ptu2_requestType.json2615
-rw-r--r--src/components/policy/test/ptu_requestType.json2610
-rwxr-xr-xsrc/components/policy/test/qdbserver.sh6
-rw-r--r--src/components/policy/test/sdl_preloaded_pt.json13
-rw-r--r--src/components/policy/test/sdl_pt_first_update.json1744
-rw-r--r--src/components/policy/test/sdl_pt_second_update.json1744
-rw-r--r--src/components/policy/test/sdl_pt_update.json1722
-rw-r--r--src/components/policy/test/smartDeviceLink2.ini12
-rw-r--r--src/components/policy/test/smartDeviceLink3.ini12
-rw-r--r--src/components/policy/test/sql_pt_ext_representation_test.cc378
-rw-r--r--src/components/policy/test/sql_pt_representation_test.cc1242
-rw-r--r--src/components/policy/test/test-qdb.ini11
-rw-r--r--src/components/policy/test/update_status_manager_test.cc (renamed from src/components/time_tester/test/time_manager_test.cc)70
-rw-r--r--src/components/policy/test/valid_sdl_pt_update.json9
-rw-r--r--src/components/protocol/src/service_type.cc2
-rw-r--r--src/components/protocol_handler/CMakeLists.txt2
-rw-r--r--src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h20
-rw-r--r--src/components/protocol_handler/include/protocol_handler/multiframe_builder.h157
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_handler_impl.h174
-rw-r--r--src/components/protocol_handler/include/protocol_handler/protocol_packet.h44
-rw-r--r--src/components/protocol_handler/include/protocol_handler/telemetry_observer.h (renamed from src/components/protocol_handler/include/protocol_handler/time_metric_observer.h)4
-rw-r--r--src/components/protocol_handler/src/incoming_data_handler.cc59
-rw-r--r--src/components/protocol_handler/src/multiframe_builder.cc274
-rw-r--r--src/components/protocol_handler/src/protocol_handler_impl.cc603
-rw-r--r--src/components/protocol_handler/src/protocol_packet.cc79
-rw-r--r--src/components/protocol_handler/test/CMakeLists.txt4
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h (renamed from src/components/protocol_handler/test/include/control_message_matcher.h)0
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h54
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/protocol_handler_mock.h (renamed from src/components/protocol_handler/test/include/protocol_handler_mock.h)111
-rw-r--r--src/components/protocol_handler/test/include/protocol_handler/protocol_observer_mock.h (renamed from src/components/protocol_handler/test/include/protocol_observer_mock.h)0
-rw-r--r--src/components/protocol_handler/test/include/session_observer_mock.h112
-rw-r--r--src/components/protocol_handler/test/incoming_data_handler_test.cc20
-rw-r--r--src/components/protocol_handler/test/multiframe_builder_test.cc522
-rw-r--r--src/components/protocol_handler/test/protocol_handler_tm_test.cc268
-rw-r--r--src/components/protocol_handler/test/protocol_header_validator_test.cc2
-rw-r--r--src/components/resumption/src/last_state.cc4
-rw-r--r--src/components/resumption/test/CMakeLists.txt1
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base.h6
-rw-r--r--src/components/rpc_base/include/rpc_base/rpc_base_inl.h14
-rw-r--r--src/components/security_manager/CMakeLists.txt4
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_impl.h76
-rw-r--r--src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h66
-rw-r--r--src/components/security_manager/include/security_manager/security_manager_impl.h10
-rw-r--r--src/components/security_manager/src/crypto_manager_impl.cc293
-rw-r--r--src/components/security_manager/src/security_manager_impl.cc49
-rw-r--r--src/components/security_manager/src/ssl_context_impl.cc427
-rw-r--r--src/components/security_manager/test/CMakeLists.txt18
-rw-r--r--src/components/security_manager/test/crypto_manager_impl_test.cc595
-rw-r--r--src/components/security_manager/test/include/security_manager_mock.h311
-rw-r--r--src/components/security_manager/test/mycert.pem22
-rw-r--r--src/components/security_manager/test/mykey.pem27
-rw-r--r--src/components/security_manager/test/security_manager_test.cc726
-rw-r--r--src/components/security_manager/test/security_query_matcher.cc79
-rw-r--r--src/components/security_manager/test/security_query_test.cc113
-rw-r--r--src/components/security_manager/test/ssl_certificate_handshake_test.cc582
-rw-r--r--src/components/security_manager/test/ssl_context_test.cc534
-rw-r--r--src/components/smart_objects/include/smart_objects/number_schema_item.h23
-rw-r--r--src/components/smart_objects/include/smart_objects/smart_object.h132
-rw-r--r--src/components/smart_objects/src/smart_object.cc204
-rw-r--r--src/components/smart_objects/src/string_schema_item.cc12
-rw-r--r--src/components/smart_objects/test/CObjectSchemaItem_test.cc2
-rw-r--r--src/components/smart_objects/test/NumberSchemaItem_test.cc2
-rw-r--r--src/components/telemetry_monitor/CMakeLists.txt (renamed from src/components/time_tester/CMakeLists.txt)30
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h (renamed from src/components/time_tester/include/time_tester/application_manager_metric.h)16
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h (renamed from src/components/time_tester/include/time_tester/application_manager_observer.h)20
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h (renamed from src/components/time_tester/include/time_tester/json_keys.h)8
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h (renamed from src/components/time_tester/include/time_tester/metric_wrapper.h)12
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h (renamed from src/components/time_tester/include/time_tester/protocol_handler_metric.h)15
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h (renamed from src/components/time_tester/include/time_tester/protocol_handler_observer.h)20
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h (renamed from src/components/time_tester/include/time_tester/time_manager.h)85
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h (renamed from src/components/time_tester/include/time_tester/transport_manager_metric.h)19
-rw-r--r--src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h (renamed from src/components/time_tester/include/time_tester/transport_manager_observer.h)20
-rw-r--r--src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc (renamed from src/components/time_tester/src/application_manager_metric.cc)17
-rw-r--r--src/components/telemetry_monitor/src/application_manager_observer.cc (renamed from src/components/time_tester/src/application_manager_observer.cc)16
-rw-r--r--src/components/telemetry_monitor/src/metric_wrapper.cc78
-rw-r--r--src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc (renamed from src/components/time_tester/src/protocol_handler_metric.cc)8
-rw-r--r--src/components/telemetry_monitor/src/protocol_handler_observer.cc (renamed from src/components/time_tester/src/protocol_handler_observer.cc)23
-rw-r--r--src/components/telemetry_monitor/src/telemetry_monitor.cc (renamed from src/components/time_tester/src/time_manager.cc)127
-rw-r--r--src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc (renamed from src/components/time_tester/src/transport_manager_metric.cc)8
-rw-r--r--src/components/telemetry_monitor/src/transport_manager_observer.cc (renamed from src/components/time_tester/src/transport_manager_observer.cc)18
-rw-r--r--src/components/telemetry_monitor/test/CMakeLists.txt (renamed from src/components/time_tester/test/CMakeLists.txt)42
-rw-r--r--src/components/telemetry_monitor/test/application_manager_metric_test.cc (renamed from src/components/time_tester/test/application_manager_metric_test.cc)46
-rw-r--r--src/components/telemetry_monitor/test/application_manager_observer_test.cc (renamed from src/components/time_tester/test/application_manager_observer_test.cc)28
-rw-r--r--src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h58
-rw-r--r--src/components/telemetry_monitor/test/log4cxx.properties (renamed from src/components/time_tester/test/log4cxx.properties)0
-rw-r--r--src/components/telemetry_monitor/test/metric_wrapper_test.cc (renamed from src/components/time_tester/test/metric_wrapper_test.cc)10
-rw-r--r--src/components/telemetry_monitor/test/protocol_handler_metric_test.cc (renamed from src/components/time_tester/test/protocol_handler_metric_test.cc)16
-rw-r--r--src/components/telemetry_monitor/test/protocol_handler_observer_test.cc (renamed from src/components/time_tester/test/protocol_handler_observer_test.cc)30
-rw-r--r--src/components/telemetry_monitor/test/telemetry_monitor_test.cc106
-rw-r--r--src/components/telemetry_monitor/test/transport_manager_metric_test.cc (renamed from src/components/time_tester/test/transport_manager_metric_test.cc)16
-rw-r--r--src/components/telemetry_monitor/test/transport_manager_observer_test.cc (renamed from src/components/time_tester/test/transport_manager_observer_test.cc)22
-rw-r--r--[-rwxr-xr-x]src/components/test_main.cc14
-rw-r--r--src/components/time_tester/src/metric_wrapper.cc46
-rw-r--r--src/components/transport_manager/CMakeLists.txt10
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/dnssd_service_browser.h135
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h14
-rw-r--r--src/components/transport_manager/include/transport_manager/tcp/tcp_device.h2
-rw-r--r--src/components/transport_manager/include/transport_manager/telemetry_observer.h (renamed from src/components/transport_manager/include/transport_manager/time_metric_observer.h)4
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h23
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h11
-rw-r--r--src/components/transport_manager/include/transport_manager/transport_manager_impl.h113
-rw-r--r--src/components/transport_manager/src/tcp/dnssd_service_browser.cc378
-rw-r--r--src/components/transport_manager/src/tcp/tcp_device.cc1
-rw-r--r--src/components/transport_manager/src/tcp/tcp_transport_adapter.cc10
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc35
-rw-r--r--src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc60
-rw-r--r--src/components/transport_manager/src/transport_manager_default.cc18
-rw-r--r--src/components/transport_manager/src/transport_manager_impl.cc192
-rw-r--r--src/components/transport_manager/test/CMakeLists.txt13
-rw-r--r--src/components/transport_manager/test/dnssd_service_browser_test.cc147
-rw-r--r--src/components/transport_manager/test/include/mock_connection.h69
-rw-r--r--src/components/transport_manager/test/include/mock_device.h82
-rw-r--r--src/components/transport_manager/test/include/mock_device_scanner.h76
-rw-r--r--src/components/transport_manager/test/include/mock_telemetry_observer.h (renamed from src/components/time_tester/test/include/time_manager_mock.h)32
-rw-r--r--src/components/transport_manager/test/include/mock_transport_manager_listener.h103
-rw-r--r--src/components/transport_manager/test/include/transport_adapter_listener_mock.h18
-rw-r--r--src/components/transport_manager/test/include/transport_adapter_mock.h6
-rw-r--r--src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h64
-rw-r--r--src/components/transport_manager/test/include/transport_manager_listener_mock.h58
-rw-r--r--src/components/transport_manager/test/mock_application.cc147
-rw-r--r--src/components/transport_manager/test/mock_device.cc85
-rw-r--r--src/components/transport_manager/test/mock_device_scanner.cc103
-rw-r--r--src/components/transport_manager/test/tcp_client_listener_test.cc2
-rw-r--r--src/components/transport_manager/test/tcp_transport_adapter_test.cc10
-rw-r--r--src/components/transport_manager/test/transport_adapter_listener_test.cc4
-rw-r--r--src/components/transport_manager/test/transport_manager_impl_test.cc1067
-rw-r--r--src/components/transport_manager/test/transport_manager_test.cc394
-rw-r--r--src/components/utils/CMakeLists.txt16
-rw-r--r--src/components/utils/include/utils/convert_utils.h78
-rw-r--r--src/components/utils/include/utils/file_system.h8
-rw-r--r--src/components/utils/include/utils/gen_hash.h30
-rw-r--r--src/components/utils/include/utils/helpers.h9
-rw-r--r--src/components/utils/include/utils/log_message_loop_thread.h10
-rw-r--r--src/components/utils/include/utils/qdb_wrapper/sql_database.h (renamed from src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_database.h)6
-rw-r--r--src/components/utils/include/utils/qdb_wrapper/sql_error.h (renamed from src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_error.h)6
-rw-r--r--src/components/utils/include/utils/qdb_wrapper/sql_query.h (renamed from src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_query.h)20
-rw-r--r--src/components/utils/include/utils/signals.h4
-rw-r--r--src/components/utils/include/utils/sqlite_wrapper/sql_database.h (renamed from src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_database.h)15
-rw-r--r--src/components/utils/include/utils/sqlite_wrapper/sql_error.h (renamed from src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_error.h)6
-rw-r--r--src/components/utils/include/utils/sqlite_wrapper/sql_query.h (renamed from src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_query.h)22
-rw-r--r--src/components/utils/include/utils/timer.h133
-rw-r--r--src/components/utils/include/utils/timer_task.h53
-rw-r--r--src/components/utils/include/utils/timer_task_impl.h79
-rw-r--r--src/components/utils/src/auto_trace.cc6
-rw-r--r--src/components/utils/src/convert_utils.cc (renamed from src/components/transport_manager/test/mock_connection.cc)70
-rw-r--r--src/components/utils/src/custom_string.cc201
-rw-r--r--src/components/utils/src/date_time.cc62
-rw-r--r--src/components/utils/src/file_system.cc133
-rw-r--r--src/components/utils/src/gen_hash.cc62
-rw-r--r--src/components/utils/src/lock_posix.cc59
-rw-r--r--src/components/utils/src/logger.cc7
-rw-r--r--src/components/utils/src/push_log.cc39
-rw-r--r--src/components/utils/src/qdb_wrapper/CMakeLists.txt (renamed from src/components/policy/src/policy/qdb_wrapper/CMakeLists.txt)10
-rw-r--r--src/components/utils/src/qdb_wrapper/policy.ini (renamed from src/components/policy/src/policy/qdb_wrapper/policy.ini)0
-rwxr-xr-xsrc/components/utils/src/qdb_wrapper/qdbserver.sh (renamed from src/components/policy/src/policy/qdb_wrapper/qdbserver.sh)0
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_database.cc (renamed from src/components/policy/src/policy/qdb_wrapper/src/sql_database.cc)6
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_error.cc (renamed from src/components/policy/src/policy/qdb_wrapper/src/sql_error.cc)4
-rw-r--r--src/components/utils/src/qdb_wrapper/sql_query.cc (renamed from src/components/policy/src/policy/qdb_wrapper/src/sql_query.cc)26
-rw-r--r--src/components/utils/src/signals_linux.cc54
-rw-r--r--src/components/utils/src/sqlite_wrapper/CMakeLists.txt (renamed from src/components/policy/src/policy/sqlite_wrapper/CMakeLists.txt)8
-rw-r--r--src/components/utils/src/sqlite_wrapper/sql_database.cc (renamed from src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc)8
-rw-r--r--src/components/utils/src/sqlite_wrapper/sql_error.cc (renamed from src/components/policy/src/policy/sqlite_wrapper/src/sql_error.cc)4
-rw-r--r--src/components/utils/src/sqlite_wrapper/sql_query.cc (renamed from src/components/policy/src/policy/sqlite_wrapper/src/sql_query.cc)14
-rw-r--r--src/components/utils/src/threads/async_runner.cc2
-rw-r--r--src/components/utils/src/threads/posix_thread.cc53
-rw-r--r--src/components/utils/src/threads/thread_delegate.cc2
-rw-r--r--src/components/utils/src/timer.cc218
-rw-r--r--src/components/utils/test/CMakeLists.txt32
-rw-r--r--src/components/utils/test/auto_trace_test.cc55
-rw-r--r--src/components/utils/test/custom_string_test.cc319
-rw-r--r--src/components/utils/test/date_time_test.cc24
-rw-r--r--src/components/utils/test/file_system_test.cc232
-rw-r--r--src/components/utils/test/generated_code_with_sqlite_test.cc (renamed from src/components/policy/test/generated_code_with_sqlite_test.cc)4
-rw-r--r--src/components/utils/test/include/generated_code_with_sqlite_test.h (renamed from src/components/policy/test/include/generated_code_with_sqlite_test.h)2
-rw-r--r--src/components/utils/test/include/test_handler.h51
-rw-r--r--src/components/utils/test/include/utils/mock_timer_task.h52
-rw-r--r--src/components/utils/test/log_message_loop_thread_test.cc26
-rw-r--r--src/components/utils/test/message_loop_thread_test.cc (renamed from src/components/utils/test/signals_linux_test.cc)27
-rw-r--r--src/components/utils/test/messagemeter_test.cc97
-rw-r--r--src/components/utils/test/qdb_wrapper/sql_database_test.cc (renamed from src/components/policy/test/qdb_wrapper/sql_database_test.cc)10
-rw-r--r--src/components/utils/test/qdb_wrapper/sql_query_test.cc (renamed from src/components/policy/test/qdb_wrapper/sql_query_test.cc)10
-rw-r--r--src/components/utils/test/smartDeviceLink.ini19
-rw-r--r--src/components/utils/test/sqlite_wrapper/sql_database_test.cc (renamed from src/components/policy/test/sqlite_wrapper/sql_database_test.cc)10
-rw-r--r--src/components/utils/test/sqlite_wrapper/sql_query_test.cc (renamed from src/components/policy/test/sqlite_wrapper/sql_query_test.cc)16
-rw-r--r--src/components/utils/test/timer_test.cc250
-rw-r--r--src/components/utils/test/timer_thread_test.cc153
-rwxr-xr-xtools/InterfaceGenerator/generator/generators/SmartFactoryBase.py4
-rwxr-xr-xtools/InterfaceGenerator/generator/parsers/RPCBase.py3
-rwxr-xr-xtools/Utils/generate_test_certificates.py279
976 files changed, 72042 insertions, 27877 deletions
diff --git a/.gitignore b/.gitignore
index 567609b123..f0bb5faa29 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
build/
+*.user
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b5cf7d1186..bc57be20a1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,10 +40,9 @@ option(EXTENDED_MEDIA_MODE "Turn on and off extended Madia Manager features rela
option(BUILD_SHARED_LIBS "Build all libraries as shared (if ON) or static (if OFF)" OFF)
option(BUILD_BT_SUPPORT "Bluetooth support" ON)
option(BUILD_USB_SUPPORT "libusb support" ON)
-option(BUILD_AVAHI_SUPPORT "libavahi support" ON)
option(BUILD_BACKTRACE_SUPPORT "backtrace support" ON)
option(BUILD_TESTS "Possibility to build and run tests" OFF)
-option(TIME_TESTER "Enable profiling time test util" ON)
+option(TELEMETRY_MONITOR "Enable profiling time test util" ON)
option(ENABLE_LOG "Logging feature" ON)
option(ENABLE_GCOV "gcov code coverage feature" OFF)
option(ENABLE_SANITIZE "Sanitize tool" OFF)
@@ -56,6 +55,7 @@ set(HMI_TYPE_OPTION "$ENV{HMI_TYPE}")
set(TARGET_OPTION "$ENV{TARGET}")
set(MEDIA_MODE_OPTION "$ENV{MEDIA_MODE}")
set(HMI_ADAPTER_OPTION "$ENV{HMI_ADAPTER}")
+set(ENABLE_TESTS_OPTION "$ENV{ENABLE_TESTS}")
set(ENABLE_LOG_OPTION "$ENV{ENABLE_LOG}")
set(ARCH_TYPE_OPTION "$ENV{ARCH_TYPE}")
set(POLICY_OPTION "$ENV{POLICY_TYPE}")
@@ -63,8 +63,6 @@ set(SECURITY_OPTION "$ENV{SECURITY_MODE}")
set(COMPONENTS_DIR ${CMAKE_SOURCE_DIR}/src/components)
set(SNAPSHOT_TAG "$ENV{SNAPSHOT_TAG}")
-
-
if (ARCH_TYPE_OPTION)
if (NOT (${ARCH_TYPE_OPTION} STREQUAL "x86") AND NOT (${ARCH_TYPE_OPTION} STREQUAL "armv7"))
message(AUTHOR_WARNING "HW architecture is not defined, using x86. Allowed values are x86/armv7 (case sensitive)")
@@ -74,19 +72,6 @@ else ()
set(ARCH_TYPE_OPTION "x86")
endif()
-set(objcopy "objcopy")
-if (OS_TYPE_OPTION)
- if (${OS_TYPE_OPTION} STREQUAL "QNX")
- message(STATUS "Jenkins integration: set build process for QNX")
- #do not use include after project() command.
- #Such usecase results in infinite cycle of reinitialization of compiler and other variables
- INCLUDE("./qnx_6.5.0_linux_x86.cmake")
- set(objcopy "nto${ARCH_TYPE_OPTION}-objcopy")
- #tests are not supported yet for QNX build
- set (BUILD_TESTS OFF)
- endif()
-endif()
-
if (HMI_TYPE_OPTION)
if (${HMI_TYPE_OPTION} STREQUAL "HTML5")
message(STATUS "Jenkins integration: select HTML5 HMI")
@@ -134,6 +119,15 @@ if (ENABLE_LOG_OPTION)
endif()
endif()
+if (ENABLE_TESTS_OPTION)
+ if (${ENABLE_TESTS_OPTION} STREQUAL "TESTS_OFF")
+ message(STATUS "Jenkins integration: Unit tests is turned off")
+ set (BUILD_TESTS OFF)
+ elseif(${ENABLE_TESTS_OPTION} STREQUAL "TESTS_ON")
+ message(STATUS "Jenkins integration: Unit tests is turned on")
+ set (BUILD_TESTS ON)
+ endif()
+endif()
if (SECURITY_OPTION)
if (${SECURITY_OPTION} STREQUAL "SEC_OFF")
@@ -142,6 +136,19 @@ if (SECURITY_OPTION)
endif()
endif()
+set(objcopy "objcopy")
+if (OS_TYPE_OPTION)
+ if (${OS_TYPE_OPTION} STREQUAL "QNX")
+ message(STATUS "Jenkins integration: set build process for QNX")
+ #do not use include after project() command.
+ #Such usecase results in infinite cycle of reinitialization of compiler and other variables
+ INCLUDE("./qnx_6.5.0_linux_x86.cmake")
+ set(objcopy "nto${ARCH_TYPE_OPTION}-objcopy")
+ #tests are not supported yet for QNX build
+ set (BUILD_TESTS OFF)
+ endif()
+endif()
+
#Jenkins integration section end
add_custom_target(pasa-tarball
@@ -173,7 +180,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")
set(CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR})
set(ARCHIVE_OUTPUT_DIRECTORY ./bin)
-set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror -Wuninitialized -Wvla")
+set(CMAKE_CXX_FLAGS "-fPIC -std=gnu++0x -Wall -Werror -Wno-deprecated-declarations -Wuninitialized -Wvla")
if(ENABLE_SANITIZE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
@@ -190,7 +197,6 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
elseif(CMAKE_SYSTEM_NAME STREQUAL "QNX")
add_definitions(-DOS_QNX)
SET(BUILD_BT_SUPPORT OFF)
- SET(BUILD_AVAHI_SUPPORT OFF)
SET(BUILD_BACKTRACE_SUPPORT OFF)
SET(EXTENDED_MEDIA_MODE OFF)
endif()
@@ -207,14 +213,6 @@ if (BUILD_BT_SUPPORT)
message(STATUS "Bluetooth support is enabled")
endif()
-
-if (BUILD_AVAHI_SUPPORT)
- add_definitions(-DAVAHI_SUPPORT)
-# --- Check libavahi-common, libavahi-client availability
- find_package(Libavahi)
- message(STATUS "Avahi support is enabled")
-endif()
-
if (BUILD_BACKTRACE_SUPPORT)
add_definitions(-DBACKTRACE_SUPPORT)
endif()
@@ -224,8 +222,8 @@ if(ENABLE_LOG)
set(install-3rd_party_logger "install-3rd_party_logger")
endif()
-if (TIME_TESTER)
- add_definitions(-DTIME_TESTER)
+if (TELEMETRY_MONITOR)
+ add_definitions(-DTELEMETRY_MONITOR)
endif()
# TODO(AK): check current OS here
@@ -375,6 +373,9 @@ endif()
include_directories(
${COMPONENTS_DIR}/include
${COMPONENTS_DIR}/protocol/include
+if (BUILD_TESTS)
+ ${COMPONENTS_DIR}/include/test
+endif ()
)
# --- 3rd party libs
@@ -406,23 +407,23 @@ if(ENABLE_LOG)
else()
if(FORCE_3RD_PARTY_LOGGER)
message(STATUS "Force to rebuild logger.")
-
+
#build logger
add_custom_target(3rd_party_logger
- make
+ make
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
-
+
#install logger
#install either to default place with sudo or non-default plase without sudo.
#to install with sudo to non-default place use manual installation
add_custom_target(install-3rd_party_logger
- COMMAND /bin/bash -c \"USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
- if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
- sudo -k \;
- sudo make install\;
- else
- make install\;
+ COMMAND /bin/bash -c \"USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
+ if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
+ sudo -k \;
+ sudo make install\;
+ else
+ make install\;
fi\"
DEPENDS 3rd_party_logger
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
@@ -430,74 +431,74 @@ if(ENABLE_LOG)
else()
#build logger
add_custom_target(3rd_party_logger
- COMMAND /bin/bash -c \"cd ${CMAKE_CURRENT_SOURCE_DIR} &&
- grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]\; then
- VAR1=\\$$\( readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 2>/dev/null\)\;
- VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
+ COMMAND /bin/bash -c \"cd ${CMAKE_CURRENT_SOURCE_DIR} &&
+ grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 1>/dev/null 2>&1\;
+ if [ \\$$? == 0 ]\; then
+ VAR1=\\$$\( readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 2>/dev/null\)\;
+ VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
VAR2=-1\;
cd ${CMAKE_CURRENT_SOURCE_DIR}\;
git log . 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]; then
- VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/apache-log4cxx-0.10.0\)\;
+ if [ \\$$? == 0 ]; then
+ VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/apache-log4cxx-0.10.0\)\;
+ fi\;
+ if [ \\$$VAR1 != \\$$VAR2 ]\; then
+ echo " Need to rebuild logger. " \;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}\;
+ make\;
+ else
+ echo " Logger is actual. " \;
fi\;
- if [ \\$$VAR1 != \\$$VAR2 ]\; then
- echo " Need to rebuild logger. " \;
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make\;
- else
- echo " Logger is actual. " \;
- fi\;
- else
- echo " Need to build logger. " \;
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make\;
+ else
+ echo " Need to build logger. " \;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}\;
+ make\;
fi\"
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
-
+
#install logger
#install either to default place with sudo or non-default plase without sudo.
#to install with sudo to non-default place use manual installation
add_custom_target(install-3rd_party_logger
- COMMAND /bin/bash -c \"cd ${CMAKE_CURRENT_SOURCE_DIR} &&
- grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]\; then
- VAR1=\\$$\( readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 2>/dev/null\)\;
- VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
+ COMMAND /bin/bash -c \"cd ${CMAKE_CURRENT_SOURCE_DIR} &&
+ grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 1>/dev/null 2>&1\;
+ if [ \\$$? == 0 ]\; then
+ VAR1=\\$$\( readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/liblog4cxx.so 2>/dev/null\)\;
+ VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
VAR2=-1\;
cd ${CMAKE_CURRENT_SOURCE_DIR}\;
git log . 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]; then
- VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/apache-log4cxx-0.10.0\)\;
+ if [ \\$$? == 0 ]; then
+ VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/apache-log4cxx-0.10.0\)\;
fi\;
- if [ \\$$VAR1 != \\$$VAR2 ]\; then
- USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
- if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
+ if [ \\$$VAR1 != \\$$VAR2 ]\; then
+ USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
+ if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- sudo -k \;
- sudo make install\;
- else
+ sudo -k \;
+ sudo make install\;
+ else
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make install\;
- fi\;
- fi\;
- else
- USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
- if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
+ make install\;
+ fi\;
+ fi\;
+ else
+ USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
+ if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- sudo -k \;
- sudo make install\;
- else
+ sudo -k \;
+ sudo make install\;
+ else
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make install\;
+ make install\;
fi\;
fi\"
DEPENDS 3rd_party_logger
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
endif()
-
+
set (install-3rd_party_logger_var "install-3rd_party_logger")
endif()
endif()
@@ -508,23 +509,23 @@ if (HMIADAPTER STREQUAL "dbus")
else()
if(FORCE_3RD_PARTY_DBUS)
message(STATUS "Force to rebuild D-Bus.")
-
+
#build d-bus
add_custom_target(3rd_party_dbus
make
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
-
+
#install d-bus
#install either to default place with sudo or non-default plase without sudo.
#to install with sudo to non-default place use manual installation
add_custom_target(install-3rd_party_dbus
- COMMAND /bin/bash -c \"USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
- if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
- sudo -k \;
- sudo make install\;
- else
- make install\;
+ COMMAND /bin/bash -c \"USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
+ if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
+ sudo -k \;
+ sudo make install\;
+ else
+ make install\;
fi\"
DEPENDS 3rd_party_dbus
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
@@ -532,72 +533,72 @@ if (HMIADAPTER STREQUAL "dbus")
else()
#build d-bus
add_custom_target(3rd_party_dbus
- COMMAND /bin/bash -c \"grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]\; then
- VAR1=\\$$\(readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 2>/dev/null\)\;
- VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
+ COMMAND /bin/bash -c \"grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 1>/dev/null 2>&1\;
+ if [ \\$$? == 0 ]\; then
+ VAR1=\\$$\(readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 2>/dev/null\)\;
+ VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
VAR2=-1\;
cd ${CMAKE_CURRENT_SOURCE_DIR}\;
git log . 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]; then
- VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/dbus-1.7.8\)\;
+ if [ \\$$? == 0 ]; then
+ VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/dbus-1.7.8\)\;
fi\;
- if [ \\$$VAR1 != \\$$VAR2 ]\; then
- echo " Need to rebuild D-Bus. " \;
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make\;
- else
- echo " D-Bus is actual. " \;
- fi\;
- else
- echo " Need to build D-Bus. " \;
- cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make\;
+ if [ \\$$VAR1 != \\$$VAR2 ]\; then
+ echo " Need to rebuild D-Bus. " \;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}\;
+ make\;
+ else
+ echo " D-Bus is actual. " \;
+ fi\;
+ else
+ echo " Need to build D-Bus. " \;
+ cd ${3RD_PARTY_BINARY_DIRECTORY}\;
+ make\;
fi\"
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
-
+
#install d-bus
#install either to default place with sudo or non-default plase without sudo.
#to install with sudo to non-default place use manual installation
add_custom_target(install-3rd_party_dbus
- COMMAND /bin/bash -c \"grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]\; then
- VAR1=\\$$\(readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 2>/dev/null\)\;
- VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
+ COMMAND /bin/bash -c \"grep .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 1>/dev/null 2>&1\;
+ if [ \\$$? == 0 ]\; then
+ VAR1=\\$$\(readelf -p .commit_hash ${3RD_PARTY_INSTALL_PREFIX_ARCH}/lib/libdbus-1.so 2>/dev/null\)\;
+ VAR1=\\$$\(echo \\$$VAR1 | awk '{print \\$$NF}'\)\;
VAR2=-1\;
cd ${CMAKE_CURRENT_SOURCE_DIR}\;
git log . 1>/dev/null 2>&1\;
- if [ \\$$? == 0 ]; then
- VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/dbus-1.7.8\)\;
+ if [ \\$$? == 0 ]; then
+ VAR2=\\$$\(git log --pretty=\"format:%H\" -1 ${3RD_PARTY_SOURCE_DIRECTORY}/dbus-1.7.8\)\;
fi\;
- if [ \\$$VAR1 != \\$$VAR2 ]\; then
- USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
- if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
+ if [ \\$$VAR1 != \\$$VAR2 ]\; then
+ USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
+ if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- sudo -k \;
- sudo make install\;
- else
+ sudo -k \;
+ sudo make install\;
+ else
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make install\;
- fi\;
- fi\;
- else
- USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
- if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
+ make install\;
+ fi\;
+ fi\;
+ else
+ USE_DEFAULT_3RD_PARTY_PATH=${USE_DEFAULT_3RD_PARTY_PATH}\;
+ if [ \\$$USE_DEFAULT_3RD_PARTY_PATH == "true" ]\; then
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- sudo -k \;
- sudo make install\;
- else
+ sudo -k \;
+ sudo make install\;
+ else
cd ${3RD_PARTY_BINARY_DIRECTORY}\;
- make install\;
- fi\;
+ make install\;
+ fi\;
fi\"
DEPENDS 3rd_party_dbus
WORKING_DIRECTORY ${3RD_PARTY_BINARY_DIRECTORY}
)
endif()
-
+
set (install-3rd_party_dbus_var "install-3rd_party_dbus")
endif()
endif()
@@ -662,8 +663,8 @@ if(BUILD_TESTS)
include(Dart)
#add_subdirectory(./test)
endif()
-
-# Building documentation
+
+# Building documentation
# At first creating directory for generated documentation. Unfortunately doxygen
# cannot generate it byself
diff --git a/README.md b/README.md
index ac10996e78..d87f24dc33 100644
--- a/README.md
+++ b/README.md
@@ -17,9 +17,7 @@ Pull Requests Welcome!
* [Software Architecture Document](https://app.box.com/s/v5ymu5kathzkwfx8iigxxdpr7d5a2xhh)
* [Transport Manager Programming Guide](https://app.box.com/s/1pjquttvmhf19uujtw4x4fv4t1leqasa)
* [Software Detailed Design](https://app.box.com/s/ohgrvemtx39f8hfea1ab676xxrzvyx1y)
- * [Integration Guidelines](https://app.box.com/s/ohcgjv61cykgkuhycglju6cc4efr0ym3)
-
-<a href="http://www.youtube.com/watch?feature=player_embedded&v=AzdQdSCS24M" target="_blank"><img src="http://i.imgur.com/nm8UujD.png?1" alt="SmartDeviceLink" border="10" /></a>
+ * [Integration Guidelines](https://app.box.com/s/jkj51mkaa5uganbhjxmtv06lbs8hapa9)
## SDL Core
diff --git a/cmake/Modules/FindLibavahi.cmake b/cmake/Modules/FindLibavahi.cmake
deleted file mode 100644
index 2bc9055059..0000000000
--- a/cmake/Modules/FindLibavahi.cmake
+++ /dev/null
@@ -1,29 +0,0 @@
-# --- Check libavahi-common, libavahi-client availability
-
-FIND_LIBRARY(
- LIBAVAHI_CLIENT
- NAMES libavahi-client.so
- PATHS /usr/local/lib /usr/lib /opt/local/include /usr/lib/i386-linux-gnu/
- )
-
-if (NOT LIBAVAHI_CLIENT)
- message(STATUS " libavahi-client is not found")
- message(STATUS " To install it type in the command line:")
- message(STATUS " sudo apt-get install libavahi-client-dev")
-endif (NOT LIBAVAHI_CLIENT)
-
-FIND_LIBRARY(
- LIBAVAHI_COMMON
- NAMES libavahi-common.so
- PATHS /usr/local/lib /usr/lib /opt/local/include /usr/lib/i386-linux-gnu/
- )
-
-if (NOT LIBAVAHI_COMMON)
- message(STATUS " libavahi-common is not found")
- message(STATUS " To install it type in the command line:")
- message(STATUS " sudo apt-get install libavahi-common-dev")
-endif (NOT LIBAVAHI_COMMON)
-
-if (NOT LIBAVAHI_COMMON OR NOT LIBAVAHI_CLIENT)
- message(FATAL_ERROR "One of necesary component of libavahi is not found. Exiting!")
-endif(NOT LIBAVAHI_COMMON OR NOT LIBAVAHI_CLIENT) \ No newline at end of file
diff --git a/customer-specific/pasa/src/appMain/smartDeviceLink.ini b/customer-specific/pasa/src/appMain/smartDeviceLink.ini
deleted file mode 100644
index 3ceb4a2a7d..0000000000
--- a/customer-specific/pasa/src/appMain/smartDeviceLink.ini
+++ /dev/null
@@ -1,177 +0,0 @@
-; The INI-file consists of different chapters.
-; Each chapter begins with the line containing
-; the name in square brackets. Syntax:
-; [chapter]
-; The chapters consists of a set of items with a
-; assinged value. The syntax is:
-; item=value
-; All white spaces an second encounters of chapters
-; or items will be ignored.
-; Remarks start with semicolon or star as first character.
-; It is alowed for names of chapters and items to
-; contain semicolon and star. Possible syntax is:
-; [ chapter ] ;Remark
-; item = value ;Remark
-
-[HMI]
-LaunchHMI = true
-ServerAddress = 127.0.0.1
-ServerPort = 8087
-VideoStreamingPort = 5050
-AudioStreamingPort = 5080
-
-[MAIN]
-SDLVersion = {GIT_COMMIT}
-; Standard min stack size
-; in Ubuntu : PTHREAD_STACK_MIN = 16384
-; in QNX : PTHREAD_STACK_MIN = 256
-;The value of a variable ThreadStackSize used only if its realy needed, other way stack size will be PTHREAD_STACK_MIN
-;
-AppConfigFolder = /fs/mp/etc/AppLink
-AppStorageFolder = /fs/rwdata/storage/sdl
-ThreadStackSize = 16384
-MixingAudioSupported = true
-HMICapabilities = hmi_capabilities.json
-MaxCmdID = 2000000000
-DefaultTimeout = 20000
-; HMI's heart beat timeout. The value specifies seconds.
-HMIHeartBeatTimeout = 3;
-AppDirectoryQuota = 104857600
-AppHMILevelNoneTimeScaleMaxRequests = 0
-AppHMILevelNoneRequestsTimeScale = 10
-AppTimeScaleMaxRequests = 0
-AppRequestsTimeScale = 10
-PendingRequestsAmount = 0
-; Heart beat timeout used for protocol v3. Timeout must be specified in seconds. If timeout is 0 heart beat will be disabled.
-HeartBeatTimeout = 0
-SupportedDiagModes = 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x09, 0x0A, 0x18, 0x19, 0x22, 0x3E
-SystemFilesPath = /fs/images/ivsu_cache
-UseLastState = true
-TimeTestingPort = 8090
-ReadDIDRequest = 5, 1
-GetVehicleDataRequest = 5, 1
-TargetBootCountFile = /fs/rwdata/.flags/boot_count
-TargetTmpDir = /fs/rwdata/logs
-
-[LOGGING]
-LoggerConfigFile = /fs/mp/etc/AppLink/log4cxx.properties
-RemoteLoggingFlagFile = log/capturelog.evt
-RemoteLoggingFlagFilePath = /fs/usb0/
-TargetLogFileHomeDir = /fs/rwdata/logs/
-TargetLogFileNamePattern = smartdevicelink.log
-LogFileMaxSize = 0K
-
-
-[MEDIA MANAGER]
-; where 3 is a number of retries and 1000 is a timeout in milliseconds for request frequency
-StartStreamRetry = 3, 1000
-EnableRedecoding = false
-;VideoStreamConsumer = socket
-;AudioStreamConsumer = socket
-;VideoStreamConsumer = file
-;AudioStreamConsumer = file
-VideoStreamConsumer = pipe
-AudioStreamConsumer = pipe
-;Temp solution: if you change NamedPipePath also change path to pipe in src/components/qt_hmi/qml_model_qtXX/views/SDLNavi.qml
-;Named pipe path will be constructed using AppStorageFolder + name
-NamedVideoPipePath = video_stream_pipe
-NamedAudioPipePath = audio_stream_pipe
-;File path will be constructed using AppStorageFolder + name
-VideoStreamFile = video_stream_file
-AudioStreamFile = audio_stream_file
-; Recording file source (used for audio pass thru emulation only)
-RecordingFileSource = audio.8bit.wav
-; Recording file for audio pass thru
-RecordingFileName = audio.wav
-MQAudioPath = /dev/mqueue/AppLinkAudioPass
-; Defines time in milliseconds for SDL to wait for the next package of raw data over audio service
-AudioDataStoppedTimeout = 1000
-; Defines time in milliseconds for SDL to wait for the next package of raw data over video service
-VideoDataStoppedTimeout = 1000
-
-
-; HelpPromt and TimeOutPrompt is a vector of strings separated by comma
-[GLOBAL PROPERTIES]
-; Delimiter, which will be appended to each TTS chunck, e.g. helpPrompt/timeoutPrompt
-TTSDelimiter = ,
-; Default prompt items, separated by comma
-HelpPromt = Please speak one of the following commands,Please say a command
-; Default prompt items, separated by comma
-TimeOutPromt = Please speak one of the following commands,Please say a command
-HelpTitle = Available Vr Commands List
-; In case mobile app didn't send global properties default global properties will be sent after this timeout
-; max value TTSGlobalPropertiesTimeout 64K
-TTSGlobalPropertiesTimeout = 20
-
-[FILESYSTEM RESTRICTIONS]
-; Max allowed number of PutFile requests for one application in NONE
-PutFileRequest = 5
-; Max allowed number of DeleteFile requests for one application in NONE
-DeleteFileRequest = 5
-; Max allowed number of ListFiles requests for one application in NONE
-ListFilesRequest = 5
-
-[VR COMMANDS]
-HelpCommand = Help
-
-
-[AppInfo]
-; The path for applications info storage.
-AppInfoStorage = app_info.dat
-
-[Policy]
-EnablePolicy = true
-PreloadedPT = sdl_preloaded_pt.json
-PathToSnapshot = sdl_snapshot.json
-; Number of attempts to open policy DB
-AttemptsToOpenPolicyDB = 5
-; Timeout between attempts during opening DB in milliseconds
-OpenAttemptTimeoutMs = 500
-
-[TransportManager]
-TCPAdapterPort = 12345
-MMEDatabase = /dev/qdb/mediaservice_db
-EventMQ = /dev/mqueue/ToSDLCoreUSBAdapter
-AckMQ = /dev/mqueue/FromSDLCoreUSBAdapter
-
-[IAP]
-DefaultHubProtocolIndex = 0
-LegacyProtocol = com.ford.sync.prot
-HubProtocol = com.smartdevicelink.prot
-PoolProtocol = com.smartdevicelink.prot
-IAPSystemConfig = /fs/mp/etc/mm/ipod.cfg
-IAP2SystemConfig = /fs/mp/etc/mm/iap2.cfg
-IAP2HubConnectAttempts = 3
-ConnectionWaitTimeout = 10
-
-[ProtocolHandler]
-; Packet with payload bigger than next value will be marked as a malformed
-; for protocol v3 or higher
-; For v2 protocol MaximumPayloadSize is 1488
-MaximumPayloadSize = 131072
-; Application shall send less #FrequencyCount messages per #FrequencyTime mSecs
-; Frequency check could be disabled by setting #FrequencyTime or
-; #FrequencyCount to Zero
-FrequencyCount = 1000
-FrequencyTime = 1000
-; Enable filtering transport data stream
-; On #MalformedMessageFiltering disable SDl disconnect with the first
-; malformed message detection
-MalformedMessageFiltering = true
-; Boundary values of malformed message detection for connection close
-; Can be disabled by setting #MalformedFrequencyTime or
-; #MalformedFrequencyCount to Zero
-MalformedFrequencyCount = 10
-MalformedFrequencyTime = 1000
-
-[ApplicationManager]
-ApplicationListUpdateTimeout = 2
-; Max allowed threads for handling mobile requests. Currently max allowed is 2
-ThreadPoolSize = 1
-
-# Timeout in seconds for resumption Application HMILevel
-# and resolving conflicts in case if multiple applications initiate resumption
-ApplicationResumingTimeout = 3
-
-# Timeout in seconds for pereodical saving resumption persisten data
-AppSavePersistentDataTimeout = 10 #seconds
diff --git a/src/3rd_party-static/MessageBroker/include/mb_controller.hpp b/src/3rd_party-static/MessageBroker/include/mb_controller.hpp
index 930a53b385..2d196aced2 100644
--- a/src/3rd_party-static/MessageBroker/include/mb_controller.hpp
+++ b/src/3rd_party-static/MessageBroker/include/mb_controller.hpp
@@ -13,6 +13,7 @@
#include "mb_tcpclient.hpp"
#include "utils/lock.h"
+#include "utils/atomic_object.h"
#include <cstring>
@@ -196,7 +197,7 @@ namespace NsMessageBroker
/**
* @brief flag top stop thread
*/
- volatile bool stop;
+ sync_primitives::atomic_bool stop;
private:
/**
@@ -247,12 +248,6 @@ namespace NsMessageBroker
* @brief mutex for mWaitResponseQueue
*/
sync_primitives::Lock queue_lock_;
-
- /*
- * @brief mutex for Mutex for correct finishing of receiving thread
- */
- sync_primitives::Lock receiving_thread_lock_;
-
};
} /* namespace NsMessageBroker */
#endif /* MB_CONTROLLER_H */
diff --git a/src/3rd_party-static/MessageBroker/src/client/mb_controller.cpp b/src/3rd_party-static/MessageBroker/src/client/mb_controller.cpp
index c37a62dbb8..8a4a77cf30 100644
--- a/src/3rd_party-static/MessageBroker/src/client/mb_controller.cpp
+++ b/src/3rd_party-static/MessageBroker/src/client/mb_controller.cpp
@@ -13,6 +13,7 @@ namespace NsMessageBroker
{
CMessageBrokerController::CMessageBrokerController(const std::string& address, uint16_t port, std::string name):
TcpClient(address, port),
+ stop(false),
m_receivingBuffer(""),
mControllersIdStart(-1),
mControllersIdCurrent(0)
@@ -20,7 +21,6 @@ namespace NsMessageBroker
mControllersName = name;
}
-
std::string CMessageBrokerController::getControllersName()
{
return mControllersName;
@@ -272,7 +272,6 @@ namespace NsMessageBroker
void* CMessageBrokerController::MethodForReceiverThread(void * arg)
{
- sync_primitives::AutoLock auto_lock(receiving_thread_lock_);
stop = false;
arg = arg; // to avoid compiler warnings
while(!stop)
diff --git a/src/3rd_party-static/MessageBroker/src/lib_messagebroker/CMessageBrokerRegistry.cpp b/src/3rd_party-static/MessageBroker/src/lib_messagebroker/CMessageBrokerRegistry.cpp
index 1e63f0ba31..fb24d08f1c 100644
--- a/src/3rd_party-static/MessageBroker/src/lib_messagebroker/CMessageBrokerRegistry.cpp
+++ b/src/3rd_party-static/MessageBroker/src/lib_messagebroker/CMessageBrokerRegistry.cpp
@@ -77,7 +77,7 @@ namespace NsMessageBroker
std::map <std::string, int>::iterator it = mControllersList.begin();
for (; it != mControllersList.end();) {
if (it->second == fd) {
- mControllersList.erase(it);
+ mControllersList.erase(it++);
} else {
++it;
}
diff --git a/src/3rd_party-static/MessageBroker/src/lib_messagebroker/system.cpp b/src/3rd_party-static/MessageBroker/src/lib_messagebroker/system.cpp
index be9b35d611..456362f9d8 100644
--- a/src/3rd_party-static/MessageBroker/src/lib_messagebroker/system.cpp
+++ b/src/3rd_party-static/MessageBroker/src/lib_messagebroker/system.cpp
@@ -23,6 +23,7 @@
*/
#include <time.h>
+#include <signal.h>
#include "system.h"
@@ -91,6 +92,13 @@ bool Thread::Join(void** ret) {
}
void* Thread::Call(void* arg) {
+ // Disable system signals receiving in thread
+ // by setting empty signal mask
+ // (system signals processes only in the main thread)
+ sigset_t set;
+ sigfillset(&set);
+ pthread_sigmask(SIG_SETMASK, &set, NULL);
+
Thread* thread = static_cast<Thread*>(arg);
/* call our specific object method */
diff --git a/src/3rd_party-static/gmock-1.7.0/include/gmock/gmock-spec-builders.h b/src/3rd_party-static/gmock-1.7.0/include/gmock/gmock-spec-builders.h
index 312fbe8705..ec7a9bd000 100644
--- a/src/3rd_party-static/gmock-1.7.0/include/gmock/gmock-spec-builders.h
+++ b/src/3rd_party-static/gmock-1.7.0/include/gmock/gmock-spec-builders.h
@@ -60,6 +60,10 @@
#ifndef GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
#define GMOCK_INCLUDE_GMOCK_GMOCK_SPEC_BUILDERS_H_
+#if defined(OS_POSIX)
+#include <sys/time.h>
+#endif
+
#include <map>
#include <set>
#include <sstream>
@@ -120,6 +124,16 @@ GTEST_API_ GTEST_DECLARE_STATIC_MUTEX_(g_gmock_mutex);
// Untyped base class for ActionResultHolder<R>.
class UntypedActionResultHolderBase;
+// Expectation results enum
+enum ExpectationResult {
+ // Some expectations are not satisfied
+ NotSatisfied,
+ // All expectations are satisfied
+ Satisfied,
+ // Some expectations are over satisfied
+ OverSaturated
+};
+
// Abstract base class of FunctionMockerBase. This is the
// type-agnostic part of the function mocker interface. Its pure
// virtual methods are implemented by FunctionMockerBase.
@@ -134,6 +148,12 @@ class GTEST_API_ UntypedFunctionMockerBase {
bool VerifyAndClearExpectationsLocked()
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
+ // Verifies that all expectations on this mock function have been
+ // satisfied. Does not report failures.
+ // Returns ExpectationResult value.
+ ExpectationResult VerifyExpectationsLocked()
+ GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex);
+
// Clears the ON_CALL()s set on this mock function.
virtual void ClearDefaultActionsLocked()
GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) = 0;
@@ -207,6 +227,11 @@ class GTEST_API_ UntypedFunctionMockerBase {
const char* Name() const
GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
+ // Returns the time of this mock registering. Must be called after
+ // RegisterOwner() has been called.
+ timeval RegisteredTime() const
+ GTEST_LOCK_EXCLUDED_(g_gmock_mutex);
+
// Returns the result of invoking this mock function with the given
// arguments. This function can be safely called from multiple
// threads concurrently. The caller is responsible for deleting the
@@ -234,6 +259,10 @@ class GTEST_API_ UntypedFunctionMockerBase {
// method has been called.
const char* name_; // Protected by g_gmock_mutex.
+ // Time of the function registering.
+ // Only valid after RegisterOwner() has been called.
+ timeval registered_time_; // Protected by g_gmock_mutex.
+
// All default action specs for this function mocker.
UntypedOnCallSpecs untyped_on_call_specs_;
@@ -389,6 +418,12 @@ class GTEST_API_ Mock {
static bool VerifyAndClear(void* mock_obj)
GTEST_LOCK_EXCLUDED_(internal::g_gmock_mutex);
+ // Asynchronously verifies all expectations of all registered mock objects
+ // and clears there default actions and expectations. Returns true if the
+ // verification was successful.
+ static bool AsyncVerifyAndClearExpectations(int timeout)
+ GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
+
private:
friend class internal::UntypedFunctionMockerBase;
@@ -438,6 +473,12 @@ class GTEST_API_ Mock {
static bool VerifyAndClearExpectationsLocked(void* mock_obj)
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
+ // Asynchronously verifies that all expectations of all registered
+ // mock objects have been satisfied. Reports one or more Google
+ // Test non-fatal failures and returns false if not.
+ static bool AsyncVerifyAndClearExpectationsLocked(int timeout_msec)
+ GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
+
// Clears all ON_CALL()s set on the given mock object.
static void ClearDefaultActionsLocked(void* mock_obj)
GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex);
diff --git a/src/3rd_party-static/gmock-1.7.0/src/gmock-spec-builders.cc b/src/3rd_party-static/gmock-1.7.0/src/gmock-spec-builders.cc
index abaae3ad98..1219a3a3c9 100644
--- a/src/3rd_party-static/gmock-1.7.0/src/gmock-spec-builders.cc
+++ b/src/3rd_party-static/gmock-1.7.0/src/gmock-spec-builders.cc
@@ -64,6 +64,33 @@ GTEST_API_ void LogWithLocation(testing::internal::LogSeverity severity,
Log(severity, s.str(), 0);
}
+// Unlock internal mutex and wait for a while
+void UnlockAndSleep(const long usecs) {
+ g_gmock_mutex.Unlock();
+ Assert(usecs < 60L*1000*1000, __FILE__, __LINE__,
+ "Long sleep makes a bare back");
+ ::std::ostringstream s;
+ s << "Sleeping for " << 0.001 * usecs << "mSecs" << ::std::endl;
+ Log(testing::internal::kInfo, s.str(), 0);
+ usleep(usecs);
+ g_gmock_mutex.Lock();
+}
+
+// Return time structure with the current date/time stamp
+timeval GetCurrentTime() {
+ timeval now;
+ gettimeofday(&now, NULL);
+ return now;
+}
+
+// Unlock internal mutex and wait for a while
+long UsecsElapsed(const timeval start_time) {
+ timeval now = GetCurrentTime();
+ timeval priviously_elapsed;
+ timersub(&now, &start_time, &priviously_elapsed);
+ return priviously_elapsed.tv_sec*1000000L + priviously_elapsed.tv_usec;
+}
+
// Constructs an ExpectationBase object.
ExpectationBase::ExpectationBase(const char* a_file,
int a_line,
@@ -258,7 +285,9 @@ void ReportUninterestingCall(CallReaction reaction, const string& msg) {
}
UntypedFunctionMockerBase::UntypedFunctionMockerBase()
- : mock_obj_(NULL), name_("") {}
+ : mock_obj_(NULL), name_("") {
+ timerclear(&registered_time_);
+}
UntypedFunctionMockerBase::~UntypedFunctionMockerBase() {}
@@ -273,6 +302,7 @@ void UntypedFunctionMockerBase::RegisterOwner(const void* mock_obj)
mock_obj_ = mock_obj;
}
Mock::Register(mock_obj, this);
+ gettimeofday(&registered_time_, NULL);
}
// Sets the mock object this mock method belongs to, and sets the name
@@ -322,6 +352,17 @@ const char* UntypedFunctionMockerBase::Name() const
return name;
}
+// Returns the time of this mock method registering. Must be called
+// after RegisterOwner() has been called.
+timeval UntypedFunctionMockerBase::RegisteredTime() const
+ GTEST_LOCK_EXCLUDED_(g_gmock_mutex) {
+ g_gmock_mutex.AssertHeld();
+ Assert(timerisset(&registered_time_), __FILE__, __LINE__,
+ "RegisteredTime() must not be called before SetOwnerAndName() has "
+ "been called.");
+ return registered_time_;
+}
+
// Calculates the result of invoking this mock function with the given
// arguments, prints it, and returns it. The caller is responsible
// for deleting the result.
@@ -499,6 +540,23 @@ bool UntypedFunctionMockerBase::VerifyAndClearExpectationsLocked()
return expectations_met;
}
+ExpectationResult UntypedFunctionMockerBase::VerifyExpectationsLocked()
+ GTEST_EXCLUSIVE_LOCK_REQUIRED_(g_gmock_mutex) {
+ g_gmock_mutex.AssertHeld();
+ for (UntypedExpectations::const_iterator it =
+ untyped_expectations_.begin();
+ it != untyped_expectations_.end(); ++it) {
+ ExpectationBase* const untyped_expectation = it->get();
+ if (untyped_expectation->IsOverSaturated()) {
+ return OverSaturated;
+ }
+ if (!untyped_expectation->IsSatisfied()) {
+ return NotSatisfied;
+ }
+ }
+ return Satisfied;
+}
+
} // namespace internal
// Class Mock.
@@ -697,6 +755,108 @@ bool Mock::VerifyAndClearExpectationsLocked(void* mock_obj)
return expectations_met;
}
+bool Mock::AsyncVerifyAndClearExpectations(int timeout_msec)
+ GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) {
+ internal::MutexLock l(&internal::g_gmock_mutex);
+ return AsyncVerifyAndClearExpectationsLocked(timeout_msec);
+}
+
+bool Mock::AsyncVerifyAndClearExpectationsLocked(const int timeout_msec_in)
+ GTEST_EXCLUSIVE_LOCK_REQUIRED_(internal::g_gmock_mutex) {
+ internal::g_gmock_mutex.AssertHeld();
+ MockObjectRegistry::StateMap& state_map = g_mock_object_registry.states();
+ if (state_map.empty()) {
+ // No EXPECT_CALL() was set on the given mock object.
+ return true;
+ }
+
+ // TODO(ezamakhov@gmail.com): refactor the next loops
+ bool expectations_met = true;
+ timeval first_register_time {0, 0};
+ int timeout_msec = timeout_msec_in;
+ for (MockObjectRegistry::StateMap::iterator mock_it = state_map.begin();
+ state_map.end() != mock_it; ++mock_it) {
+ MockObjectState& state = mock_it->second;
+
+ // Verifies the expectations on each mock method in the
+ // given mock object.
+ FunctionMockers& mockers = state.function_mockers;
+ if (mockers.empty()) {
+ internal::Assert(!mockers.empty(), __FILE__, __LINE__,
+ "No functions mocked");
+ return true;
+ }
+
+ for (FunctionMockers::const_iterator it = mockers.begin();
+ it != mockers.end(); ++it) {
+ internal::UntypedFunctionMockerBase* base = *it;
+
+ const timeval register_time = base->RegisteredTime();
+ if (!timerisset(&first_register_time) ||
+ timercmp(&register_time, &first_register_time, <)) {
+ first_register_time = register_time;
+ }
+
+ // Waiting expectations loop
+ do {
+ const internal::ExpectationResult result =
+ base->VerifyExpectationsLocked();
+ if (result == internal::OverSaturated) {
+ expectations_met = false;
+ // break waiting procedure
+ break;
+ }
+ if (result == internal::Satisfied) {
+ // break waiting procedure
+ break;
+ }
+ if (result == internal::NotSatisfied) {
+ // If timeout expared
+ if (timeout_msec <= 0) {
+ expectations_met = false;
+ // break waiting procedure
+ break;
+ }
+ // Unlock callbacks procedures
+ static const int sleep_msec = 10;
+ internal::UnlockAndSleep(sleep_msec * 1000);
+ timeout_msec -= sleep_msec;
+ }
+ } while (true);
+ } // mockers iteration
+
+ if (expectations_met) {
+ const long elapsed_usecs =
+ // first_register_time is empty on no expectations in mocks
+ timerisset(&first_register_time)
+ ? internal::UsecsElapsed(first_register_time)
+ : 100 * 1000;
+ // To avoid waitings very long times.
+ const long max_sleep_time = timeout_msec_in * 10 * 1000;
+ if (max_sleep_time > elapsed_usecs * 2) {
+ // Wait double times
+ internal::UnlockAndSleep(elapsed_usecs * 2);
+ }
+ }
+
+ // Verifies and clears the expectations on each mock method in the
+ // given mock object.
+ for (FunctionMockers::const_iterator it = mockers.begin();
+ it != mockers.end(); ++it) {
+ internal::UntypedFunctionMockerBase* base = *it;
+ // Get finial result and clear expectation
+ const bool final_verification = base->VerifyAndClearExpectationsLocked();
+ if (!final_verification) {
+ expectations_met = false;
+ }
+ }
+ } // state_map iteration
+
+ // We don't clear the content of mockers, as they may still be
+ // needed by ClearDefaultActionsLocked().
+ return expectations_met;
+}
+
// Registers a mock object and a mock method it owns.
void Mock::Register(const void* mock_obj,
internal::UntypedFunctionMockerBase* mocker)
diff --git a/src/appMain/CMakeLists.txt b/src/appMain/CMakeLists.txt
index d27a282c2e..6d529e1572 100644
--- a/src/appMain/CMakeLists.txt
+++ b/src/appMain/CMakeLists.txt
@@ -51,19 +51,20 @@ set(default_media_inc
)
endif()
-if (TIME_TESTER)
- set(TIME_TESTER_LIB
- TimeTester)
+if (TELEMETRY_MONITOR)
+ set(TELEMETRY_MONITOR_LIB
+ TelemetryMonitor)
endif()
set(LIBRARIES
MediaManager
ApplicationManager
+ MessageHelper
HMI_API
MOBILE_API
v4_protocol_v1_2_no_extra
SmartObjects
- ${TIME_TESTER_LIB}
+ ${TELEMETRY_MONITOR_LIB}
formatters
ProtocolLibrary
ProtocolHandler
@@ -87,9 +88,6 @@ endif()
if (BUILD_BT_SUPPORT)
list(APPEND LIBRARIES bluetooth)
endif()
-if (BUILD_AVAHI_SUPPORT)
- list(APPEND LIBRARIES avahi-client avahi-common)
-endif()
if (BUILD_USB_SUPPORT)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
list(APPEND LIBRARIES Libusb-1.0.16)
@@ -120,8 +118,9 @@ include_directories (
${COMPONENTS_DIR}/request_watchdog/include
${COMPONENTS_DIR}/smart_objects/include/
${COMPONENTS_DIR}/media_manager/include/
- ${COMPONENTS_DIR}/time_tester/include
+ ${COMPONENTS_DIR}/telemetry_monitor/include
${COMPONENTS_DIR}/policy/src/policy/include/
+ ${COMPONENTS_DIR}/policy/src/policy/usage_statistics/include/
${COMPONENTS_DIR}/resumption/include/
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${ENCRYPTION_INCLUDE_DIRECTORY}
diff --git a/src/appMain/hmi_capabilities.json b/src/appMain/hmi_capabilities.json
index e97a222368..fac4ac24b0 100644..100755
--- a/src/appMain/hmi_capabilities.json
+++ b/src/appMain/hmi_capabilities.json
@@ -1,10 +1,10 @@
{
"UI":
{
- "language":"EN_US",
+ "language":"EN-US",
"languages":[
- "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW",
-"JA_JP","AR_SA","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO"
+ "EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL","FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW",
+"JA-JP","AR-SA","KO-KR","PT-BR","CS-CZ","DA-DK","NO-NO"
],
"displayCapabilities":
{
@@ -316,31 +316,33 @@
},
"hmiZoneCapabilities":"FRONT",
"softButtonCapabilities":
- {
- "shortPressAvailable":true,
- "longPressAvailable" :true,
- "upDownAvailable" :true,
- "imageSupported" :true
- }
+ [
+ {
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true,
+ "imageSupported" :true
+ }
+ ]
},
"VR":
{
"capabilities":["TEXT"],
- "language":"EN_US",
+ "language":"EN-US",
"languages":
[
- "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW",
-"JA_JP","AR_SA","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO"
+ "EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL","FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW",
+"JA-JP","AR-SA","KO-KR","PT-BR","CS-CZ","DA-DK","NO-NO"
]
},
"TTS":
{
"capabilities":"TEXT",
- "language":"EN_US",
+ "language":"EN-US",
"languages":
[
- "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW",
-"JA_JP","AR_SA","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO"
+ "EN-US","ES-MX","FR-CA","DE-DE","ES-ES","EN-GB","RU-RU","TR-TR","PL-PL","FR-FR","IT-IT","SV-SE","PT-PT","NL-NL","ZH-TW",
+"JA-JP","AR-SA","KO-KR","PT-BR","CS-CZ","DA-DK","NO-NO"
]
},
"Buttons":
diff --git a/src/appMain/life_cycle.cc b/src/appMain/life_cycle.cc
index ca629e2311..71ca588e65 100644
--- a/src/appMain/life_cycle.cc
+++ b/src/appMain/life_cycle.cc
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, Ford Motor Company
+* Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,25 +30,28 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "./life_cycle.h"
+#include "life_cycle.h"
#include "utils/signals.h"
+#include "utils/make_shared.h"
#include "config_profile/profile.h"
#include "resumption/last_state.h"
#ifdef ENABLE_SECURITY
#include "security_manager/security_manager_impl.h"
#include "security_manager/crypto_manager_impl.h"
+#include "security_manager/crypto_manager_settings_impl.h"
+#include "application_manager/policies/policy_handler.h"
#endif // ENABLE_SECURITY
#ifdef ENABLE_LOG
#include "utils/log_message_loop_thread.h"
-#endif
+#endif // ENABLE_LOG
using threads::Thread;
namespace main_namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "appMain")
+CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
namespace {
void NameMessageBrokerThread(const System::Thread& thread,
@@ -58,117 +61,86 @@ void NameMessageBrokerThread(const System::Thread& thread,
} // namespace
LifeCycle::LifeCycle()
- : transport_manager_(NULL)
- , protocol_handler_(NULL)
- , connection_handler_(NULL)
- , app_manager_(NULL)
+ : transport_manager_(NULL)
+ , protocol_handler_(NULL)
+ , connection_handler_(NULL)
+ , app_manager_(NULL)
#ifdef ENABLE_SECURITY
- , crypto_manager_(NULL)
- , security_manager_(NULL)
+ , crypto_manager_(NULL)
+ , security_manager_(NULL)
#endif // ENABLE_SECURITY
- , hmi_handler_(NULL)
- , hmi_message_adapter_(NULL)
- , media_manager_(NULL)
-#ifdef TIME_TESTER
- , time_tester_(NULL)
-#endif // TIME_TESTER
+ , hmi_handler_(NULL)
+ , hmi_message_adapter_(NULL)
+ , media_manager_(NULL)
+#ifdef TELEMETRY_MONITOR
+ , telemetry_monitor_(NULL)
+#endif // TELEMETRY_MONITOR
#ifdef DBUS_HMIADAPTER
- , dbus_adapter_(NULL)
- , dbus_adapter_thread_(NULL)
+ , dbus_adapter_(NULL)
+ , dbus_adapter_thread_(NULL)
#endif // DBUS_HMIADAPTER
#ifdef MESSAGEBROKER_HMIADAPTER
- , mb_adapter_(NULL)
- , message_broker_(NULL)
- , message_broker_server_(NULL)
- , mb_thread_(NULL)
- , mb_server_thread_(NULL)
- , mb_adapter_thread_(NULL)
+ , mb_adapter_(NULL)
+ , message_broker_(NULL)
+ , message_broker_server_(NULL)
+ , mb_thread_(NULL)
+ , mb_server_thread_(NULL)
+ , mb_adapter_thread_(NULL)
#endif // MESSAGEBROKER_HMIADAPTER
- , components_started_(false)
-{ }
+{
+}
bool LifeCycle::StartComponents() {
- LOG4CXX_INFO(logger_, "LifeCycle::StartComponents()");
- transport_manager_ =
- transport_manager::TransportManagerDefault::instance();
- DCHECK(transport_manager_ != NULL);
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK(!transport_manager_);
+ transport_manager_ = transport_manager::TransportManagerDefault::instance();
+ DCHECK(transport_manager_);
+ DCHECK(!connection_handler_);
+ connection_handler_ = new connection_handler::ConnectionHandlerImpl(
+ *profile::Profile::instance(),
+ *transport_manager_);
+ DCHECK(connection_handler_);
+
+ DCHECK(!protocol_handler_);
protocol_handler_ =
- new protocol_handler::ProtocolHandlerImpl(transport_manager_,
- profile::Profile::instance()->message_frequency_time(),
- profile::Profile::instance()->message_frequency_count(),
- profile::Profile::instance()->malformed_message_filtering(),
- profile::Profile::instance()->malformed_frequency_time(),
- profile::Profile::instance()->malformed_frequency_count());
- DCHECK(protocol_handler_ != NULL);
-
- connection_handler_ =
- connection_handler::ConnectionHandlerImpl::instance();
- DCHECK(connection_handler_ != NULL);
-
- app_manager_ =
- application_manager::ApplicationManagerImpl::instance();
- DCHECK(app_manager_ != NULL);
+ new protocol_handler::ProtocolHandlerImpl(*(profile::Profile::instance()),
+ *connection_handler_,
+ *connection_handler_,
+ *transport_manager_);
+ DCHECK(protocol_handler_);
+
+ DCHECK(!app_manager_);
+ app_manager_ = application_manager::ApplicationManagerImpl::instance();
+ DCHECK(app_manager_);
+
if (!app_manager_->Init()) {
LOG4CXX_ERROR(logger_, "Application manager init failed.");
return false;
}
- hmi_handler_ =
- hmi_message_handler::HMIMessageHandlerImpl::instance();
- DCHECK(hmi_handler_ != NULL)
+ DCHECK(!hmi_handler_)
+ hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl(
+ *(profile::Profile::instance()));
+ DCHECK(hmi_handler_)
#ifdef ENABLE_SECURITY
security_manager_ = new security_manager::SecurityManagerImpl();
+ crypto_manager_ = new security_manager::CryptoManagerImpl(
+ utils::MakeShared<security_manager::CryptoManagerSettingsImpl>(
+ *(profile::Profile::instance()),
+ policy::PolicyHandler::instance()->RetrieveCertificate()));
+ protocol_handler_->AddProtocolObserver(security_manager_);
+ protocol_handler_->set_security_manager(security_manager_);
- // FIXME(EZamakhov): move to Config or in Sm initialization method
- std::string cert_filename;
- profile::Profile::instance()->ReadStringValue(
- &cert_filename, "",
- security_manager::SecurityManagerImpl::ConfigSection(), "CertificatePath");
-
- std::string ssl_mode;
- profile::Profile::instance()->ReadStringValue(
- &ssl_mode, "CLIENT", security_manager::SecurityManagerImpl::ConfigSection(), "SSLMode");
- crypto_manager_ = new security_manager::CryptoManagerImpl();
-
- std::string key_filename;
- profile::Profile::instance()->ReadStringValue(
- &key_filename, "", security_manager::SecurityManagerImpl::ConfigSection(), "KeyPath");
-
- std::string ciphers_list;
- profile::Profile::instance()->ReadStringValue(
- &ciphers_list, SSL_TXT_ALL, security_manager::SecurityManagerImpl::ConfigSection(), "CipherList");
-
- bool verify_peer;
- profile::Profile::instance()->ReadBoolValue(
- &verify_peer, false, security_manager::SecurityManagerImpl::ConfigSection(), "VerifyPeer");
-
- std::string protocol_name;
- profile::Profile::instance()->ReadStringValue(
- &protocol_name, "TLSv1.2", security_manager::SecurityManagerImpl::ConfigSection(), "Protocol");
-
- security_manager::Protocol protocol;
- if (protocol_name == "TLSv1.0") {
- protocol = security_manager::TLSv1;
- } else if (protocol_name == "TLSv1.1") {
- protocol = security_manager::TLSv1_1;
- } else if (protocol_name == "TLSv1.2") {
- protocol = security_manager::TLSv1_2;
- } else if (protocol_name == "SSLv3") {
- protocol = security_manager::SSLv3;
- } else {
- LOG4CXX_ERROR(logger_, "Unknown protocol: " << protocol_name);
- return false;
- }
+ security_manager_->set_session_observer(connection_handler_);
+ security_manager_->set_protocol_handler(protocol_handler_);
+ security_manager_->set_crypto_manager(crypto_manager_);
+ security_manager_->AddListener(app_manager_);
- if (!crypto_manager_->Init(
- ssl_mode == "SERVER" ? security_manager::SERVER : security_manager::CLIENT,
- protocol,
- cert_filename,
- key_filename,
- ciphers_list,
- verify_peer)) {
+ app_manager_->AddPolicyObserver(crypto_manager_);
+ if (!crypto_manager_->Init()) {
LOG4CXX_ERROR(logger_, "CryptoManager initialization fail.");
return false;
}
@@ -181,30 +153,21 @@ bool LifeCycle::StartComponents() {
media_manager_ = media_manager::MediaManagerImpl::instance();
- protocol_handler_->set_session_observer(connection_handler_);
protocol_handler_->AddProtocolObserver(media_manager_);
protocol_handler_->AddProtocolObserver(app_manager_);
-#ifdef ENABLE_SECURITY
- protocol_handler_->AddProtocolObserver(security_manager_);
- protocol_handler_->set_security_manager(security_manager_);
-#endif // ENABLE_SECURITY
+
media_manager_->SetProtocolHandler(protocol_handler_);
- connection_handler_->set_transport_manager(transport_manager_);
connection_handler_->set_protocol_handler(protocol_handler_);
connection_handler_->set_connection_handler_observer(app_manager_);
-#ifdef ENABLE_SECURITY
- security_manager_->set_session_observer(connection_handler_);
- security_manager_->set_protocol_handler(protocol_handler_);
- security_manager_->set_crypto_manager(crypto_manager_);
-#endif // ENABLE_SECURITY
-
- // it is important to initialise TimeTester before TM to listen TM Adapters
-#ifdef TIME_TESTER
- time_tester_ = new time_tester::TimeManager();
- time_tester_->Init(protocol_handler_);
-#endif // TIME_TESTER
+// it is important to initialise TelemetryMonitor before TM to listen TM Adapters
+#ifdef TELEMETRY_MONITOR
+ telemetry_monitor_ = new telemetry_monitor::TelemetryMonitor(profile::Profile::instance()->server_address(),
+ profile::Profile::instance()->time_testing_port());
+ telemetry_monitor_->Start();
+ telemetry_monitor_->Init(protocol_handler_, app_manager_, transport_manager_);
+#endif // TELEMETRY_MONITOR
// It's important to initialise TM after setting up listener chain
// [TM -> CH -> AM], otherwise some events from TM could arrive at nowhere
app_manager_->set_protocol_handler(protocol_handler_);
@@ -215,24 +178,22 @@ bool LifeCycle::StartComponents() {
// start transport manager
transport_manager_->Visibility(true);
- components_started_ = true;
return true;
}
#ifdef MESSAGEBROKER_HMIADAPTER
bool LifeCycle::InitMessageSystem() {
- message_broker_ =
- NsMessageBroker::CMessageBroker::getInstance();
+ DCHECK(!message_broker_)
+ message_broker_ = NsMessageBroker::CMessageBroker::getInstance();
if (!message_broker_) {
LOG4CXX_FATAL(logger_, " Wrong pMessageBroker pointer!");
return false;
}
- message_broker_server_ =
- new NsMessageBroker::TcpServer(
- profile::Profile::instance()->server_address(),
- profile::Profile::instance()->server_port(),
- message_broker_);
+ message_broker_server_ = new NsMessageBroker::TcpServer(
+ profile::Profile::instance()->server_address(),
+ profile::Profile::instance()->server_port(),
+ message_broker_);
if (!message_broker_server_) {
LOG4CXX_FATAL(logger_, " Wrong pJSONRPC20Server pointer!");
return false;
@@ -257,43 +218,44 @@ bool LifeCycle::InitMessageSystem() {
LOG4CXX_INFO(logger_, " Message broker server listen successful!");
}
- mb_adapter_ =
- new hmi_message_handler::MessageBrokerAdapter(
- hmi_message_handler::HMIMessageHandlerImpl::instance(),
- profile::Profile::instance()->server_address(),
- profile::Profile::instance()->server_port());
-
- hmi_message_handler::HMIMessageHandlerImpl::instance()->AddHMIMessageAdapter(
- mb_adapter_);
- if (!mb_adapter_->Connect()) {
- LOG4CXX_FATAL(logger_, "Cannot connect to remote peer!");
- return false;
- }
+ mb_adapter_ = new hmi_message_handler::MessageBrokerAdapter(
+ hmi_handler_,
+ profile::Profile::instance()->server_address(),
+ profile::Profile::instance()->server_port());
+
+ hmi_handler_->AddHMIMessageAdapter(mb_adapter_);
+ if (!mb_adapter_->Connect()) {
+ LOG4CXX_FATAL(logger_, "Cannot connect to remote peer!");
+ return false;
+ }
LOG4CXX_INFO(logger_, "Start CMessageBroker thread!");
mb_thread_ = new System::Thread(
- new System::ThreadArgImpl<NsMessageBroker::CMessageBroker>(
- *message_broker_, &NsMessageBroker::CMessageBroker::MethodForThread,
- NULL));
+ new System::ThreadArgImpl<NsMessageBroker::CMessageBroker>(
+ *message_broker_,
+ &NsMessageBroker::CMessageBroker::MethodForThread,
+ NULL));
mb_thread_->Start(false);
// Thread can be named only when started because before that point
// thread doesn't have valid Id to associate name with
NameMessageBrokerThread(*mb_thread_, "MessageBroker");
LOG4CXX_INFO(logger_, "Start MessageBroker TCP server thread!");
- mb_server_thread_ = new System::Thread(
- new System::ThreadArgImpl<NsMessageBroker::TcpServer>(
- *message_broker_server_, &NsMessageBroker::TcpServer::MethodForThread,
- NULL));
+ mb_server_thread_ =
+ new System::Thread(new System::ThreadArgImpl<NsMessageBroker::TcpServer>(
+ *message_broker_server_,
+ &NsMessageBroker::TcpServer::MethodForThread,
+ NULL));
mb_server_thread_->Start(false);
NameMessageBrokerThread(*mb_server_thread_, "MB TCPServer");
LOG4CXX_INFO(logger_, "StartAppMgr JSONRPC 2.0 controller receiver thread!");
- mb_adapter_thread_ = new System::Thread(
- new System::ThreadArgImpl<hmi_message_handler::MessageBrokerAdapter>(
- *mb_adapter_,
- &hmi_message_handler::MessageBrokerAdapter::SubscribeAndBeginReceiverThread,
- NULL));
+ mb_adapter_thread_ = new System::Thread(
+ new System::ThreadArgImpl<hmi_message_handler::MessageBrokerAdapter>(
+ *mb_adapter_,
+ &hmi_message_handler::MessageBrokerAdapter::
+ SubscribeAndBeginReceiverThread,
+ NULL));
mb_adapter_thread_->Start(false);
NameMessageBrokerThread(*mb_adapter_thread_, "MB Adapter");
@@ -308,10 +270,10 @@ bool LifeCycle::InitMessageSystem() {
*/
bool LifeCycle::InitMessageSystem() {
dbus_adapter_ = new hmi_message_handler::DBusMessageAdapter(
- hmi_message_handler::HMIMessageHandlerImpl::instance());
+ hmi_message_handler::HMIMessageHandlerImpl::instance());
hmi_message_handler::HMIMessageHandlerImpl::instance()->AddHMIMessageAdapter(
- dbus_adapter_);
+ dbus_adapter_);
if (!dbus_adapter_->Init()) {
LOG4CXX_FATAL(logger_, "Cannot init DBus service!");
return false;
@@ -321,10 +283,10 @@ bool LifeCycle::InitMessageSystem() {
LOG4CXX_INFO(logger_, "Start DBusMessageAdapter thread!");
dbus_adapter_thread_ = new System::Thread(
- new System::ThreadArgImpl<hmi_message_handler::DBusMessageAdapter>(
- *dbus_adapter_,
- &hmi_message_handler::DBusMessageAdapter::MethodForReceiverThread,
- NULL));
+ new System::ThreadArgImpl<hmi_message_handler::DBusMessageAdapter>(
+ *dbus_adapter_,
+ &hmi_message_handler::DBusMessageAdapter::MethodForReceiverThread,
+ NULL));
dbus_adapter_thread_->Start(false);
return true;
@@ -334,88 +296,97 @@ bool LifeCycle::InitMessageSystem() {
#ifdef MQUEUE_HMIADAPTER
bool LifeCycle::InitMessageSystem() {
hmi_message_adapter_ = new hmi_message_handler::MqueueAdapter(
- hmi_message_handler::HMIMessageHandlerImpl::instance());
+ hmi_message_handler::HMIMessageHandlerImpl::instance());
hmi_message_handler::HMIMessageHandlerImpl::instance()->AddHMIMessageAdapter(
- hmi_message_adapter_);
+ hmi_message_adapter_);
return true;
}
#endif // MQUEUE_HMIADAPTER
namespace {
-
void sig_handler(int sig) {
- // Do nothing
- }
-
- void agony(int sig) {
-// these actions are not signal safe
-// (in case logger is on)
-// but they cannot be moved to a separate thread
-// because the application most probably will crash as soon as this handler returns
-//
-// the application is anyway about to crash
- LOG4CXX_FATAL(logger_, "Stopping application due to segmentation fault");
-#ifdef ENABLE_LOG
- logger::LogMessageLoopThread::destroy();
-#endif
+ switch(sig) {
+ case SIGINT:
+ LOG4CXX_DEBUG(logger_, "SIGINT signal has been caught");
+ break;
+ case SIGTERM:
+ LOG4CXX_DEBUG(logger_, "SIGTERM signal has been caught");
+ break;
+ case SIGSEGV:
+ LOG4CXX_DEBUG(logger_, "SIGSEGV signal has been caught");
+ FLUSH_LOGGER();
+ // exit need to prevent endless sending SIGSEGV
+ // http://stackoverflow.com/questions/2663456/how-to-write-a-signal-handler-to-catch-sigsegv
+ abort();
+ default:
+ LOG4CXX_DEBUG(logger_, "Unexpected signal has been caught");
+ exit(EXIT_FAILURE);
+ }
}
-
} // namespace
void LifeCycle::Run() {
- // First, register signal handlers
- ::utils::SubscribeToTerminateSignal(&sig_handler);
- ::utils::SubscribeToFaultSignal(&agony);
- // Now wait for any signal
- pause();
+ LOG4CXX_AUTO_TRACE(logger_);
+ // Register signal handlers and wait sys signals
+ // from OS
+ if (!utils::WaitTerminationSignals(&sig_handler)) {
+ LOG4CXX_FATAL(logger_, "Fail to catch system signal!");
+ }
}
-
void LifeCycle::StopComponents() {
- if (!components_started_) {
- LOG4CXX_TRACE(logger_, "exit");
- LOG4CXX_ERROR(logger_, "Components wasn't started");
- return;
- }
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK_OR_RETURN_VOID(hmi_handler_);
hmi_handler_->set_message_observer(NULL);
+
+ DCHECK_OR_RETURN_VOID(connection_handler_);
connection_handler_->set_connection_handler_observer(NULL);
+
+ DCHECK_OR_RETURN_VOID(protocol_handler_);
protocol_handler_->RemoveProtocolObserver(app_manager_);
+
+ DCHECK_OR_RETURN_VOID(app_manager_);
app_manager_->Stop();
LOG4CXX_INFO(logger_, "Stopping Protocol Handler");
+ DCHECK_OR_RETURN_VOID(protocol_handler_);
protocol_handler_->RemoveProtocolObserver(media_manager_);
+
#ifdef ENABLE_SECURITY
protocol_handler_->RemoveProtocolObserver(security_manager_);
+ if (security_manager_) {
+ security_manager_->RemoveListener(app_manager_);
+ LOG4CXX_INFO(logger_, "Destroying Crypto Manager");
+ delete crypto_manager_;
+ LOG4CXX_INFO(logger_, "Destroying Security Manager");
+ delete security_manager_;
+ }
#endif // ENABLE_SECURITY
protocol_handler_->Stop();
LOG4CXX_INFO(logger_, "Destroying Media Manager");
+ DCHECK_OR_RETURN_VOID(media_manager_);
media_manager_->SetProtocolHandler(NULL);
media_manager::MediaManagerImpl::destroy();
LOG4CXX_INFO(logger_, "Destroying Transport Manager.");
+ DCHECK_OR_RETURN_VOID(transport_manager_);
transport_manager_->Visibility(false);
transport_manager_->Stop();
transport_manager::TransportManagerDefault::destroy();
LOG4CXX_INFO(logger_, "Stopping Connection Handler.");
- connection_handler::ConnectionHandlerImpl::instance()->Stop();
+ DCHECK_OR_RETURN_VOID(connection_handler_);
+ connection_handler_->Stop();
LOG4CXX_INFO(logger_, "Destroying Protocol Handler");
+ DCHECK_OR_RETURN_VOID(protocol_handler_);
delete protocol_handler_;
LOG4CXX_INFO(logger_, "Destroying Connection Handler.");
- connection_handler::ConnectionHandlerImpl::destroy();
-
-#ifdef ENABLE_SECURITY
- LOG4CXX_INFO(logger_, "Destroying Crypto Manager");
- crypto_manager_->Finish();
- delete crypto_manager_;
-
- LOG4CXX_INFO(logger_, "Destroying Security Manager");
- delete security_manager_;
-#endif // ENABLE_SECURITY
+ delete connection_handler_;
LOG4CXX_INFO(logger_, "Destroying Last State");
resumption::LastState::destroy();
@@ -424,6 +395,7 @@ void LifeCycle::StopComponents() {
application_manager::ApplicationManagerImpl::destroy();
LOG4CXX_INFO(logger_, "Destroying HMI Message Handler and MB adapter.");
+
#ifdef DBUS_HMIADAPTER
if (dbus_adapter_) {
if (hmi_handler_) {
@@ -438,27 +410,22 @@ void LifeCycle::StopComponents() {
delete dbus_adapter_;
}
#endif // DBUS_HMIADAPTER
+
#ifdef MESSAGEBROKER_HMIADAPTER
+ DCHECK_OR_RETURN_VOID(mb_adapter_);
hmi_handler_->RemoveHMIMessageAdapter(mb_adapter_);
- if (mb_adapter_) {
- mb_adapter_->unregisterController();
- mb_adapter_->Close();
- mb_adapter_->exitReceivingThread();
- if (mb_adapter_thread_) {
- mb_adapter_thread_->Join();
- }
- delete mb_adapter_;
- }
- hmi_message_handler::HMIMessageHandlerImpl::destroy();
+ mb_adapter_->unregisterController();
+ mb_adapter_->exitReceivingThread();
if (mb_adapter_thread_) {
mb_adapter_thread_->Stop();
+ mb_adapter_thread_->Join();
delete mb_adapter_thread_;
}
+ delete mb_adapter_;
-#endif // MESSAGEBROKER_HMIADAPTER
-
+ DCHECK_OR_RETURN_VOID(hmi_handler_);
+ delete hmi_handler_;
-#ifdef MESSAGEBROKER_HMIADAPTER
LOG4CXX_INFO(logger_, "Destroying Message Broker");
if (mb_server_thread_) {
mb_server_thread_->Stop();
@@ -470,9 +437,14 @@ void LifeCycle::StopComponents() {
mb_thread_->Join();
delete mb_thread_;
}
- message_broker_server_->Close();
+ if (message_broker_server_) {
+ message_broker_server_->Close();
+ }
delete message_broker_server_;
- message_broker_->stopMessageBroker();
+
+ if (message_broker_) {
+ message_broker_->stopMessageBroker();
+ }
networking::cleanup();
#endif // MESSAGEBROKER_HMIADAPTER
@@ -480,16 +452,14 @@ void LifeCycle::StopComponents() {
delete hmi_message_adapter_;
hmi_message_adapter_ = NULL;
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
// It's important to delete tester Obcervers after TM adapters destruction
- if (time_tester_) {
- time_tester_->Stop();
- delete time_tester_;
- time_tester_ = NULL;
+ if (telemetry_monitor_) {
+ telemetry_monitor_->Stop();
+ delete telemetry_monitor_;
+ telemetry_monitor_ = NULL;
}
-#endif // TIME_TESTER
- components_started_ = false;
- LOG4CXX_TRACE(logger_, "exit");
+#endif // TELEMETRY_MONITOR
}
} // namespace main_namespace
diff --git a/src/appMain/life_cycle.h b/src/appMain/life_cycle.h
index d85678047f..7f72786164 100644
--- a/src/appMain/life_cycle.h
+++ b/src/appMain/life_cycle.h
@@ -52,8 +52,8 @@
#include "transport_manager/transport_manager_default.h"
#include "media_manager/media_manager_impl.h"
#include "utils/singleton.h"
-#ifdef TIME_TESTER
-#include "time_tester/time_manager.h"
+#ifdef TELEMETRY_MONITOR
+#include "telemetry_monitor/telemetry_monitor.h"
#endif
//#if ( defined (MESSAGEBROKER_HMIADAPTER) || defined(PASA_HMI) )
@@ -90,7 +90,7 @@ class LifeCycle : public utils::Singleton<LifeCycle> {
private:
LifeCycle();
- transport_manager::TransportManager* transport_manager_;
+ transport_manager::TransportManagerImpl* transport_manager_;
protocol_handler::ProtocolHandlerImpl* protocol_handler_;
connection_handler::ConnectionHandlerImpl* connection_handler_;
application_manager::ApplicationManagerImpl* app_manager_;
@@ -99,11 +99,11 @@ class LifeCycle : public utils::Singleton<LifeCycle> {
security_manager::SecurityManager* security_manager_;
#endif // ENABLE_SECURITY
hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_;
- hmi_message_handler::HMIMessageAdapter* hmi_message_adapter_;
+ hmi_message_handler::HMIMessageAdapterImpl* hmi_message_adapter_;
media_manager::MediaManagerImpl* media_manager_;
-#ifdef TIME_TESTER
- time_tester::TimeManager* time_tester_;
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+ telemetry_monitor::TelemetryMonitor* telemetry_monitor_;
+#endif // TELEMETRY_MONITOR
#ifdef DBUS_HMIADAPTER
hmi_message_handler::DBusMessageAdapter* dbus_adapter_;
System::Thread* dbus_adapter_thread_;
@@ -119,7 +119,6 @@ class LifeCycle : public utils::Singleton<LifeCycle> {
#endif // MESSAGEBROKER_HMIADAPTER
- bool components_started_;
FRIEND_BASE_SINGLETON_CLASS(LifeCycle);
DISALLOW_COPY_AND_ASSIGN(LifeCycle);
};
diff --git a/src/appMain/log4cxx.properties b/src/appMain/log4cxx.properties
index 6a12f8c9b5..4153b487fe 100644
--- a/src/appMain/log4cxx.properties
+++ b/src/appMain/log4cxx.properties
@@ -1,52 +1,40 @@
+# Console logging
+log4j.appender.Console=org.apache.log4j.ConsoleAppender
+log4j.appender.Console.ImmediateFlush=true
+log4j.appender.Console.layout=org.apache.log4j.PatternLayout
+log4j.appender.Console.layout.ConversionPattern=%-5p [%d{HH:mm:ss,SSS}][%c] %m%n
+log4j.appender.Console.Threshold=DEBUG
+
# Log for all SmartDeviceLinkCoreSocketHub messages
log4j.appender.SmartDeviceLinkCoreSocketHub=org.apache.log4j.net.SocketHubAppender
log4j.appender.SmartDeviceLinkCoreSocketHub.port=4555
log4j.appender.SmartDeviceLinkCoreSocketHub.locationInfo=true
-# Only ERROR and FATAL messages are logged to console
-log4j.appender.Console=org.apache.log4j.ConsoleAppender
-log4j.appender.Console.ImmediateFlush=true
-log4j.appender.Console.layout=org.apache.log4j.PatternLayout
-log4j.appender.Console.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %m%n
-log4j.appender.Console.Threshold=DEBUG
+# Logging via telnet
+log4j.appender.TelnetLogging=org.apache.log4j.TelnetAppender
+log4j.appender.TelnetLogging.port=6676
+log4j.appender.TelnetLogging.layout=org.apache.log4j.PatternLayout
+log4j.appender.TelnetLogging.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%t][%c] %F:%L %M: %m%n
-# Log for all SmartDeviceLinkCore messages
+# Log file for all SmartDeviceLinkCore messages
log4j.appender.SmartDeviceLinkCoreLogFile=SafeFileAppender
log4j.appender.SmartDeviceLinkCoreLogFile.File=SmartDeviceLinkCore.log
log4j.appender.SmartDeviceLinkCoreLogFile.append=true
log4j.appender.SmartDeviceLinkCoreLogFile.DatePattern='.' yyyy-MM-dd HH-mm
log4j.appender.SmartDeviceLinkCoreLogFile.ImmediateFlush=true
log4j.appender.SmartDeviceLinkCoreLogFile.layout=org.apache.log4j.PatternLayout
-log4j.appender.SmartDeviceLinkCoreLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n
+log4j.appender.SmartDeviceLinkCoreLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%t][%c] %F:%L %M: %m%n
-# Log for all TransportManager messages
+# Log file for all TransportManager messages
log4j.appender.TransportManagerLogFile=SafeFileAppender
log4j.appender.TransportManagerLogFile.File=TransportManager.log
log4j.appender.TransportManagerLogFile.append=false
log4j.appender.TransportManagerLogFile.DatePattern='.' yyyy-MM-dd HH-mm
log4j.appender.TransportManagerLogFile.ImmediateFlush=true
log4j.appender.TransportManagerLogFile.layout=org.apache.log4j.PatternLayout
-log4j.appender.TransportManagerLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n
-
-# Log for all DBus plugin messages
-log4j.appender.DBusPluginLogFile=SafeFileAppender
-log4j.appender.DBusPluginLogFile.File=DBusPlugin.log
-log4j.appender.DBusPluginLogFile.append=false
-log4j.appender.DBusPluginLogFile.DatePattern='.' yyyy-MM-dd
-log4j.appender.DBusPluginLogFile.ImmediateFlush=true
-log4j.appender.DBusPluginLogFile.layout=org.apache.log4j.PatternLayout
-log4j.appender.DBusPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n
+log4j.appender.TransportManagerLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%t][%c] %F:%L %M: %m%n
-# Log for all HMI Framework plugin
-log4j.appender.HmiFrameworkPluginLogFile=SafeFileAppender
-log4j.appender.HmiFrameworkPluginLogFile.File=HmiFrameworkPlugin.log
-log4j.appender.HmiFrameworkPluginLogFile.append=false
-log4j.appender.HmiFrameworkPluginLogFile.DatePattern='.' yyyy-MM-dd
-log4j.appender.HmiFrameworkPluginLogFile.ImmediateFlush=true
-log4j.appender.HmiFrameworkPluginLogFile.layout=org.apache.log4j.PatternLayout
-log4j.appender.HmiFrameworkPluginLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %F:%L %M: %m%n
-
-# Log for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager, SSLContext)
+# Log for handling Ford protocol info (include ProtocolHandler, ConnectionHandler, SecurityManager)
log4j.appender.ProtocolFordHandlingLogFile=SafeFileAppender
log4j.appender.ProtocolFordHandlingLogFile.File=ProtocolFordHandling.log
log4j.appender.ProtocolFordHandlingLogFile.append=false
@@ -55,24 +43,26 @@ log4j.appender.ProtocolFordHandlingLogFile.ImmediateFlush=true
log4j.appender.ProtocolFordHandlingLogFile.layout=org.apache.log4j.PatternLayout
log4j.appender.ProtocolFordHandlingLogFile.layout.ConversionPattern=%-5p [%d{dd MMM yyyy HH:mm:ss,SSS}][%c] %M: %m%n
-# All SmartDeviceLinkCore logs
-log4j.rootLogger=ALL, Console, SmartDeviceLinkCoreLogFile, SmartDeviceLinkCoreSocketHub
-
-# TransportManager logs
-log4j.logger.TransportManager=ALL, TransportManagerLogFile
-
-# Log for DBus plugin QtHMI
-log4j.logger.DBusPlugin=ALL, DBusPluginLogFile
-
-# Log for HMI Framework plugin
-log4j.logger.HmiFrameworkPlugin=ALL, HmiFrameworkPluginLogFile
-
-# Log by log4cxx plugin
-log4j.logger.Log4cxxPlugin=ALL, HmiFrameworkPluginLogFile
+# Root logging settings
+# Set ALL logging levels to Console, main log file, Socket and Telnet
+log4j.rootLogger=ALL, Console, SmartDeviceLinkCoreLogFile, SmartDeviceLinkCoreSocketHub, TelnetLogging
-# Log by ProtocolHandler
-log4j.logger.ProtocolHandler=ALL, ProtocolFordHandlingLogFile
-# Log by ConnectionHandler
-log4j.logger.ConnectionHandler=ALL, ProtocolFordHandlingLogFile
-# Log by SecurityManager
-log4j.logger.SecurityManager=ALL, ProtocolFordHandlingLogFile
+# Components loggers with own logging levels
+log4j.logger.SDLMain = ALL
+log4j.logger.Utils = ALL
+log4j.logger.Profile = ALL
+log4j.logger.ApplicationManager = ALL
+log4j.logger.Commands = ALL
+log4j.logger.PolicyHandler = ALL
+log4j.logger.Policy = ALL
+log4j.logger.Resumption = ALL
+log4j.logger.HMIMessageHandler = ALL
+log4j.logger.RequestController = ALL
+log4j.logger.StateController = ALL
+log4j.logger.MediaManager = ALL
+log4j.logger.ConnectionHandler = ALL, ProtocolFordHandlingLogFile
+log4j.logger.HeartBeatMonitor = ALL, ProtocolFordHandlingLogFile
+log4j.logger.ProtocolHandler = ALL, ProtocolFordHandlingLogFile
+log4j.logger.SecurityManager = ALL, ProtocolFordHandlingLogFile
+log4j.logger.TelemetryMonitor = ALL
+log4j.logger.TransportManager = ALL, TransportManagerLogFile
diff --git a/src/appMain/main.cc b/src/appMain/main.cc
index 2c14bfa3b6..69077a578c 100644
--- a/src/appMain/main.cc
+++ b/src/appMain/main.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -65,7 +65,7 @@
// ----------------------------------------------------------------------------
-CREATE_LOGGERPTR_GLOBAL(logger_, "appMain")
+CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
namespace {
@@ -83,7 +83,7 @@ bool InitHmi() {
std::string hmi_link = profile::Profile::instance()->link_to_web_hmi();
struct stat sb;
if (stat(hmi_link.c_str(), &sb) == -1) {
- LOG4CXX_FATAL(logger_, "HMI index.html doesn't exist!");
+ LOG4CXX_FATAL(logger_, "HMI index file " << hmi_link << " doesn't exist!");
return false;
}
return utils::System(kBrowser, kBrowserName).Add(kBrowserParams).Add(hmi_link)
@@ -117,15 +117,22 @@ bool InitHmi() {
* \return EXIT_SUCCESS or EXIT_FAILURE
*/
int32_t main(int32_t argc, char** argv) {
+ // Unsibscribe once for all threads
+ if (!utils::UnsibscribeFromTermination()) {
+ // Can't use internal logger here
+ exit(EXIT_FAILURE);
+ }
// --------------------------------------------------------------------------
+ if ((argc > 1)&&(0 != argv)) {
+ profile::Profile::instance()->config_file_name(argv[1]);
+ } else {
+ profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
+ }
+
// Logger initialization
- INIT_LOGGER("log4cxx.properties");
-#if defined(__QNXNTO__) and defined(GCOV_ENABLED)
- LOG4CXX_WARN(logger_,
- "Attention! This application was built with unsupported "
- "configuration (gcov + QNX). Use it at your own risk.");
-#endif
+ INIT_LOGGER("log4cxx.properties",
+ profile::Profile::instance()->logs_enabled());
threads::Thread::SetNameForId(threads::Thread::CurrentId(), "MainThread");
@@ -137,29 +144,8 @@ int32_t main(int32_t argc, char** argv) {
LOG4CXX_INFO(logger_, "SDL version: "
<< profile::Profile::instance()->sdl_version());
- // Initialize gstreamer. Needed to activate debug from the command line.
-#if defined(EXTENDED_MEDIA_MODE)
- gst_init(&argc, &argv);
-#endif
-
// --------------------------------------------------------------------------
// Components initialization
- if ((argc > 1)&&(0 != argv)) {
- profile::Profile::instance()->config_file_name(argv[1]);
- } else {
- profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
- }
-
-#ifdef __QNX__
- if (profile::Profile::instance()->enable_policy()) {
- if (!utils::System("./init_policy.sh").Execute(true)) {
- LOG4CXX_FATAL(logger_, "Failed to init policy database");
- DEINIT_LOGGER();
- exit(EXIT_FAILURE);
- }
- }
-#endif // __QNX__
-
if (!main_namespace::LifeCycle::instance()->StartComponents()) {
LOG4CXX_FATAL(logger_, "Failed to start components");
main_namespace::LifeCycle::instance()->StopComponents();
diff --git a/src/appMain/sdl_preloaded_pt.json b/src/appMain/sdl_preloaded_pt.json
index 6b20f51cd5..8cfd70fa18 100644
--- a/src/appMain/sdl_preloaded_pt.json
+++ b/src/appMain/sdl_preloaded_pt.json
@@ -1,2323 +1,2273 @@
-{
- "policy_table": {
- "module_config": {
- "preloaded_pt": true,
- "exchange_after_x_ignition_cycles": 100,
- "exchange_after_x_kilometers": 1800,
- "exchange_after_x_days": 20,
- "timeout_after_x_seconds": 60,
- "seconds_between_retries": [
- 1,
- 5,
- 25,
- 125,
- 625
- ],
- "endpoints": {
- "0x07": {
- "default": ["http://policies.telematics.ford.com/api/policies"]
- },
- "0x04": {
- "default": ["http://ivsu.software.ford.com/api/getsoftwareupdates"]
- },
- "queryAppsUrl": {
- "default": ["http://sdl.shaid.server"]
- },
- "lock_screen_icon_url": {
- "default": ["http://i.imgur.com/QwZ9uKG.png"]
- }
- },
- "notifications_per_minute_by_priority": {
- "EMERGENCY": 60,
- "NAVIGATION": 15,
- "VOICECOM": 20,
- "COMMUNICATION": 6,
- "NORMAL": 4,
- "NONE": 0
- }
- },
- "functional_groupings": {
- "Base-4": {
- "rpcs": {
- "AddCommand": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "AddSubMenu": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "Alert": {
- "hmi_levels": [
- "FULL",
- "LIMITED"
- ]
- },
- "ChangeRegistration": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "CreateInteractionChoiceSet": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "DeleteCommand": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "DeleteFile": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "DeleteInteractionChoiceSet": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "DeleteSubMenu": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "EncodedSyncPData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "EndAudioPassThru": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "GenericResponse": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ListFiles": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnAudioPassThru": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnButtonEvent": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnButtonPress": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnCommand": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnDriverDistraction": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnHashChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnHMIStatus": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnLanguageChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnPermissionsChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnSystemRequest": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "PerformAudioPassThru": {
- "hmi_levels": [
- "FULL",
- "LIMITED"
- ]
- },
- "PerformInteraction": {
- "hmi_levels": [
- "FULL",
- "LIMITED"
- ]
- },
- "PutFile": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "RegisterAppInterface": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "ResetGlobalProperties": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "ScrollableMessage": {
- "hmi_levels": [
- "FULL"
- ]
- },
- "SetAppIcon": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetDisplayLayout": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetGlobalProperties": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetMediaClockTimer": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "Show": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "Slider": {
- "hmi_levels": [
- "FULL"
- ]
- },
- "Speak": {
- "hmi_levels": [
- "FULL",
- "LIMITED"
- ]
- },
- "SubscribeButton": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "SystemRequest": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "UnregisterAppInterface": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "UnsubscribeButton": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "Location-1": {
- "user_consent_prompt": "Location",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "gps",
- "speed"
- ]
- },
- "OnVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "gps",
- "speed"
- ]
- },
- "SubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "gps",
- "speed"
- ]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "gps",
- "speed"
- ]
- }
- }
- },
- "Notifications": {
- "user_consent_prompt": "Notifications",
- "rpcs": {
- "Alert": {
- "hmi_levels": [
- "BACKGROUND"
- ]
- }
- }
- },
- "DrivingCharacteristics-3": {
- "user_consent_prompt": "DrivingCharacteristics",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"
- ]
- },
- "OnVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"
- ]
- },
- "SubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"
- ]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "accPedalPosition",
- "beltStatus",
- "driverBraking",
- "myKey",
- "prndl",
- "rpm",
- "steeringWheelAngle"
- ]
- }
- }
- },
- "VehicleInfo-3": {
- "user_consent_prompt": "VehicleInfo",
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "bodyInformation",
- "deviceStatus",
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus"
- ]
- },
- "OnVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "bodyInformation",
- "deviceStatus",
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "vin",
- "wiperStatus"
- ]
- },
- "SubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "bodyInformation",
- "deviceStatus",
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "wiperStatus"
- ]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "bodyInformation",
- "deviceStatus",
- "engineTorque",
- "externalTemperature",
- "fuelLevel",
- "fuelLevel_State",
- "headLampStatus",
- "instantFuelConsumption",
- "odometer",
- "tirePressure",
- "wiperStatus"
- ]
- }
- }
- },
- "Emergency-1": {
- "rpcs": {
- "GetVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"
- ]
- },
- "OnVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"
- ]
- },
- "SubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"
- ]
- },
- "UnsubscribeVehicleData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ],
- "parameters": [
- "airbagStatus",
- "clusterModeStatus",
- "eCallInfo",
- "emergencyEvent"
- ]
- }
- }
- },
- "Navigation-1": {
- "rpcs": {
- "AlertManeuver": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ShowConstantTBT": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "UpdateTurnList": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "PropriataryData-1": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "GetDTCs": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ReadDID": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "ProprietaryData-3": {
- "rpcs": {
- "GetDTCs": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ReadDID": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "DataConsent-2": {
- "user_consent_prompt": "DataConsent",
- "rpcs": null
- },
- "PropriataryData-2": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "GetDTCs": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- },
- "ReadDID": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "DiagnosticMessageOnly": {
- "rpcs": {
- "DiagnosticMessage": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "OnKeyboardInputOnlyGroup": {
- "rpcs": {
- "OnKeyboardInput": {
- "hmi_levels": [
- "FULL"
- ]
- }
- }
- },
- "OnTouchEventOnlyGroup": {
- "rpcs": {
- "OnTouchEvent": {
- "hmi_levels": [
- "FULL"
- ]
- }
- }
- },
- "BaseBeforeDataConsent": {
- "rpcs": {
- "ChangeRegistration": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "DeleteFile": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "EncodedSyncPData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "ListFiles": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnAppInterfaceUnregistered": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnEncodedSyncPData": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnHashChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnHMIStatus": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnLanguageChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnPermissionsChange": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "OnSystemRequest": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "PutFile": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "RegisterAppInterface": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "ResetGlobalProperties": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetAppIcon": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetDisplayLayout": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SetGlobalProperties": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "SystemRequest": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- },
- "UnregisterAppInterface": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED",
- "NONE"
- ]
- }
- }
- },
- "SendLocation": {
- "rpcs": {
- "SendLocation": {
- "hmi_levels": [
- "BACKGROUND",
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "BackgroundAPT": {
- "rpcs": {
- "EndAudioPassThru": {
- "hmi_levels": [
- "BACKGROUND"
- ]
- },
- "OnAudioPassThru": {
- "hmi_levels": [
- "BACKGROUND"
- ]
- },
- "PerformAudioPassThru": {
- "hmi_levels": [
- "BACKGROUND"
- ]
- }
- }
- },
- "DialNumberOnly": {
- "rpcs": {
- "DialNumber": {
- "hmi_levels": [
- "FULL",
- "LIMITED"
- ]
- }
- }
- },
- "SendLocationOnly": {
- "rpcs": {
- "SendLocation": {
- "hmi_levels": [
- "FULL",
- "LIMITED"
- ]
- }
- }
- }
- },
- "consumer_friendly_messages": {
- "version": "001.001.023",
- "messages": {
- "AppPermissions": {
- "languages": {
- "de-de": {
- "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
- "line1": "Zugriffsanfrage(n)",
- "line2": "erlauben?"
- },
- "en-au": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?"
- },
- "en-gb": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?",
- "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
- },
- "en-ie": {
- "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
- "line1": "Grant requested",
- "line2": "permission(s)?"
- },
- "en-us": {
- "tts": "%appName% is requesting permission to use the following: %functionalGroupLabels%.\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. Please press yes to allow or no to deny.",
- "line1": "Grant Requested",
- "line2": "Permission(s)?",
- "textBody": "The %appName% App is requesting permission to use the following: %functionalGroupLabels%.\r\n\r\nTo disable or change these settings at any time visit the SYNC mobile apps settings menu. See App terms of service and privacy policies. Ford is not responsible for App functionality. Avoid distractions and use voice controls where available. I agree and consent."
- },
- "es-en": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?",
- "textBody": "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior."
- },
- "es-es": {
- "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
- "line1": "¿Conceder permisos",
- "line2": "solicitados?"
- },
- "es-mx": {
- "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
- "line1": "¿Otorgar permiso(s)",
- "line2": "solicitado(s)?",
- "textBody": "La App %appName% solicita permiso para usar: %functionalGroupLabels%. \r\n\r\nPara desactivar o cambiar la configuración, acceda al menú de SYNC® de configuración de apps. Consulte términos de servicio y políticas de privacidad de la App. Ford no es responsable de la funcionalidad de la App. Evite distracciones y use los controles de voz cuando estén disponibles. Estoy de acuerdo y acepto lo anterior."
- },
- "fr-ca": {
- "tts": "L’application %appName% demande la permission d’utiliser : %functionalGroupLabels%. \r\nPour désactiver ou modifier ces réglages de données à tout moment, consultez le menu de réglages des applications mobiles SYNC. Reportez-vous aux modalités de service et à la politique de confidentialité de l’application. Ford n’est pas responsable de la fonctionnalité de l’application. Évitez les distractions et utilisez les commandes vocales lorsqu’elles sont disponibles. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
- "line1": "Accorder permission(s)",
- "line2": "demandée(s)",
- "textBody": "L’application %appName% demande la permission d’utiliser : %functionalGroupLabels%. \r\n\r\nPour désactiver ou modifier ces réglages de données à tout moment, consultez le menu de réglages des applications mobiles SYNC. Reportez-vous aux modalités de service et à la politique de confidentialité de l’application. Ford n’est pas responsable de la fonctionnalité de l’application. Évitez les distractions et utilisez les commandes vocales lorsqu’elles sont disponibles. J’accepte et je consens."
- },
- "fr-fr": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
- "line1": "Accorder permission(s)",
- "line2": "demandée(s)"
- },
- "it-it": {
- "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
- "line1": "Concedi autorizzaz.",
- "line2": "richiesta(e)?"
- },
- "nl-nl": {
- "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
- "line1": "Aangevraagde",
- "line2": "permissie(s) verlenen?"
- },
- "pl-pl": {
- "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
- "line1": "Udzielić żądanych",
- "line2": "pozwoleń?"
- },
- "pt-br": {
- "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
- "line1": "Conceder permissão",
- "line2": "solicitada?"
- },
- "pt-pt": {
- "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
- "line1": "Conceder permiss.",
- "line2": "solicitada(s)?"
- },
- "ru-ru": {
- "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
- "line1": "Предост. заправш.",
- "line2": "разрешения?"
- },
- "sv-se": {
- "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
- "line1": "Vill du ge",
- "line2": "tillstånd?"
- },
- "tr-tr": {
- "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
- "line1": "İstenen izinler",
- "line2": "verilsin mi?"
- },
- "zh-cn": {
- "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
- "line1": "是否允许请求的",
- "line2": "权限?"
- },
- "zh-tw": {
- "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
- "line1": "允許",
- "line2": "授權請求?"
- }
- }
- },
- "AppPermissionsHelp": {
- "languages": {
- "de-de": {
- "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
- },
- "en-au": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-gb": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-ie": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
- },
- "en-us": {
- "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
- },
- "es-en": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
- "es-es": {
- "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
- },
- "es-mx": {
- "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
- },
- "fr-ca": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
- },
- "fr-fr": {
- "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
- },
- "it-it": {
- "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
- },
- "nl-nl": {
- "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
- },
- "pl-pl": {
- "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
- },
- "pt-br": {
- "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
- },
- "pt-pt": {
- "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
- },
- "ru-ru": {
- "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
- },
- "sv-se": {
- "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
- },
- "tr-tr": {
- "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
- },
- "zh-cn": {
- "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
- },
- "zh-tw": {
- "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
- }
- }
- },
- "AppPermissionsRevoked": {
- "languages": {
- "de-de": {
- "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
- },
- "en-au": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-gb": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-ie": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "en-us": {
- "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
- },
- "es-en": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
- "es-es": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
- },
- "es-mx": {
- "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
- },
- "fr-ca": {
- "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
- },
- "fr-fr": {
- "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
- },
- "it-it": {
- "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
- },
- "nl-nl": {
- "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
- },
- "pl-pl": {
- "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
- },
- "pt-br": {
- "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
- },
- "pt-pt": {
- "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
- },
- "ru-ru": {
- "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
- },
- "sv-se": {
- "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
- },
- "tr-tr": {
- "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
- },
- "zh-cn": {
- "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
- },
- "zh-tw": {
- "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
- }
- }
- },
- "AppUnauthorized": {
- "languages": {
- "de-de": {
- "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
- "line1": "nicht autorisiert"
- },
- "en-au": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized"
- },
- "en-gb": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized",
- "textBody": "This version of %appName% is not authorized and will not work with SYNC."
- },
- "en-ie": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "not authorized"
- },
- "en-us": {
- "tts": "This version of %appName% is not authorized and will not work with SYNC.",
- "line1": "Not Authorized",
- "textBody": "This version of %appName% is no longer authorized to work with Mobile Apps. Please update to the latest version of %appName%."
- },
- "es-en": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada",
- "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
- "es-es": {
- "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
- "line1": "No autorizada"
- },
- "es-mx": {
- "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
- "line1": "no autorizada",
- "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
- },
- "fr-ca": {
- "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
- "line1": "non autorisée",
- "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
- },
- "fr-fr": {
- "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
- "line1": "non autorisée"
- },
- "it-it": {
- "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
- "line1": "non autorizzata"
- },
- "nl-nl": {
- "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
- "line1": "niet geautoriseerd"
- },
- "pl-pl": {
- "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
- "line1": "brak autoryzacji"
- },
- "pt-br": {
- "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
- "line1": "não autorizado"
- },
- "pt-pt": {
- "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
- "line1": "não autorizada"
- },
- "ru-ru": {
- "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
- "line1": "не авторизировано"
- },
- "sv-se": {
- "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
- "line1": "är ej godkänd"
- },
- "tr-tr": {
- "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
- "line1": "için izin yok"
- },
- "zh-cn": {
- "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
- "line1": "未得到授权"
- },
- "zh-tw": {
- "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
- "line1": "無授權"
- }
- }
- },
- "AppUnsupported": {
- "languages": {
- "de-de": {
- "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
- "line1": "nicht unterstützt"
- },
- "en-au": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported"
- },
- "en-gb": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported",
- "textBody": "This version of %appName% is not supported by SYNC."
- },
- "en-ie": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "not supported"
- },
- "en-us": {
- "tts": "This version of %appName% is not supported by SYNC.",
- "line1": "Not Supported",
- "textBody": "Your version of %appName% is not supported by SYNC."
- },
- "es-en": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible",
- "textBody": "Esta versión de %appName% no es compatible con SYNC."
- },
- "es-es": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "No compatible"
- },
- "es-mx": {
- "tts": "Esta versión de %appName% no es compatible con SYNC.",
- "line1": "no compatible",
- "textBody": "Esta versión de %appName% no es compatible con SYNC."
- },
- "fr-ca": {
- "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
- "line1": "incompatible",
- "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
- },
- "fr-fr": {
- "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
- "line1": "incompatible"
- },
- "it-it": {
- "tts": "Questa versione di %appName% non è supportata dal SYNC.",
- "line1": "non supportata"
- },
- "nl-nl": {
- "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
- "line1": "niet ondersteund"
- },
- "pl-pl": {
- "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
- "line1": "aplikacja nie obsług."
- },
- "pt-br": {
- "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
- "line1": "não suportado"
- },
- "pt-pt": {
- "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
- "line1": "não suportada"
- },
- "ru-ru": {
- "tts": "Эта версия %appName% не поддерживается SYNC.",
- "line1": "не поддерживается"
- },
- "sv-se": {
- "tts": "SYNC har inte stöd för den här versionen av %appName%.",
- "line1": "stöds ej"
- },
- "tr-tr": {
- "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
- "line1": "desteklenmiyor"
- },
- "zh-cn": {
- "tts": "SYNC不支持此版本的%appName%。",
- "line1": "不受支持"
- },
- "zh-tw": {
- "tts": "SYNC 不支援此版本的%appName% 。",
- "line1": "不支援"
- }
- }
- },
- "DataConsent": {
- "languages": {
- "en-gb": {
- "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. \r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
- },
- "en-us": {
- "line1": "Enable Mobile Apps",
- "line2": "on SYNC? (Uses Data)",
- "textBody": "Would you like to enable Mobile Apps on SYNC?\r\n\r\nIf you enable the use of mobile apps from your mobile device on SYNC, you agree that SYNC can periodically use your device’s data plan to send and receive data that keeps your settings current and enables app functionality. Data sent to Ford U.S. includes your VIN and SYNC module number. Standard rates may apply.\r\n\r\nTo change settings or turn off later, visit the SYNC mobile apps settings menu. See Owner Guide for more information. I agree and consent."
- },
- "es-mx": {
- "textBody": "Si permite el uso de apps de su móvil vía SYNC®, acepta que SYNC® puede utilizar el plan de datos de su equipo para enviar y recibir info para actualizar su configuración y permitir la funcionalidad de la app. Datos enviados a Ford US incluyen VIN y # de módulo de SYNC®. Cargos a su plan de datos pueden aplicar. \r\n\r\nPara cambiar la config. de SYNC® o apagarlo, acceda a Menú de configuración de apps. Vea la Guía del Propietario para más info. Estoy de acuerdo y acepto lo anterior."
- },
- "fr-ca": {
- "textBody": "Si vous activez les applications mobiles sur SYNC, vous acceptez que SYNC utilise votre forfait de données afin de maintenir vos réglages à jour et assurer la pleine fonctionnalité. Parmi les données envoyées à Ford US, notons le NIV et le numéro de module SYNC. Des frais de base peuvent s’appliquer. \r\n\r\nPour modifier les réglages ou désactiver les applications, consultez le menu des réglages des applications de SYNC. Voir le Manuel du propriétaire. J’accepte et je consens."
- }
- }
- },
- "DataConsentHelp": {
- "languages": {
- "en-us": {
- "textBody": "By enabling mobile apps, you consent to allowing SYNC to communicate with Ford at least once per month using your mobile device’s data plan. Disabling will stop all data usage, but you will not be able to use mobile apps on SYNC. See your Owner Guide for more information."
- },
- "es-mx": {
- "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
- },
- "fr-ca": {
- "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
- }
- }
- },
- "DisableApps": {
- "languages": {
- "de-de": {
- "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
- "line1": "Auto-Update",
- "line2": "und Mobile Apps deaktivieren"
- },
- "en-au": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?"
- },
- "en-gb": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?",
- "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
- },
- "en-ie": {
- "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
- "line1": "Disable auto-updates",
- "line2": "and Mobile Apps?"
- },
- "en-us": {
- "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
- "line1": "Disable Auto-Updates",
- "line2": "and Mobile Apps?",
- "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
- },
- "es-en": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?",
- "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
- "es-es": {
- "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
- "line1": "¿Desact. actual. auto",
- "line2": "y apl. móviles?"
- },
- "es-mx": {
- "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
- "line1": "¿Deshab. actualiz.",
- "line2": "autom. y aplic. móv.?",
- "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
- },
- "fr-ca": {
- "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
- "line1": "Désactiver màj autom.",
- "line2": "et app. mobiles?",
- "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
- },
- "fr-fr": {
- "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
- "line1": "Désactiver màj autom.",
- "line2": "et app. mobiles?"
- },
- "it-it": {
- "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
- "line1": "Disabilitare agg. aut.",
- "line2": "e app mobili?"
- },
- "nl-nl": {
- "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
- "line1": "Auto-updates en mob.",
- "line2": "apps uitschakelen?"
- },
- "pl-pl": {
- "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
- "line1": "Wył. automat. aktual.",
- "line2": "i aplikacje mobilne?"
- },
- "pt-br": {
- "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
- "line1": "Desativar atualizações",
- "line2": "autom. e aplicativos?"
- },
- "pt-pt": {
- "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
- "line1": "Desact. actual. autom.",
- "line2": "e aplicações móveis?"
- },
- "ru-ru": {
- "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
- "line1": "Откл. автообновления",
- "line2": "и мобил. прилож.?"
- },
- "sv-se": {
- "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
- "line1": "Avaktiverar autouppdat.",
- "line2": "och mobilappar?"
- },
- "tr-tr": {
- "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
- "line1": "Oto. güncelleme ve",
- "line2": "mobil uygul. kapat?"
- },
- "zh-cn": {
- "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
- "line1": "是否禁用自动更新和",
- "line2": "移动应用程序?"
- },
- "zh-tw": {
- "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
- "line1": "停用自動更新",
- "line2": "和行動應用程式?"
- }
- }
- },
- "DrivingCharacteristics": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
- "label": "Fahreigenschaften"
- },
- "en-au": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics"
- },
- "en-gb": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics",
- "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
- },
- "en-ie": {
- "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
- "label": "Driving characteristics"
- },
- "en-us": {
- "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM.",
- "label": "Driving Characteristics",
- "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status, Gear Position, RPM."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
- "label": "Características del manejo",
- "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
- "label": "Características de conducción"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad, RPM del motor, y Posición del cambio.",
- "label": "Características del manejo",
- "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad, RPM del motor, y Posición del cambio."
- },
- "fr-ca": {
- "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité, régime du moteur, et Position d’embrayage.",
- "label": "Caractéristiques de conduite",
- "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité, régime du moteur, et Position d’embrayage."
- },
- "fr-fr": {
- "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
- "label": "Caractéristiques de conduite"
- },
- "it-it": {
- "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
- "label": "Caratteristiche di guida"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
- "label": "Rijkenmerken"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
- "label": "Informacje dotyczące stylu jazdy"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
- "label": "Características de condução",
- "line1": "Caract. Condução"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
- "label": "Características de condução"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
- "label": "Характеристики движения"
- },
- "sv-se": {
- "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
- "label": "Köregenskaper"
- },
- "tr-tr": {
- "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
- "label": "Sürüş karakteristikleri"
- },
- "zh-cn": {
- "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
- "label": "行驶特性"
- },
- "zh-tw": {
- "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
- "label": "駕駛特性"
- }
- }
- },
- "Location": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
- "label": "GPS und Geschwindigkeit"
- },
- "en-au": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed"
- },
- "en-gb": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed",
- "textBody": "An app can access vehicle GPS and speed."
- },
- "en-ie": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and speed"
- },
- "en-us": {
- "tts": "An app can access vehicle GPS and speed.",
- "label": "GPS and Speed",
- "textBody": "An app can access vehicle GPS and speed."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad",
- "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
- "label": "GPS y velocidad"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
- "label": "GPS y velocidad",
- "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
- },
- "fr-ca": {
- "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
- "label": "GPS et Vitesse",
- "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
- },
- "fr-fr": {
- "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
- "label": "GPS et vitesse"
- },
- "it-it": {
- "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
- "label": "GPS e velocità"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
- "label": "Gps en snelheid"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
- "label": "GPS i prędkość"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
- "label": "GPS e velocidade"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
- "label": "GPS e velocidade"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
- "label": "GPS и скорость"
- },
- "sv-se": {
- "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
- "label": "GPS och hastighet"
- },
- "tr-tr": {
- "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
- "label": "GPS ve hız"
- },
- "zh-cn": {
- "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
- "label": "GPS 和车速"
- },
- "zh-tw": {
- "tts": "應用程式可存取車輛的GPS和速度。",
- "label": "GPS和車速"
- }
- }
- },
- "Notifications": {
- "languages": {
- "de-de": {
- "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
- "label": "Push-Benachrichtigungen"
- },
- "en-au": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications"
- },
- "en-gb": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications",
- "textBody": "An app can send notifications when running in the background."
- },
- "en-ie": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push notifications"
- },
- "en-us": {
- "tts": "An app can send notifications when running in the background.",
- "label": "Push Notifications",
- "textBody": "An app can send notifications when running in the background."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push",
- "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
- "es-es": {
- "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
- "label": "Notificaciones push"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
- "label": "Notificaciones tipo Push",
- "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
- },
- "fr-ca": {
- "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
- "label": "Notifications Instantanées",
- "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
- },
- "fr-fr": {
- "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
- "label": "Notifications push"
- },
- "it-it": {
- "tts": "Un'app può inviare notifiche se eseguita in background.",
- "label": "Notifiche push"
- },
- "nl-nl": {
- "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
- "label": "Push-meldingen"
- },
- "pl-pl": {
- "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
- "label": "Powiadomienia Push"
- },
- "pt-br": {
- "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
- "label": "Notificações Push",
- "line1": "Notificações"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
- "label": "Notificações push"
- },
- "ru-ru": {
- "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
- "label": "Оповещения о пересылке"
- },
- "sv-se": {
- "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
- "label": "Push-notiser"
- },
- "tr-tr": {
- "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
- "label": "Anlık bildirimleri"
- },
- "zh-cn": {
- "tts": "移动应用程序在后台运行时可推送通知。",
- "label": "推送通知"
- },
- "zh-tw": {
- "tts": "車輛行進時,應用程式可在背景中傳送通知。",
- "label": "傳送通知"
- }
- }
- },
- "SettingAppPermissions": {
- "languages": {
- "en-us": {
- "textBody": "Change %AppName%’s functionality and use of data as described below. See App terms of service and privacy policies."
- },
- "es-mx": {
- "textBody": "Para cambiar la funcionalidad de %appName% y usar los datos como se describe más adelante. Consulte los términos de servicio y políticas de privacidad de la App."
- },
- "fr-ca": {
- "textBody": "Pour modifier la fonctionnalité de %appName% et l’usage des données comme décrit ci-dessous. Reportez-vous aux modalités de service et à la politique de confidentialité de l’application."
- }
- }
- },
- "SettingDisableUpdates": {
- "languages": {
- "de-de": {
- "line1": "Updates deakt."
- },
- "en-au": {
- "line1": "Disable updates"
- },
- "en-gb": {
- "line1": "Disable updates"
- },
- "en-ie": {
- "line1": "Disable updates"
- },
- "en-us": {
- "line1": "Disable Updates",
- "textBody": "Disable Updates"
- },
- "es-en": {
- "line1": "Deshab. actual.",
- "textBody": "Deshab. actual."
- },
- "es-es": {
- "line1": "Desact. actual."
- },
- "es-mx": {
- "line1": "Deshab. actual.",
- "textBody": "Deshab. actual."
- },
- "fr-ca": {
- "line1": "Désactiver MAJ",
- "textBody": "Désactiver MAJ"
- },
- "fr-fr": {
- "line1": "Désactiver màj"
- },
- "it-it": {
- "line1": "Disabilita agg."
- },
- "nl-nl": {
- "line1": "Upd. uitschak."
- },
- "pl-pl": {
- "line1": "Wyłącz aktual."
- },
- "pt-br": {
- "line1": "Desat. atualiz."
- },
- "pt-pt": {
- "line1": "Desact. actualiz."
- },
- "ru-ru": {
- "line1": "Откл. обновл."
- },
- "sv-se": {
- "line1": "Inaktivera uppd."
- },
- "tr-tr": {
- "line1": "Güncell. Kapat"
- },
- "zh-cn": {
- "line1": "禁用更新"
- },
- "zh-tw": {
- "line1": "停用更新"
- }
- }
- },
- "SettingEnableUpdates": {
- "languages": {
- "de-de": {
- "line1": "Apps aktivieren"
- },
- "en-au": {
- "line1": "Enable Apps"
- },
- "en-gb": {
- "line1": "Enable Apps"
- },
- "en-ie": {
- "line1": "Enable Apps"
- },
- "en-us": {
- "line1": "Enable Apps"
- },
- "es-en": {
- "line1": "Hab. aplic."
- },
- "es-es": {
- "line1": "Activar apl."
- },
- "es-mx": {
- "line1": "Hab. aplic."
- },
- "fr-ca": {
- "line1": "Activer app.",
- "textBody": "Activer app."
- },
- "fr-fr": {
- "line1": "Activer app."
- },
- "it-it": {
- "line1": "Abilita app"
- },
- "nl-nl": {
- "line1": "Apps inschak."
- },
- "pl-pl": {
- "line1": "Włącz aplikacje"
- },
- "pt-br": {
- "line1": "Ativar aplic."
- },
- "pt-pt": {
- "line1": "Activar actualiz."
- },
- "ru-ru": {
- "line1": "Вкл. прилож."
- },
- "sv-se": {
- "line1": "Aktivera appar"
- },
- "tr-tr": {
- "line1": "Uygulamaları aç"
- },
- "zh-cn": {
- "line1": "启用应用程序"
- },
- "zh-tw": {
- "line1": "啟用應用程式"
- }
- }
- },
- "SettingUpdateAuto": {
- "languages": {
- "de-de": {
- "line1": "Update anford."
- },
- "en-au": {
- "line1": "Request update"
- },
- "en-gb": {
- "line1": "Request update"
- },
- "en-ie": {
- "line1": "Request update"
- },
- "en-us": {
- "line1": "Request Update",
- "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
- },
- "es-en": {
- "line1": "Solicit. actualiz.",
- "textBody": "Solicit. actualiz."
- },
- "es-es": {
- "line1": "Solicitar actual."
- },
- "es-mx": {
- "line1": "Solicit. actualiz.",
- "textBody": "Solicit. actualiz."
- },
- "fr-ca": {
- "line1": "Demander MAJ",
- "textBody": "Demander MAJ"
- },
- "fr-fr": {
- "line1": "Demander màj"
- },
- "it-it": {
- "line1": "Rich. aggiorn."
- },
- "nl-nl": {
- "line1": "Upd. aanvragen"
- },
- "pl-pl": {
- "line1": "Zażądaj aktual."
- },
- "pt-br": {
- "line1": "Solicitar atualiz."
- },
- "pt-pt": {
- "line1": "Solicit. actualiz."
- },
- "ru-ru": {
- "line1": "Запрос на обн."
- },
- "sv-se": {
- "line1": "Begär uppdat."
- },
- "tr-tr": {
- "line1": "Güncelleme iste"
- },
- "zh-cn": {
- "line1": "请求更新"
- },
- "zh-tw": {
- "line1": "請求更新"
- }
- }
- },
- "StatusNeeded": {
- "languages": {
- "de-de": {
- "line1": "Update benötigt"
- },
- "en-au": {
- "line1": "Update needed"
- },
- "en-gb": {
- "line1": "Update needed",
- "textBody": "Update needed"
- },
- "en-ie": {
- "line1": "Update needed"
- },
- "en-us": {
- "line1": "Update Needed",
- "textBody": "Update Needed"
- },
- "es-en": {
- "line1": "Actualiz. neces.",
- "textBody": "Actualiz. neces."
- },
- "es-es": {
- "line1": "Actu. necesaria"
- },
- "es-mx": {
- "line1": "Actualiz. neces.",
- "textBody": "Actualiz. neces."
- },
- "fr-ca": {
- "line1": "Màj requise",
- "textBody": "Màj requise"
- },
- "fr-fr": {
- "line1": "Mise à jour requise"
- },
- "it-it": {
- "line1": "Necess. aggiorn."
- },
- "nl-nl": {
- "line1": "Update nodig"
- },
- "pl-pl": {
- "line1": "Potrzeba aktual."
- },
- "pt-br": {
- "line1": "Atualiz. necess."
- },
- "pt-pt": {
- "line1": "Actual. necess."
- },
- "ru-ru": {
- "line1": "Необх. обновл."
- },
- "sv-se": {
- "line1": "Uppdat. krävs"
- },
- "tr-tr": {
- "line1": "Güncellenmeli"
- },
- "zh-cn": {
- "line1": "需要进行更新"
- },
- "zh-tw": {
- "line1": "需更新"
- }
- }
- },
- "StatusPending": {
- "languages": {
- "de-de": {
- "line1": "Aktualisieren..."
- },
- "en-au": {
- "line1": "Updating..."
- },
- "en-gb": {
- "line1": "Updating...",
- "textBody": "Updating..."
- },
- "en-ie": {
- "line1": "Updating..."
- },
- "en-us": {
- "line1": "Updating...",
- "textBody": "Updating..."
- },
- "es-en": {
- "line1": "Actualizando...",
- "textBody": "Actualizando..."
- },
- "es-es": {
- "line1": "Actualizando..."
- },
- "es-mx": {
- "line1": "Actualizando...",
- "textBody": "Actualizando..."
- },
- "fr-ca": {
- "line1": "MAJ en cours...",
- "textBody": "MAJ en cours..."
- },
- "fr-fr": {
- "line1": "Màj en cours..."
- },
- "it-it": {
- "line1": "Aggiornamento"
- },
- "nl-nl": {
- "line1": "Updaten..."
- },
- "pl-pl": {
- "line1": "Aktualizowanie"
- },
- "pt-br": {
- "line1": "Atualizando..."
- },
- "pt-pt": {
- "line1": "A actualizar..."
- },
- "ru-ru": {
- "line1": "Обновление..."
- },
- "sv-se": {
- "line1": "Uppdaterar..."
- },
- "tr-tr": {
- "line1": "Güncelleniyor..."
- },
- "zh-cn": {
- "line1": "正在更新......"
- },
- "zh-tw": {
- "line1": "更新中..."
- }
- }
- },
- "StatusUpToDate": {
- "languages": {
- "de-de": {
- "line1": "Aktuelle Version"
- },
- "en-au": {
- "line1": "Up-to-date"
- },
- "en-gb": {
- "line1": "Up-to-date",
- "textBody": "Up-to-date"
- },
- "en-ie": {
- "line1": "Up-to-date"
- },
- "en-us": {
- "line1": "Up-To-Date",
- "textBody": "Up-To-Date"
- },
- "es-en": {
- "line1": "Actualizado",
- "textBody": "Actualizado"
- },
- "es-es": {
- "line1": "Actualizada"
- },
- "es-mx": {
- "line1": "Actualizado",
- "textBody": "Actualizado"
- },
- "fr-ca": {
- "line1": "Déjà à jour",
- "textBody": "Déjà à jour"
- },
- "fr-fr": {
- "line1": "Déjà à jour"
- },
- "it-it": {
- "line1": "più recente"
- },
- "nl-nl": {
- "line1": "Up-to-date"
- },
- "pl-pl": {
- "line1": "Aktualne"
- },
- "pt-br": {
- "line1": "Atualizado"
- },
- "pt-pt": {
- "line1": "Actualizado"
- },
- "ru-ru": {
- "line1": "Обновлено"
- },
- "sv-se": {
- "line1": "Uppdat. krävs ej"
- },
- "tr-tr": {
- "line1": "Güncel"
- },
- "zh-cn": {
- "line1": "最新更新"
- },
- "zh-tw": {
- "line1": "更新最新"
- }
- }
- },
- "VehicleInfo": {
- "languages": {
- "de-de": {
- "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
- "label": "Fahrzeuginformationen"
- },
- "en-au": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
- "label": "Vehicle information"
- },
- "en-gb": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
- "label": "Vehicle information",
- "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
- },
- "en-ie": {
- "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
- "label": "Vehicle information"
- },
- "en-us": {
- "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure.",
- "label": "Vehicle Information",
- "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Odometer, VIN, External Temperature, Tire Pressure."
- },
- "es-en": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
- "label": "Información del vehículo",
- "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
- },
- "es-es": {
- "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
- "label": "Información del vehículo"
- },
- "es-mx": {
- "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Presión de los neumáticos.",
- "label": "Información del Vehículo",
- "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Presión de los neumáticos."
- },
- "fr-ca": {
- "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Odomètre, NIV, Température extérieure, et Pression des pneus.",
- "label": "Renseignements du Véhicule",
- "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Odomètre, NIV, Température extérieure, et Pression des pneus."
- },
- "fr-fr": {
- "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
- "label": "Renseignements du véhicule"
- },
- "it-it": {
- "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
- "label": "Informazioni sul veicolo"
- },
- "nl-nl": {
- "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
- "label": "Voertuiginformatie"
- },
- "pl-pl": {
- "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
- "label": "Informacje o pojeździe"
- },
- "pt-br": {
- "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
- "label": "Informações sobre o veículo",
- "line1": "Inform. Veículo"
- },
- "pt-pt": {
- "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
- "label": "Informações do veículo"
- },
- "ru-ru": {
- "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
- "label": "Информация об автомобиле"
- },
- "sv-se": {
- "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
- "label": "Fordonsinformation"
- },
- "tr-tr": {
- "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
- "label": "Araç bilgisi"
- },
- "zh-cn": {
- "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
- "label": "车辆信息"
- },
- "zh-tw": {
- "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
- "label": "車輛資訊"
- }
- }
- }
- }
- },
- "app_policies": {
- "default": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": [
- "Base-4"
- ]
- },
- "device": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": [
- "DataConsent-2"
- ]
- },
- "pre_DataConsent": {
- "keep_context": false,
- "steal_focus": false,
- "priority": "NONE",
- "default_hmi": "NONE",
- "groups": [
- "BaseBeforeDataConsent"
- ]
- }
- }
- }
-}
+{
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [1,
+ 5,
+ 25,
+ 125,
+ 625],
+ "endpoints": {
+ "0x07": {
+ "default": ["http://policies.telematics.ford.com/api/policies"]
+ },
+ "0x04": {
+ "default": ["http://ivsu.software.ford.com/api/getsoftwareupdates"]
+ },
+ "queryAppsUrl": {
+ "default": ["http://sdl.shaid.server"]
+ },
+ "lock_screen_icon_url": {
+ "default": ["http://i.imgur.com/QwZ9uKG.png"]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "VOICECOM": 20,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED",
+ "BACKGROUND"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED",
+ "BACKGROUND"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL",
+ "LIMITED",
+ "BACKGROUND"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "PropriataryData-2": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "ProprietaryData-3": {
+ "rpcs": {
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Base-6": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnTBTClientState": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "OnKeyboardInputOnlyGroup": {
+ "rpcs": {
+ "OnKeyboardInput": {
+ "hmi_levels": ["FULL"]
+ }
+ }
+ },
+ "OnTouchEventOnlyGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": ["FULL"]
+ }
+ }
+ },
+ "DiagnosticMessageOnly": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ },
+ "SendLocation": {
+ "rpcs": {
+ "SendLocation": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "BackgroundAPT": {
+ "rpcs": {
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.021",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. \n\nSi presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. \r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\r\n\r\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. \n\nLas actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. \n\nPresione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements.\r\n\r\nVeuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "By enabling mobile apps, you consent to allowing SYNC to communicate with Ford at least once per month using your mobile device’s data plan. Disabling will stop all data usage, but you will not be able to use mobile apps on SYNC. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["Base-4"]
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["DataConsent-2"]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"]
+ }
+ }
+ }
+}
+
diff --git a/src/appMain/signal_handlers.cc b/src/appMain/signal_handlers.cc
index 51757358e8..9335d8bc72 100644
--- a/src/appMain/signal_handlers.cc
+++ b/src/appMain/signal_handlers.cc
@@ -35,7 +35,7 @@
#include "utils/logger.h"
namespace main_namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SmartDeviceLinkMainApp")
+CREATE_LOGGERPTR_GLOBAL(logger_, "SDLMain")
void dummy_signal_handler(int32_t signal) {
}
diff --git a/src/appMain/smartDeviceLink.ini b/src/appMain/smartDeviceLink.ini
index 7626b035e2..12d465c801 100644
--- a/src/appMain/smartDeviceLink.ini
+++ b/src/appMain/smartDeviceLink.ini
@@ -1,47 +1,63 @@
- ; The INI-file consists of different chapters.
+; The INI-file consists of different chapters.
; Each chapter begins with the line containing
; the name in square brackets. Syntax:
; [chapter]
; The chapters consists of a set of items with a
-; assinged value. The syntax is:
+; assigned value. The syntax is:
; item=value
; All white spaces an second encounters of chapters
; or items will be ignored.
; Remarks start with semicolon or star as first character.
-; It is alowed for names of chapters and items to
+; It is allowed for names of chapters and items to
; contain semicolon and star. Possible syntax is:
; [ chapter ] ;Remark
; item = value ;Remark
[HMI]
-LaunchHMI = true
-LinkToWebHMI = HMI/index.html
+; Open the $LinkToWebHMI in chromium browser
+LaunchHMI = false
+; Link to index HMTL page
+; correct format is without any quotes and with double forward slash (solidus) separator
+LinkToWebHMI = HMI//index.html
+; WebSocket connection address and port
ServerAddress = 127.0.0.1
ServerPort = 8087
+; Socket ports for video and audio streaming
VideoStreamingPort = 5050
AudioStreamingPort = 5080
[MAIN]
-SDLVersion =
+; SDL source version
+; represents as a git commit hash value
+SDLVersion = {GIT_COMMIT}
+; All logging event could be dropped by setting $LogsEnabled to false
LogsEnabled = true
; Contains .json/.ini files
+; Default value is SDL working directory
AppConfigFolder =
-; Contains output files, e.g. .wav
+; Contains SDL configuration files - .json/.ini
+; Default value is SDL working directory
AppStorageFolder = storage
; Contains resourses, e.g. audio8bit.wav
+; Default value is SDL working directory
AppResourceFolder =
; Standard min stack size
; in Ubuntu : PTHREAD_STACK_MIN = 16384
; in QNX : PTHREAD_STACK_MIN = 256
-;The value of a variable ThreadStackSize used only if its realy needed, other way stack size will be PTHREAD_STACK_MIN
-;
+; The value of a $ThreadStackSize used where its really needed,
+; other way stack size will be PTHREAD_STACK_MIN
ThreadStackSize = 20480
+; Defines if HMI support attenuated mode (able to mix audio sources)
MixingAudioSupported = true
+; In case HMI doesn’t send some capabilities to SDL, the values from the file are used by SDL
HMICapabilities = hmi_capabilities.json
+; Maximum cmdId of VR command which may be registered on SDL
+; Bigger value used for system VR commands processing by SDL
MaxCmdID = 2000000000
-; Default request timeout in milliseconds
+; SDL respond timeout (in milliseconds) in case of HMI has not respond on a mobile request
DefaultTimeout = 10000
-
+; Available disk space in bytes for each application file handling
+; Default value is 100 MiB
AppDirectoryQuota = 104857600
; Allowed requests amount in HMI level NONE during time scale.
; If value is 0 check will be skipped
@@ -53,12 +69,23 @@ AppTimeScaleMaxRequests = 1000
AppRequestsTimeScale = 10
; Allowed pending requests amount. If value is 0 check will be skipped
PendingRequestsAmount = 5000
-HeartBeatTimeout = 7
+PendingRequestsAmount = 0
+; Heart beat timeout used for protocol v3.
+; Timeout must be specified in milliseconds. If timeout is 0 heart beat will be disabled.
+HeartBeatTimeout = 7000
+; The list of diagnostic modes supported on a vehicle.
+; Only the stated values are allowed by SDL in terms of DiagnosticMessage RPC, others are rejected
SupportedDiagModes = 0x01, 0x02, 0x03, 0x05, 0x06, 0x07, 0x09, 0x0A, 0x18, 0x19, 0x22, 0x3E
+; The path to the system file directory for inter-operation between SDL and System (e.g. IVSU files and others).
+; If parameter is empty, SDL uses /tmp/fs/mp/images/ivsu_cache by default
SystemFilesPath = /tmp/fs/mp/images/ivsu_cache
+; To restore the last transport state (name, applications or channels) on SDL on a new device connection and on disconnect
UseLastState = true
+; Port to obtain the performance information about messages processing
TimeTestingPort = 8090
+; Limitation for a number of ReadDID requests (the 1st value) per (the 2nd value) seconds
ReadDIDRequest = 5, 1
+; Limitation for a number of GetVehicleData requests (the 1st value) per (the 2nd value) seconds
GetVehicleDataRequest = 5, 1
[MEDIA MANAGER]
@@ -71,35 +98,34 @@ AudioStreamConsumer = socket
;AudioStreamConsumer = file
;VideoStreamConsumer = pipe
;AudioStreamConsumer = pipe
-;Temp solution: if you change NamedPipePath also change path to pipe in src/components/qt_hmi/qml_model_qtXX/views/SDLNavi.qml
-;Named pipe path will be constructed using AppStorageFolder + name
+; Temp solution: if you change NamedPipePath also change path to pipe in src/components/qt_hmi/qml_model_qtXX/views/SDLNavi.qml
+; Named pipe path will be constructed using AppStorageFolder + name
NamedVideoPipePath = video_stream_pipe
NamedAudioPipePath = audio_stream_pipe
-;File path will be constructed using AppStorageFolder + name
+; File path will be constructed using AppStorageFolder + name
VideoStreamFile = video_stream_file
AudioStreamFile = audio_stream_file
; Recording file source (used for audio pass thru emulation only)
RecordingFileSource = audio.8bit.wav
; Recording file for audio pass thru
RecordingFileName = audio.wav
-; The timeout in seconds for mobile to stop streaming or end up sessions.
-StopStreamingTimeout = 1
-; The timeout in miliseconds to suspend audio data streaming if no data received from mobile
+; The timeout in milliseconds for mobile to stop streaming or end up sessions.
+StopStreamingTimeout = 1000
+; The timeout in milliseconds to suspend audio data streaming if no data received from mobile
AudioDataStoppedTimeout = 1000
-; The timeout in miliseconds to suspend video data streaming if no data received from mobile
+; The timeout in milliseconds to suspend video data streaming if no data received from mobile
VideoDataStoppedTimeout = 1000
-; HelpPromt and TimeOutPrompt is a vector of strings separated by comma
[GLOBAL PROPERTIES]
-
-; Delimiter, which will be appended to each TTS chunck, e.g. helpPrompt/timeoutPrompt
+; HelpPromt and TimeOutPrompt is a vector of strings separated by comma
+; Delimiter, which will be appended to each TTS chunk, e.g. helpPrompt/timeoutPrompt
TTSDelimiter = ,
; Default prompt items, separated by comma
HelpPromt = Please speak one of the following commands,Please say a command
; Default prompt items, separated by comma
TimeOutPromt = Please speak one of the following commands,Please say a command
HelpTitle = Available Vr Commands List
-; In case mobile app didn't send global properties default global properties will be sent after this timeout
+; In case mobile app didn't send global properties default global properties will be sent after this timeout in seconds
; max value TTSGlobalPropertiesTimeout 64K
TTSGlobalPropertiesTimeout = 20
@@ -112,6 +138,7 @@ DeleteFileRequest = 5
ListFilesRequest = 5
[VR COMMANDS]
+; TODO(EZamakhov): delete with APPLINK-15220
HelpCommand = Help
[AppInfo]
@@ -130,16 +157,17 @@ SSLMode = CLIENT
CipherList = ALL
; Verify Mobile app certificate (could be used in both SSLMode Server and Client)
VerifyPeer = false
-; If VerifyPeer is enable - terminate handshake if mobile app did not return a certificate
-FialOnNoCert = false
-; If VerifyPeer is enable - do not ask for a mobile app certificate again in case of a renegotiation
-VerifyClientOnce = false
-; Force protected services (could be id's from 0x01 to 0xFF)
+; Preloaded CA certificates directory
+CACertificatePath = .
+; Services which can not be started unprotected (could be id's from 0x01 to 0xFF)
;ForceProtectedService = 0x0A, 0x0B
ForceProtectedService = Non
-; Force unprotected services
+; Services which can not be started protected or delayed protected
;ForceUnprotectedService = 0x07
ForceUnprotectedService = Non
+; The PTU will be triggered in case expiration date of certificate
+; then certain hours amount
+UpdateBeforeHours = 24
[Policy]
EnablePolicy = true
@@ -151,18 +179,8 @@ AttemptsToOpenPolicyDB = 5
OpenAttemptTimeoutMs = 500
[TransportManager]
+; Listening port form incoming TCP mobile connection
TCPAdapterPort = 12345
-MMEDatabase = /dev/qdb/mediaservice_db
-EventMQ = /dev/mqueue/ToSDLCoreUSBAdapter
-AckMQ = /dev/mqueue/FromSDLCoreUSBAdapter
-
-[IAP]
-LegacyProtocol = com.ford.sync.prot[0-29]
-HubProtocol = com.smartdevicelink.prot0
-PoolProtocol = com.smartdevicelink.prot[1-29]
-IAPSystemConfig = /fs/mp/etc/mm/ipod.cfg
-IAP2SystemConfig = /fs/mp/etc/mm/iap2.cfg
-IAP2HubConnectAttempts = 3
[ProtocolHandler]
; Packet with payload bigger than next value will be marked as a malformed
@@ -183,11 +201,15 @@ MalformedMessageFiltering = true
; #MalformedFrequencyCount to Zero
MalformedFrequencyCount = 10
MalformedFrequencyTime = 1000
+; Timeout for waiting CONSECUTIVE frames of multiframe
+ExpectedConsecutiveFramesTimeout = 10000
[ApplicationManager]
-ApplicationListUpdateTimeout = 2
-; Max allowed threads for handling mobile requests. Currently max allowed is 2
+; Application list update timeout ms
+ApplicationListUpdateTimeout = 2000
+; Max allowed threads for handling mobile requests. Default value is 2
ThreadPoolSize = 1
+; The max size of hash which is used by OnHashUpdated
HashStringSize = 32
[SDL4]
@@ -201,16 +223,18 @@ AppIconsFolderMaxSize = 104857600
AppIconsAmountToRemove = 1
[Resumption]
-
-# Timeout in seconds for resumption Application HMILevel
-# and resolving conflicts in case if multiple applications initiate resumption
-ApplicationResumingTimeout = 3
-
-# Timeout in seconds for pereodical saving resumption persisten data
-AppSavePersistentDataTimeout = 10 #seconds
-
-# Timeout in seconds to store hmi_level for media app before ign_off
+; Timeout in milliseconds for resumption Application HMILevel
+; and resolving conflicts in case if multiple applications initiate resumption
+ApplicationResumingTimeout = 3000
+; Timeout in milliseconds for periodical saving resumption persistent data
+AppSavePersistentDataTimeout = 10000
+; Timeout in seconds to store hmi_level for media app before ign_off
ResumptionDelayBeforeIgn = 30;
-
-# Timeout in seconds to restore hmi_level for media app after sdl run
+; Timeout in seconds to restore hmi_level for media app after sdl run
ResumptionDelayAfterIgn = 30;
+; Resumption ctrl uses JSON if UseDBForResumption=false for store data otherwise uses DB
+UseDBForResumption = false
+; Number of attempts to open resumption DB
+AttemptsToOpenResumptionDB = 5
+; Timeout between attempts during opening DB in milliseconds
+OpenAttemptTimeoutMsResumptionDB = 500
diff --git a/src/components/CMakeLists.txt b/src/components/CMakeLists.txt
index b6b61d6bd2..d31141b36c 100644
--- a/src/components/CMakeLists.txt
+++ b/src/components/CMakeLists.txt
@@ -80,8 +80,8 @@ add_subdirectory(./config_profile)
# --- AudioManager
add_subdirectory(./media_manager)
-if (TIME_TESTER)
- add_subdirectory(./time_tester)
+if (TELEMETRY_MONITOR)
+ add_subdirectory(./telemetry_monitor)
endif()
diff --git a/src/components/HMI/app/controller/PhoneController.js b/src/components/HMI/app/controller/PhoneController.js
index dd722df80d..c29cae064d 100644
--- a/src/components/HMI/app/controller/PhoneController.js
+++ b/src/components/HMI/app/controller/PhoneController.js
@@ -33,24 +33,50 @@
SDL.PhoneController = Em.Object.create( {
- /** Model binding */
+ /**
+ * Model binding
+ */
modelBinding: "SDL.PhoneModel",
- /** Dialpad delete key press handeler */
+ /**
+ * Dialpad delete key press handeler
+ */
onDelete: function() {
this.model.deleteDialpadNumber();
},
- /** Dial call handeler */
+ /**
+ * Dial call handeler
+ */
onEndCall: function() {
+ FFW.BasicCommunication.OnPhoneCall(false);
this.model.endCall();
},
- /** Dial call handeler */
+ /**
+ * Dial call handeler
+ */
onDialCall: function() {
+ FFW.BasicCommunication.OnPhoneCall(true);
this.model.dialCall();
+ },
+
+ /**
+ * Dialpad key press handler
+ */
+ keyPress: function(element) {
+ this.model.setDialpadNumber(element.text)
+ },
+
+ /**
+ *
+ */
+ incomingCall: function(request) {
+
+ this.model.setDialpadNumber(request.params.number);
+ this.onDialCall();
}
}); \ No newline at end of file
diff --git a/src/components/HMI/app/controller/sdl/RPCController.js b/src/components/HMI/app/controller/sdl/RPCController.js
index 27dd2ec087..44cbd6978e 100644
--- a/src/components/HMI/app/controller/sdl/RPCController.js
+++ b/src/components/HMI/app/controller/sdl/RPCController.js
@@ -114,6 +114,71 @@ SDL.RPCController = Em.Object
},
/**
+ * Validate method for request DialNumber
+ *
+ * @param {Object}
+ * params
+ */
+ DialNumber: function(params) {
+
+ if (params == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'params' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (params.number == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'number' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (typeof params.number != 'string') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'number'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (params.appID == null) {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Parameter 'appID' does not exists!"
+ };
+
+ return this.resultStruct;
+ }
+
+ if (typeof params.appID != 'number') {
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["INVALID_DATA"],
+ "resultMessage": "Wrong type of parameter 'appID'!"
+ };
+
+ return this.resultStruct;
+ }
+
+ this.resultStruct = {
+ "resultCode": SDL.SDLModel.resultCode["SUCCESS"]
+ };
+
+ return this.resultStruct;
+ },
+
+ /**
* Validate method for request UpdateDeviceList
*
* @param {Object}
diff --git a/src/components/HMI/app/view/phone/dialpadView.js b/src/components/HMI/app/view/phone/dialpadView.js
index 0290750d0a..06b535bda4 100644
--- a/src/components/HMI/app/view/phone/dialpadView.js
+++ b/src/components/HMI/app/view/phone/dialpadView.js
@@ -79,7 +79,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'left',
- text: '1'
+ text: '1',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key2: SDL.Button.extend( {
@@ -87,7 +91,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'center',
- text: '2'
+ text: '2',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key3: SDL.Button.extend( {
@@ -95,8 +103,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'right',
- text: '3'
+ text: '3',
+
+ action: "keyPress",
+ target: "SDL.PhoneController"
} ),
key4: SDL.Button.extend( {
@@ -104,7 +115,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'left',
- text: '4'
+ text: '4',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key5: SDL.Button.extend( {
@@ -112,7 +127,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'center',
- text: '5'
+ text: '5',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key6: SDL.Button.extend( {
@@ -120,7 +139,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'right',
- text: '6'
+ text: '6',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key7: SDL.Button.extend( {
@@ -128,7 +151,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'left',
- text: '7'
+ text: '7',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key8: SDL.Button.extend( {
@@ -136,7 +163,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'center',
- text: '8'
+ text: '8',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key9: SDL.Button.extend( {
@@ -144,7 +175,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'right',
- text: '9'
+ text: '9',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
key0: SDL.Button.extend( {
@@ -152,7 +187,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'center',
- text: '0'
+ text: '0',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
keyStar: SDL.Button.extend( {
@@ -160,7 +199,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'left',
- text: '*'
+ text: '*',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} ),
keyDiez: SDL.Button.extend( {
@@ -168,7 +211,11 @@ SDL.DialpadPhoneView = Em.ContainerView.create( {
classNames: 'right',
- text: '#'
+ text: '#',
+
+ action: "keyPress",
+
+ target: "SDL.PhoneController"
} )
} ),
diff --git a/src/components/HMI/ffw/BasicCommunicationRPC.js b/src/components/HMI/ffw/BasicCommunicationRPC.js
index ed33daef17..6ef3fc60fc 100644
--- a/src/components/HMI/ffw/BasicCommunicationRPC.js
+++ b/src/components/HMI/ffw/BasicCommunicationRPC.js
@@ -485,6 +485,32 @@ FFW.BasicCommunication = FFW.RPCObserver
request.id,
request.method);
}
+ if (request.method == "BasicCommunication.DialNumber") {
+
+ SDL.PopUp.create().appendTo('body').popupActivate(
+ "Would you like to dial " + request.params.number + " ?",
+ function (result) {
+ if (result) {
+
+ FFW.BasicCommunication.sendBCResult(SDL.SDLModel.resultCode["SUCCESS"],
+ request.id,
+ request.method);
+
+ SDL.SDLModel.onDeactivateApp('call', request.params.appID);
+ SDL.States.goToStates('phone.dialpad');
+ SDL.PhoneController.incomingCall(request);
+ } else {
+
+
+ FFW.BasicCommunication.sendError(SDL.SDLModel.resultCode["REJECTED"],
+ request.id,
+ request.method,
+ "No paired device!"
+ );
+ }
+ },
+ false);
+ }
if (request.method == "BasicCommunication.ActivateApp") {
if (!request.params.level || request.params.level == "FULL") {
diff --git a/src/components/application_manager/CMakeLists.txt b/src/components/application_manager/CMakeLists.txt
index bef3cdd8fe..fe1ad0afc2 100644
--- a/src/components/application_manager/CMakeLists.txt
+++ b/src/components/application_manager/CMakeLists.txt
@@ -33,9 +33,9 @@ set (AM_SOURCE_DIR ${COMPONENTS_DIR}/application_manager)
set (AM_TEST_DIR ${AM_SOURCE_DIR}/test)
set (AM_MOCK_DIR ${AM_TEST_DIR}/mock)
-
include_directories (
include/
+ ${COMPONENTS_DIR}
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/formatters/include/
${COMPONENTS_DIR}/protocol_handler/include/
@@ -51,6 +51,7 @@ include_directories (
${CMAKE_BINARY_DIR}/src/components/
${COMPONENTS_DIR}/include/
${COMPONENTS_DIR}/policy/src/policy/include/
+ ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct/
${COMPONENTS_DIR}/policy/src/policy/usage_statistics/include/
${JSONCPP_INCLUDE_DIRECTORY}
${ENCRYPTION_INCLUDE_DIRECTORY}
@@ -58,10 +59,26 @@ include_directories (
${LOG4CXX_INCLUDE_DIRECTORY}
)
+if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
+ include_directories(
+ ${COMPONENTS_DIR}/utils/include/utils/sqlite_wrapper/
+ )
+endif ()
+
+if (${CMAKE_SYSTEM_NAME} MATCHES "QNX")
+ include_directories(
+ ${COMPONENTS_DIR}/utils/include/utils/qdb_wrapper/
+ )
+endif()
+
file (GLOB SOURCES
${AM_SOURCE_DIR}/src/*
)
+set (MESSAGE_HELPER_SOURCES
+ ${AM_SOURCE_DIR}/src/message_helper/message_helper.cc
+)
+
set (POLICIES_MANAGER
${AM_SOURCE_DIR}/src/policies/policy_handler.cc
${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc
@@ -72,11 +89,14 @@ ${AM_SOURCE_DIR}/src/policies/delegates/statistics_delegate.cc
include_directories(
${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct
)
-
file (GLOB EVENT_ENGINE
${AM_SOURCE_DIR}/src/event_engine/*
)
+file (GLOB RESUMPTION
+ ${AM_SOURCE_DIR}/src/resumption/*
+)
+
file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/*
${AM_SOURCE_DIR}/src/commands/mobile/*
@@ -122,7 +142,6 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/on_exit_all_applications_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_exit_application_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_start_device_discovery.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_emergency_event_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/close_popup_request.cc
${AM_SOURCE_DIR}/src/commands/hmi/close_popup_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_app_activated_notification.cc
@@ -232,7 +251,6 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/on_ignition_cycle_over_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_system_info_changed_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_file_removed_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_play_tone_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_tts_started_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_tts_stopped_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_vr_started_notification.cc
@@ -278,7 +296,9 @@ file (GLOB MOBILE_COMMANDS_SOURCES
${AM_SOURCE_DIR}/src/commands/hmi/get_urls_response.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_device_state_changed_notification.cc
${AM_SOURCE_DIR}/src/commands/hmi/on_tts_reset_timeout_notification.cc
- ${AM_SOURCE_DIR}/src/commands/hmi/on_phone_call_notification.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/dial_number_request.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/dial_number_response.cc
+ ${AM_SOURCE_DIR}/src/commands/hmi/on_event_changed_notification.cc
)
set (HMI_COMMANDS_SOURCES_JSON
@@ -331,8 +351,13 @@ SET (LIBRARIES
UsageStatistics
dl
formatters
+ dbms
)
+if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ list(APPEND LIBRARIES sqlite3)
+endif ()
+
IF(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
list(REMOVE_ITEM LIBRARIES dl)
endif()
@@ -340,16 +365,19 @@ endif()
add_library("AMEventEngine" ${EVENT_ENGINE})
target_link_libraries("AMEventEngine" ${LIBRARIES})
+
add_library("AMPolicyLibrary" ${POLICIES_MANAGER} )
target_link_libraries("AMPolicyLibrary" ${LIBRARIES} AMEventEngine)
add_library("AMHMICommandsLibrary" ${HMI_COMMANDS_SOURCES})
target_link_libraries("AMHMICommandsLibrary" ${LIBRARIES} AMEventEngine)
+add_library("MessageHelper" ${MESSAGE_HELPER_SOURCES})
+
add_library("AMMobileCommandsLibrary" ${MOBILE_COMMANDS_SOURCES} )
target_link_libraries("AMMobileCommandsLibrary" ${LIBRARIES} AMEventEngine)
-add_library("ApplicationManager" ${SOURCES})
+add_library("ApplicationManager" ${SOURCES} ${RESUMPTION})
target_link_libraries("ApplicationManager" ${LIBRARIES} AMHMICommandsLibrary
AMMobileCommandsLibrary
AMEventEngine
@@ -361,4 +389,5 @@ endif()
if(BUILD_TESTS)
add_subdirectory(test)
+ add_subdirectory(test/message_helper)
endif()
diff --git a/src/components/application_manager/include/application_manager/application.h b/src/components/application_manager/include/application_manager/application.h
index 1197bbb813..ee4b12a367 100644
--- a/src/components/application_manager/include/application_manager/application.h
+++ b/src/components/application_manager/include/application_manager/application.h
@@ -43,6 +43,7 @@
#include "connection_handler/device.h"
#include "application_manager/message.h"
#include "application_manager/hmi_state.h"
+#include "application_manager/application_state.h"
#include "protocol_handler/protocol_handler.h"
namespace NsSmartDeviceLink {
@@ -57,6 +58,9 @@ namespace application_manager {
namespace mobile_api = mobile_apis;
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+
+namespace custom_str = utils::custom_string;
+
typedef int32_t ErrorCode;
class UsageStatistics;
@@ -70,33 +74,28 @@ enum APIVersion {
kAPIV4 = 4
};
-enum TLimitSource {
- POLICY_TABLE = 0,
- CONFIG_FILE
-};
-
+enum TLimitSource { POLICY_TABLE = 0, CONFIG_FILE };
struct Version {
APIVersion min_supported_api_version;
APIVersion max_supported_api_version;
Version()
- : min_supported_api_version(APIVersion::kUnknownAPI),
- max_supported_api_version(APIVersion::kUnknownAPI) {
- }
+ : min_supported_api_version(APIVersion::kUnknownAPI)
+ , max_supported_api_version(APIVersion::kUnknownAPI) {}
};
struct AppFile {
- // need to use in std::map;
- AppFile() {
- }
- AppFile(const std::string& name, bool persistent, bool download_complete,
+ // need to use in std::map;
+ AppFile() {}
+ AppFile(const std::string& name,
+ bool persistent,
+ bool download_complete,
mobile_apis::FileType::eType type)
- : file_name(name),
- is_persistent(persistent),
- is_download_complete(download_complete),
- file_type(type){
- }
+ : file_name(name)
+ , is_persistent(persistent)
+ , is_download_complete(download_complete)
+ , file_type(type) {}
std::string file_name;
bool is_persistent;
bool is_download_complete;
@@ -104,26 +103,26 @@ struct AppFile {
};
typedef std::map<std::string, AppFile> AppFilesMap;
class InitialApplicationData {
- public:
- virtual ~InitialApplicationData() {
- }
-
- virtual const smart_objects::SmartObject* app_types() const = 0;
- virtual const smart_objects::SmartObject* vr_synonyms() const = 0;
- virtual std::string mobile_app_id() const = 0;
- virtual const smart_objects::SmartObject* tts_name() const = 0;
- virtual const smart_objects::SmartObject* ngn_media_screen_name() const = 0;
- virtual const mobile_api::Language::eType& language() const = 0;
- virtual const mobile_api::Language::eType& ui_language() const = 0;
- virtual void set_app_types(const smart_objects::SmartObject& app_types) = 0;
- virtual void set_vr_synonyms(
+ public:
+ virtual ~InitialApplicationData() {}
+
+ virtual const smart_objects::SmartObject* app_types() const = 0;
+ virtual const smart_objects::SmartObject* vr_synonyms() const = 0;
+ virtual const std::string& mac_address() const = 0;
+ virtual std::string mobile_app_id() const = 0;
+ virtual const smart_objects::SmartObject* tts_name() const = 0;
+ virtual const smart_objects::SmartObject* ngn_media_screen_name() const = 0;
+ virtual const mobile_api::Language::eType& language() const = 0;
+ virtual const mobile_api::Language::eType& ui_language() const = 0;
+ virtual void set_app_types(const smart_objects::SmartObject& app_types) = 0;
+ virtual void set_vr_synonyms(
const smart_objects::SmartObject& vr_synonyms) = 0;
- virtual void set_mobile_app_id(const std::string& mobile_app_id) = 0;
- virtual void set_tts_name(const smart_objects::SmartObject& tts_name) = 0;
- virtual void set_ngn_media_screen_name(
+ virtual void set_mobile_app_id(const std::string& mobile_app_id) = 0;
+ virtual void set_tts_name(const smart_objects::SmartObject& tts_name) = 0;
+ virtual void set_ngn_media_screen_name(
const smart_objects::SmartObject& ngn_name) = 0;
- virtual void set_language(const mobile_api::Language::eType& language) = 0;
- virtual void set_ui_language(
+ virtual void set_language(const mobile_api::Language::eType& language) = 0;
+ virtual void set_ui_language(
const mobile_api::Language::eType& ui_language) = 0;
};
@@ -161,554 +160,622 @@ typedef std::map<uint32_t, PerformChoice> PerformChoiceSetMap;
*/
typedef std::set<uint32_t> SoftButtonID;
+/**
+ * @brief Defines set of vehicle info types
+ */
+typedef std::set<uint32_t> VehicleInfoSubscriptions;
+
+/**
+ * @brief Defines set of buttons subscription
+ */
+typedef std::set<mobile_apis::ButtonName::eType> ButtonSubscriptions;
+
class DynamicApplicationData {
- public:
- virtual ~DynamicApplicationData() {
- }
- virtual const smart_objects::SmartObject* help_prompt() const = 0;
- virtual const smart_objects::SmartObject* timeout_prompt() const = 0;
- virtual const smart_objects::SmartObject* vr_help_title() const = 0;
- virtual const smart_objects::SmartObject* vr_help() const = 0;
- virtual const mobile_api::TBTState::eType& tbt_state() const = 0;
- virtual const smart_objects::SmartObject* show_command() const = 0;
- virtual const smart_objects::SmartObject* tbt_show_command() const = 0;
- virtual const std::set<mobile_apis::ButtonName::eType>& SubscribedButtons() const = 0;
- virtual const std::set<uint32_t>& SubscribesIVI() const = 0;
- virtual const smart_objects::SmartObject* keyboard_props() const = 0;
- virtual const smart_objects::SmartObject* menu_title() const = 0;
- virtual const smart_objects::SmartObject* menu_icon() const = 0;
-
- virtual void load_global_properties(const smart_objects::SmartObject& so) = 0;
- virtual void set_help_prompt(
+ public:
+ virtual ~DynamicApplicationData() {}
+ virtual const smart_objects::SmartObject* help_prompt() const = 0;
+ virtual const smart_objects::SmartObject* timeout_prompt() const = 0;
+ virtual const smart_objects::SmartObject* vr_help_title() const = 0;
+ virtual const smart_objects::SmartObject* vr_help() const = 0;
+ virtual const mobile_api::TBTState::eType& tbt_state() const = 0;
+ virtual const smart_objects::SmartObject* show_command() const = 0;
+ virtual const smart_objects::SmartObject* tbt_show_command() const = 0;
+ virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const = 0;
+ virtual DataAccessor<VehicleInfoSubscriptions> SubscribedIVI() const = 0;
+ virtual const smart_objects::SmartObject* keyboard_props() const = 0;
+ virtual const smart_objects::SmartObject* menu_title() const = 0;
+ virtual const smart_objects::SmartObject* menu_icon() const = 0;
+
+ virtual void load_global_properties(const smart_objects::SmartObject& so) = 0;
+ virtual void set_help_prompt(
const smart_objects::SmartObject& help_prompt) = 0;
- virtual void set_timeout_prompt(
+ virtual void set_timeout_prompt(
const smart_objects::SmartObject& timeout_prompt) = 0;
- virtual void set_vr_help_title(
+ virtual void set_vr_help_title(
const smart_objects::SmartObject& vr_help_title) = 0;
- virtual void reset_vr_help_title() = 0;
- virtual void set_vr_help(const smart_objects::SmartObject& vr_help) = 0;
- virtual void reset_vr_help() = 0;
- virtual void set_tbt_state(const mobile_api::TBTState::eType& tbt_state) = 0;
- virtual void set_show_command(
+ virtual void reset_vr_help_title() = 0;
+ virtual void set_vr_help(const smart_objects::SmartObject& vr_help) = 0;
+ virtual void reset_vr_help() = 0;
+ virtual void set_tbt_state(const mobile_api::TBTState::eType& tbt_state) = 0;
+ virtual void set_show_command(
const smart_objects::SmartObject& show_command) = 0;
- virtual void set_tbt_show_command(
+ virtual void set_tbt_show_command(
const smart_objects::SmartObject& tbt_show) = 0;
- virtual void set_keyboard_props(
- const smart_objects::SmartObject& keyboard_props) = 0;
- virtual void set_menu_title(
- const smart_objects::SmartObject& menu_title) = 0;
- virtual void set_menu_icon(
- const smart_objects::SmartObject& menu_icon) = 0;
-
- virtual uint32_t audio_stream_retry_number() const = 0;
-
- virtual void set_audio_stream_retry_number(
- const uint32_t& audio_stream_retry_number) = 0;
-
- virtual uint32_t video_stream_retry_number() const = 0;
-
- virtual void set_video_stream_retry_number(
- const uint32_t& video_stream_retry_number) = 0;
-
- /*
- * @brief Adds a command to the in application menu
- */
- virtual void AddCommand(uint32_t cmd_id,
- const smart_objects::SmartObject& command) = 0;
-
- /*
- * @brief Deletes all commands from the application
- * menu with the specified command id
- */
- virtual void RemoveCommand(uint32_t cmd_id) = 0;
-
- /*
- * @brief Finds command with the specified command id
- */
- virtual smart_objects::SmartObject* FindCommand(uint32_t cmd_id) = 0;
-
- /*
- * @brief Adds a menu to the application
- */
- virtual void AddSubMenu(uint32_t menu_id,
- const smart_objects::SmartObject& menu) = 0;
-
- /*
- * @brief Deletes menu from the application menu
- */
- virtual void RemoveSubMenu(uint32_t menu_id) = 0;
-
- /*
- * @brief Finds menu with the specified id
- */
- virtual smart_objects::SmartObject* FindSubMenu(
- uint32_t menu_id) const = 0;
-
- /*
- * @brief Returns true if sub menu with such name already exist
- */
- virtual bool IsSubMenuNameAlreadyExist(const std::string& name) = 0;
-
- /*
- * @brief Adds a interaction choice set to the application
- *
- * @param choice_set_id Unique ID used for this interaction choice set
- * @param choice_set SmartObject that represent choice set
- */
- virtual void AddChoiceSet(uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set) = 0;
-
- /*
- * @brief Deletes choice set from the application
- *
- * @param choice_set_id Unique ID of the interaction choice set
- */
- virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0;
-
- /*
- * @brief Finds choice set with the specified choice_set_id id
- *
- * @param choice_set_id Unique ID of the interaction choice set
- */
- virtual smart_objects::SmartObject* FindChoiceSet(
- uint32_t choice_set_id) = 0;
-
- /*
- * @brief Adds perform interaction choice set to the application
- *
- * @param correlation_id Unique ID of the request that added this choice set
- * @param choice_set_id Unique ID used for this interaction choice set
- * @param choice_set SmartObject that represents choice set
- */
- virtual void AddPerformInteractionChoiceSet(
- uint32_t correlation_id, uint32_t choice_set_id,
+ virtual void set_keyboard_props(
+ const smart_objects::SmartObject& keyboard_props) = 0;
+ virtual void set_menu_title(const smart_objects::SmartObject& menu_title) = 0;
+ virtual void set_menu_icon(const smart_objects::SmartObject& menu_icon) = 0;
+
+ virtual uint32_t audio_stream_retry_number() const = 0;
+
+ virtual void set_audio_stream_retry_number(
+ const uint32_t& audio_stream_retry_number) = 0;
+
+ virtual uint32_t video_stream_retry_number() const = 0;
+
+ virtual void set_video_stream_retry_number(
+ const uint32_t& video_stream_retry_number) = 0;
+
+ /*
+ * @brief Adds a command to the in application menu
+ */
+ virtual void AddCommand(uint32_t cmd_id,
+ const smart_objects::SmartObject& command) = 0;
+
+ /*
+ * @brief Deletes all commands from the application
+ * menu with the specified command id
+ */
+ virtual void RemoveCommand(uint32_t cmd_id) = 0;
+
+ /*
+ * @brief Finds command with the specified command id
+ */
+ virtual smart_objects::SmartObject* FindCommand(uint32_t cmd_id) = 0;
+
+ /*
+ * @brief Adds a menu to the application
+ */
+ virtual void AddSubMenu(uint32_t menu_id,
+ const smart_objects::SmartObject& menu) = 0;
+
+ /*
+ * @brief Deletes menu from the application menu
+ */
+ virtual void RemoveSubMenu(uint32_t menu_id) = 0;
+
+ /*
+ * @brief Finds menu with the specified id
+ */
+ virtual smart_objects::SmartObject* FindSubMenu(uint32_t menu_id) const = 0;
+
+ /*
+ * @brief Returns true if sub menu with such name already exist
+ */
+ virtual bool IsSubMenuNameAlreadyExist(const std::string& name) = 0;
+
+ /*
+ * @brief Adds a interaction choice set to the application
+ *
+ * @param choice_set_id Unique ID used for this interaction choice set
+ * @param choice_set SmartObject that represent choice set
+ */
+ virtual void AddChoiceSet(uint32_t choice_set_id,
+ const smart_objects::SmartObject& choice_set) = 0;
+
+ /*
+ * @brief Deletes choice set from the application
+ *
+ * @param choice_set_id Unique ID of the interaction choice set
+ */
+ virtual void RemoveChoiceSet(uint32_t choice_set_id) = 0;
+
+ /*
+ * @brief Finds choice set with the specified choice_set_id id
+ *
+ * @param choice_set_id Unique ID of the interaction choice set
+ */
+ virtual smart_objects::SmartObject* FindChoiceSet(uint32_t choice_set_id) = 0;
+
+ /*
+ * @brief Adds perform interaction choice set to the application
+ *
+ * @param correlation_id Unique ID of the request that added this choice set
+ * @param choice_set_id Unique ID used for this interaction choice set
+ * @param choice_set SmartObject that represents choice set
+ */
+ virtual void AddPerformInteractionChoiceSet(
+ uint32_t correlation_id,
+ uint32_t choice_set_id,
const smart_objects::SmartObject& choice_set) = 0;
- /*
- * @brief Deletes entirely perform interaction choice set for request
- * @param correlation_id Unique ID of the request that added this choice set
- *
- */
- virtual void DeletePerformInteractionChoiceSet(uint32_t correlation_id) = 0;
-
- /*
- * @brief Retrieves entirely ChoiceSet - VR commands map
- *
- * @return ChoiceSet map that is currently in use
- */
- virtual DataAccessor<PerformChoiceSetMap>
- performinteraction_choice_set_map() const = 0;
-
- /*
- * @brief Retrieve application commands
- */
- virtual DataAccessor<CommandsMap> commands_map() const = 0;
-
- /*
- * @brief Retrieve application sub menus
- */
- virtual DataAccessor<SubMenuMap> sub_menu_map() const = 0;
-
- /*
- * @brief Retrieve application choice set map
- */
- virtual DataAccessor<ChoiceSetMap> choice_set_map() const = 0;
-
- /*
- * @brief Sets perform interaction state
- *
- * @param active Current state of the perform interaction
- */
- virtual void set_perform_interaction_active(uint32_t active) = 0;
-
- /*
- * @brief Retrieves perform interaction state
- *
- * @return TRUE if perform interaction active, otherwise FALSE
- */
- virtual uint32_t is_perform_interaction_active() const = 0;
-
- /*
- * @brief Sets the mode for perform interaction: UI/VR/BOTH
- *
- * @param mode Mode that was selected (MENU; VR; BOTH)
- */
- virtual void set_perform_interaction_mode(int32_t mode) = 0;
-
- /*
- * @brief Retrieve the mode that was PerformInteraction sent in
- *
- * @return mode of PerformInteraction
- */
- virtual int32_t perform_interaction_mode() const = 0;
-
- /*
- * @brief Sets reset global properties state
- *
- * @param active Current state of the reset global properties
- */
- virtual void set_reset_global_properties_active(bool active) = 0;
-
- /*
- * @brief Retrieves reset global properties state
- *
- * @return TRUE if perform interaction active, otherwise FALSE
- */
- virtual bool is_reset_global_properties_active() const = 0;
+ /*
+ * @brief Deletes entirely perform interaction choice set for request
+ * @param correlation_id Unique ID of the request that added this choice set
+ *
+ */
+ virtual void DeletePerformInteractionChoiceSet(uint32_t correlation_id) = 0;
+
+ /*
+ * @brief Retrieves entirely ChoiceSet - VR commands map
+ *
+ * @return ChoiceSet map that is currently in use
+ */
+ virtual DataAccessor<PerformChoiceSetMap> performinteraction_choice_set_map()
+ const = 0;
+
+ /*
+ * @brief Retrieve application commands
+ */
+ virtual DataAccessor<CommandsMap> commands_map() const = 0;
+
+ /*
+ * @brief Retrieve application sub menus
+ */
+ virtual DataAccessor<SubMenuMap> sub_menu_map() const = 0;
+
+ /*
+ * @brief Retrieve application choice set map
+ */
+ virtual DataAccessor<ChoiceSetMap> choice_set_map() const = 0;
+
+ /*
+ * @brief Sets perform interaction state
+ *
+ * @param active Current state of the perform interaction
+ */
+ virtual void set_perform_interaction_active(uint32_t active) = 0;
+
+ /*
+ * @brief Retrieves perform interaction state
+ *
+ * @return TRUE if perform interaction active, otherwise FALSE
+ */
+ virtual uint32_t is_perform_interaction_active() const = 0;
+
+ /*
+ * @brief Set perform interaction layout
+ *
+ * @param Current Interaction layout of the perform interaction
+ */
+ virtual void set_perform_interaction_layout(mobile_api::LayoutMode::eType layout) = 0;
+
+ /*
+ * @brief Retrieve perform interaction layout
+ */
+ virtual mobile_api::LayoutMode::eType perform_interaction_layout() const = 0;
+
+/*
+ * @brief Sets the mode for perform interaction: UI/VR/BOTH
+ *
+ * @param mode Mode that was selected (MENU; VR; BOTH)
+ */
+ virtual void set_perform_interaction_mode(int32_t mode) = 0;
+
+ /*
+ * @brief Retrieve the mode that was PerformInteraction sent in
+ *
+ * @return mode of PerformInteraction
+ */
+ virtual int32_t perform_interaction_mode() const = 0;
+
+ /*
+ * @brief Sets reset global properties state
+ *
+ * @param active Current state of the reset global properties
+ */
+ virtual void set_reset_global_properties_active(bool active) = 0;
+
+ /*
+ * @brief Retrieves reset global properties state
+ *
+ * @return TRUE if perform interaction active, otherwise FALSE
+ */
+ virtual bool is_reset_global_properties_active() const = 0;
};
class Application : public virtual InitialApplicationData,
- public virtual DynamicApplicationData {
-
- public:
- enum ApplicationState {
- kRegistered = 0,
- kWaitingForRegistration
- };
-
- public:
- Application() :
- is_greyed_out_(false) {
- }
-
- virtual ~Application() {
- }
-
- /**
- * @brief Returns message belonging to the application
- * that is currently executed (i.e. on HMI).
- * @return smart_objects::SmartObject * Active message
- */
- virtual const smart_objects::SmartObject* active_message() const = 0;
-
- /**
- * @brief returns current hash value
- * @return current hash value
- */
- virtual const std::string& curHash() const = 0;
-
- /**
- * @brief Change Hash for current application
- * and send notification to mobile
- * @return updated_hash
- */
- virtual void UpdateHash() = 0;
-
- virtual void CloseActiveMessage() = 0;
- virtual bool IsFullscreen() const = 0;
- virtual void ChangeSupportingAppHMIType() = 0;
-
- virtual bool is_navi() const = 0;
- virtual void set_is_navi(bool allow) = 0;
-
- virtual bool video_streaming_approved() const = 0;
- virtual void set_video_streaming_approved(bool state) = 0;
- virtual bool audio_streaming_approved() const = 0;
- virtual void set_audio_streaming_approved(bool state) = 0;
-
- virtual bool video_streaming_allowed() const = 0;
- virtual void set_video_streaming_allowed(bool state) = 0;
- virtual bool audio_streaming_allowed() const = 0;
- virtual void set_audio_streaming_allowed(bool state) = 0;
-
- /**
- * @brief Starts streaming service for application
- * @param service_type Type of streaming service
- */
- virtual void StartStreaming(
- protocol_handler::ServiceType service_type) = 0;
-
- /**
- * @brief Stops streaming service for application
- * @param service_type Type of streaming service
- */
- virtual void StopStreaming(
- protocol_handler::ServiceType service_type) = 0;
-
- /**
- * @brief Suspends streaming process for application
- * @param service_type Type of streaming service
- */
- virtual void SuspendStreaming(
- protocol_handler::ServiceType service_type) = 0;
-
- /**
- * @brief Wakes up streaming process for application
- * @param service_type Type of streaming service
- */
- virtual void WakeUpStreaming(
- protocol_handler::ServiceType service_type) = 0;
-
- virtual bool is_voice_communication_supported() const = 0;
- virtual void set_voice_communication_supported(
- bool is_voice_communication_supported) = 0;
- virtual bool app_allowed() const = 0;
- virtual bool has_been_activated() const = 0;
- virtual bool set_activated(bool is_active) = 0;
-
- virtual const Version& version() const = 0;
- virtual void set_hmi_application_id(uint32_t hmi_app_id) = 0;
- virtual uint32_t hmi_app_id() const = 0;
- virtual uint32_t app_id() const = 0;
- virtual const std::string& name() const = 0;
- virtual const std::string folder_name() const = 0;
- virtual bool is_media_application() const = 0;
- virtual bool is_foreground() const = 0;
- virtual void set_foreground(bool is_foreground) = 0;
- virtual const mobile_api::HMILevel::eType hmi_level() const = 0;
- virtual const uint32_t put_file_in_none_count() const = 0;
- virtual const uint32_t delete_file_in_none_count() const = 0;
- virtual const uint32_t list_files_in_none_count() const = 0;
- virtual const mobile_api::SystemContext::eType system_context() const = 0;
- virtual const mobile_api::AudioStreamingState::eType
- audio_streaming_state() const = 0;
- virtual const std::string& app_icon_path() const = 0;
- virtual connection_handler::DeviceHandle device() const = 0;
- virtual bool tts_speak_state() = 0;
-
- /**
- * @brief Active states of application
- */
- DataAccessor<HmiStateList> GetHmiStateListAccessor() {
- DataAccessor<HmiStateList> hmi_states_da =
- DataAccessor<HmiStateList>(hmi_states_, hmi_states_lock_);
- return hmi_states_da;
- }
-
- /**
- * @brief Current hmi state
- */
- virtual const HmiStatePtr CurrentHmiState() const = 0;
-
-
- /**
- * @brief RegularHmiState of application without active events VR, TTS etc ...
- * @return HmiState of application
- */
- virtual const HmiStatePtr RegularHmiState() const = 0;
-
- /**
- * @brief sets true if application has sent TTS GlobalProperties
- * request with empty array help_prompt to HMI with level
- * NONE BACKGROUND
- * @param active contains state of sending TTS GlobalProperties
- */
- virtual void set_tts_properties_in_none(bool active) = 0;
- /**
- * @brief returns true if application has sent TTS GlobalProperties
- * otherwise return false
- * @return flag tts_properties_in_none
- */
- virtual bool tts_properties_in_none() = 0;
- /**
- * @brief sets true if application has sent TTS GlobalProperties
- * request with default array help_prompt to HMI with level
- * FULL LIMITED
- * @param active contains state of sending TTS GlobalProperties
- */
- virtual void set_tts_properties_in_full(
- bool active) = 0;
- /**
- * @brief returns true if application has sent TTS GlobalProperties
- * otherwise return false
- * @return flag tts_properties_in_full
- */
- virtual bool tts_properties_in_full() = 0;
- virtual void set_version(const Version& version) = 0;
- virtual void set_name(const std::string& name) = 0;
- virtual void set_is_media_application(bool is_media) = 0;
- virtual void increment_put_file_in_none_count() = 0;
- virtual void increment_delete_file_in_none_count() = 0;
- virtual void increment_list_files_in_none_count() = 0;
- virtual bool set_app_icon_path(const std::string& file_name) = 0;
- virtual void set_app_allowed(const bool& allowed) = 0;
- virtual void set_device(connection_handler::DeviceHandle device) = 0;
- virtual uint32_t get_grammar_id() const = 0 ;
- virtual void set_grammar_id(uint32_t value) = 0;
-
- virtual void set_protocol_version(
- const ProtocolVersion& protocol_version) = 0;
- virtual ProtocolVersion protocol_version() const = 0;
-
- virtual bool AddFile(AppFile& file) = 0;
- virtual const AppFilesMap& getAppFiles() const = 0;
-
- /**
- * @brief Updates fields of existing file
- * @param file_name File name, that need to update
- * @param is_persistent Bollean describes is file persistent?
- * @param is_download_complete Bollean describes is file downloaded fully on need to finish downloading?
- * @return TRUE if file exist and updated sucsesfuly, othervise return false
- */
- virtual bool UpdateFile(AppFile& file) = 0;
- virtual bool DeleteFile(const std::string& file_name) = 0;
- virtual const AppFile* GetFile(const std::string& file_name) = 0;
-
- virtual bool SubscribeToButton(mobile_apis::ButtonName::eType btn_name) = 0;
- virtual bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name) = 0;
- virtual bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name) = 0;
-
- virtual bool SubscribeToIVI(uint32_t vehicle_info_type_) = 0;
- virtual bool IsSubscribedToIVI(uint32_t vehicle_info_type_) = 0;
- virtual bool UnsubscribeFromIVI(uint32_t vehicle_info_type_) = 0;
-
- /**
- * @brief ResetDataInNone reset data counters in NONE
- */
- virtual void ResetDataInNone() = 0;
-
- /**
- * @brief Check, if limits for command number per time is exceeded
- * @param cmd_id Unique command id from mobile API
- * @param source Limits source, e.g. policy table, config file etc.
- * @return true, if - excedeed, otherwise - false
- */
- virtual bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
- TLimitSource source) = 0;
-
- /**
- * Returns object for recording statistics
- * @return object for recording statistics
- */
- virtual UsageStatistics& usage_report() = 0;
-
- /**
- * @brief SetRegularState set permanent state of application
- * @param state state to setup
- */
- virtual void SetRegularState(HmiStatePtr state) = 0;
-
- /**
- * @brief AddHMIState the function that will change application's
- * hmi state.
- *
- * @param app_id id of the application whose hmi level should be changed.
- *
- * @param state new hmi state for certain application.
- */
- virtual void AddHMIState(HmiStatePtr state) = 0;
-
- /**
- * @brief RemoveHMIState the function that will turn back hmi_level after end
- * of some event
- *
- * @param app_id id of the application whose hmi level should be changed.
- *
- * @param state_id that should be removed
- */
- virtual void RemoveHMIState(HmiState::StateID state_id) = 0;
-
- /**
- * @brief Keeps id of softbuttons which is created in commands:
- * Alert, Show, ScrollableMessage, ShowConstantTBT, AlertManeuver, UpdateTurnList
- * @param cmd_id Unique command id from mobile API
- * @param list of softbuttons were created by command.
- */
- virtual void SubscribeToSoftButtons(int32_t cmd_id,
- const SoftButtonID& softbuttons_id) = 0;
-
- /**
- * @brief Determine the existence of softbutton
- * @param Softbutton_id contains id of softbutton
- * @return Returns true if application contains softbutton id otherwise returns false.
- */
- virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id) = 0;
-
- /**
- * @brief Removes list of softbuttons which is created in commands
- * @param cmd_id Unique command id from mobile API
- */
- virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0;
-
- /**
- * @brief Check's if it is media, voice communication or navigation application
- *
- * @return true if application is media, voice communication or navigation
- */
- virtual bool IsAudioApplication() const = 0;
-
- /**
- * @brief IsRegistered allows to distinguish if this
- * application has been registered.
- *
- * @return true if registered, false otherwise.
- */
- bool IsRegistered() const { return app_state_ == kRegistered;}
-
- /**
- * @brief MarkRegistered allows to mark application as registered.
- */
- void MarkRegistered() {app_state_ = kRegistered;}
-
- /**
- * @brief MarkUnregistered allows to mark application as unregistered.
- */
- void MarkUnregistered() {app_state_ = kWaitingForRegistration;}
-
- /**
- * @brief schemaUrl contains application's url (for 4th protocol version)
- *
- * @return application's url.
- */
- std::string SchemaUrl() const {return url_;}
-
- /**
- * @brief SetShemaUrl allows to store schema url for application.
- *
- * @param url url to store.
- */
- void SetShemaUrl(const std::string& url) {url_ = url;}
-
- /**
- * @brief packagName allows to obtain application's package name.
- *
- * @return pakage name.
- */
- std::string PackageName() const {return package_name_;}
-
- /**
- * @brief SetPackageName allows to store package name for application.
- *
- * @param packageName package name to store.
- */
- void SetPackageName(const std::string& packageName) {
- package_name_ = packageName;
- }
-
- /**
- * @brief GetDeviceId allows to obtain device id which posseses
- * by this application.
- *
- * @return device the device id.
- */
- std::string GetDeviceId() const {return device_id_;}
-
- /**
- * @brief Returns is application should be greyed out on HMI
- */
- bool is_greyed_out() const {return is_greyed_out_;}
-
- /**
- * @brief Sets application as should be greyed out on HMI
- * @param is_greyed_out True, if should be greyed out on HMI,
- * otherwise - false
- */
- void set_greyed_out(bool is_greyed_out) {is_greyed_out_ = is_greyed_out;}
-
- protected:
-
- /**
- * @brief Active states of application
- */
- HmiStateList hmi_states_;
- mutable sync_primitives::Lock hmi_states_lock_;
-
- ApplicationState app_state_;
- std::string url_;
- std::string package_name_;
- std::string device_id_;
- ssize_t connection_id_;
- bool is_greyed_out_;
+ public virtual DynamicApplicationData {
+ public:
+ enum ApplicationRegisterState { kRegistered = 0, kWaitingForRegistration };
+
+ public:
+ Application() : is_greyed_out_(false) {}
+ virtual ~Application() {}
+
+ /**
+ * @brief Returns message belonging to the application
+ * that is currently executed (i.e. on HMI).
+ * @return smart_objects::SmartObject * Active message
+ */
+ virtual const smart_objects::SmartObject* active_message() const = 0;
+
+ /**
+ * @brief returns current hash value
+ * @return current hash value
+ */
+ virtual const std::string& curHash() const = 0;
+
+ /**
+ * @brief Change Hash for current application
+ * and send notification to mobile
+ * @return updated_hash
+ */
+ virtual void UpdateHash() = 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
+ */
+ virtual bool is_application_data_changed() const = 0;
+
+ /**
+ * @brief method is called after SDL saved application data for resumption
+ * @param state_application_data contains FALSE after saving data
+ */
+ virtual void set_is_application_data_changed(bool state_application_data) = 0;
+
+ virtual void CloseActiveMessage() = 0;
+ virtual bool IsFullscreen() const = 0;
+ virtual void ChangeSupportingAppHMIType() = 0;
+
+ virtual bool is_navi() const = 0;
+ virtual void set_is_navi(bool allow) = 0;
+
+ virtual bool video_streaming_approved() const = 0;
+ virtual void set_video_streaming_approved(bool state) = 0;
+ virtual bool audio_streaming_approved() const = 0;
+ virtual void set_audio_streaming_approved(bool state) = 0;
+
+ virtual bool video_streaming_allowed() const = 0;
+ virtual void set_video_streaming_allowed(bool state) = 0;
+ virtual bool audio_streaming_allowed() const = 0;
+ virtual void set_audio_streaming_allowed(bool state) = 0;
+
+ /**
+ * @brief Starts streaming service for application
+ * @param service_type Type of streaming service
+ */
+ virtual void StartStreaming(protocol_handler::ServiceType service_type) = 0;
+
+ /**
+ * @brief Stops streaming service for application
+ * @param service_type Type of streaming service
+ */
+ virtual void StopStreaming(
+ protocol_handler::ServiceType service_type) = 0;
+
+ /**
+ * @brief Stops streaming for application whether it is allowed or not HMI
+ * @param service_type video or audio
+ */
+ virtual void StopStreamingForce(
+ protocol_handler::ServiceType service_type) = 0;
+
+ /**
+ * @brief Suspends streaming process for application
+ * @param service_type Type of streaming service
+ */
+ virtual void SuspendStreaming(protocol_handler::ServiceType service_type) = 0;
+
+ /**
+ * @brief Wakes up streaming process for application
+ * @param service_type Type of streaming service
+ */
+ virtual void WakeUpStreaming(protocol_handler::ServiceType service_type) = 0;
+
+ virtual bool is_voice_communication_supported() const = 0;
+ virtual void set_voice_communication_supported(
+ bool is_voice_communication_supported) = 0;
+ virtual bool app_allowed() const = 0;
+ virtual bool has_been_activated() const = 0;
+ virtual bool set_activated(bool is_active) = 0;
+
+ virtual const Version& version() const = 0;
+ virtual void set_hmi_application_id(uint32_t hmi_app_id) = 0;
+ virtual uint32_t hmi_app_id() const = 0;
+ virtual uint32_t app_id() const = 0;
+ virtual const custom_str::CustomString& name() const = 0;
+ /**
+ * @brief Sets application folder name, which is used for storing of related
+ * files, e.g. icons
+ * @param folder_name Name of folder
+ */
+ virtual void set_folder_name(const std::string& folder_name) = 0;
+ virtual const std::string folder_name() const = 0;
+ virtual bool is_media_application() const = 0;
+ virtual bool is_foreground() const = 0;
+ virtual void set_foreground(bool is_foreground) = 0;
+ virtual const mobile_api::HMILevel::eType hmi_level() const = 0;
+ virtual const uint32_t put_file_in_none_count() const = 0;
+ virtual const uint32_t delete_file_in_none_count() const = 0;
+ virtual const uint32_t list_files_in_none_count() const = 0;
+ virtual const mobile_api::SystemContext::eType system_context() const = 0;
+ virtual const mobile_api::AudioStreamingState::eType audio_streaming_state()
+ const = 0;
+ virtual const std::string& app_icon_path() const = 0;
+ virtual connection_handler::DeviceHandle device() const = 0;
+
+ /**
+ * @brief sets true if application has sent TTS GlobalProperties
+ * request with empty array help_prompt to HMI with level
+ * NONE BACKGROUND
+ * @param active contains state of sending TTS GlobalProperties
+ */
+ virtual void set_tts_properties_in_none(bool active) = 0;
+ /**
+ * @brief returns true if application has sent TTS GlobalProperties
+ * otherwise return false
+ * @return flag tts_properties_in_none
+ */
+ virtual bool tts_properties_in_none() = 0;
+ /**
+ * @brief sets true if application has sent TTS GlobalProperties
+ * request with default array help_prompt to HMI with level
+ * FULL LIMITED
+ * @param active contains state of sending TTS GlobalProperties
+ */
+ virtual void set_tts_properties_in_full(bool active) = 0;
+ /**
+ * @brief returns true if application has sent TTS GlobalProperties
+ * otherwise return false
+ * @return flag tts_properties_in_full
+ */
+ virtual bool tts_properties_in_full() = 0;
+ virtual void set_version(const Version& version) = 0;
+ virtual void set_name(const custom_str::CustomString& name) = 0;
+ virtual void set_is_media_application(bool is_media) = 0;
+ virtual void increment_put_file_in_none_count() = 0;
+ virtual void increment_delete_file_in_none_count() = 0;
+ virtual void increment_list_files_in_none_count() = 0;
+ virtual bool set_app_icon_path(const std::string& file_name) = 0;
+ virtual void set_app_allowed(const bool& allowed) = 0;
+ virtual void set_device(connection_handler::DeviceHandle device) = 0;
+ virtual uint32_t get_grammar_id() const = 0;
+ virtual void set_grammar_id(uint32_t value) = 0;
+
+ virtual void set_protocol_version(
+ const ProtocolVersion& protocol_version) = 0;
+ virtual ProtocolVersion protocol_version() const = 0;
+
+ virtual void set_is_resuming(bool is_resuming) = 0;
+ virtual bool is_resuming() const = 0;
+
+ virtual bool AddFile(const AppFile& file) = 0;
+ virtual const AppFilesMap& getAppFiles() const = 0;
+
+ /**
+ * @brief Updates fields of existing file
+ * @param file_name File name, that need to update
+ * @param is_persistent Bollean describes is file persistent?
+ * @param is_download_complete Bollean describes is file downloaded fully on
+ * need to finish downloading?
+ * @return TRUE if file exist and updated sucsesfuly, othervise return false
+ */
+ virtual bool UpdateFile(const AppFile& file) = 0;
+ virtual bool DeleteFile(const std::string& file_name) = 0;
+ virtual const AppFile* GetFile(const std::string& file_name) = 0;
+
+ virtual bool SubscribeToButton(mobile_apis::ButtonName::eType btn_name) = 0;
+ virtual bool IsSubscribedToButton(
+ mobile_apis::ButtonName::eType btn_name) = 0;
+ virtual bool UnsubscribeFromButton(
+ mobile_apis::ButtonName::eType btn_name) = 0;
+
+ virtual bool SubscribeToIVI(uint32_t vehicle_info_type) = 0;
+ virtual bool IsSubscribedToIVI(uint32_t vehicle_info_type) const = 0;
+ virtual bool UnsubscribeFromIVI(uint32_t vehicle_info_type) = 0;
+
+ /**
+ * @brief ResetDataInNone reset data counters in NONE
+ */
+ virtual void ResetDataInNone() = 0;
+
+ /**
+ * @brief Check, if limits for command number per time is exceeded
+ * @param cmd_id Unique command id from mobile API
+ * @param source Limits source, e.g. policy table, config file etc.
+ * @return true, if - excedeed, otherwise - false
+ */
+ virtual bool IsCommandLimitsExceeded(mobile_apis::FunctionID::eType cmd_id,
+ TLimitSource source) = 0;
+
+ /**
+ * Returns object for recording statistics
+ * @return object for recording statistics
+ */
+ virtual UsageStatistics& usage_report() = 0;
+
+ /**
+ * @brief SetRegularState set permanent state of application
+ *
+ * @param state state to setup
+ */
+ virtual void SetRegularState(HmiStatePtr state) = 0;
+
+ /**
+ * @brief SetPostponedState sets postponed state to application.
+ * This state could be set as regular later
+ *
+ * @param state state to setup
+ */
+ virtual void SetPostponedState(HmiStatePtr state) = 0;
+
+ virtual void RemovePostponedState() = 0;
+
+ /**
+ * @brief AddHMIState the function that will change application's
+ * hmi state.
+ *
+ * @param app_id id of the application whose hmi level should be changed.
+ *
+ * @param state new hmi state for certain application.
+ */
+ virtual void AddHMIState(HmiStatePtr state) = 0;
+
+ /**
+ * @brief RemoveHMIState the function that will turn back hmi_level after end
+ * of some event
+ *
+ * @param app_id id of the application whose hmi level should be changed.
+ *
+ * @param state_id that should be removed
+ */
+ virtual void RemoveHMIState(HmiState::StateID state_id) = 0;
+
+ /**
+ * @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @return Active HmiState of application
+ */
+ virtual const HmiStatePtr CurrentHmiState() const = 0;
+
+ /**
+ * @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @return HmiState of application
+ */
+ virtual const HmiStatePtr RegularHmiState() const = 0;
+
+ /**
+ * @brief PostponedHmiState returns postponed hmi state of application
+ * if it's present
+ *
+ * @return Postponed hmi state of application
+ */
+ virtual const HmiStatePtr PostponedHmiState() const = 0;
+
+ /**
+ * @brief Keeps id of softbuttons which is created in commands:
+ * Alert, Show, ScrollableMessage, ShowConstantTBT, AlertManeuver,
+ * UpdateTurnList
+ * @param cmd_id Unique command id from mobile API
+ * @param list of softbuttons were created by command.
+ */
+ virtual void SubscribeToSoftButtons(int32_t cmd_id,
+ const SoftButtonID& softbuttons_id) = 0;
+
+ /**
+ * @brief Determine the existence of softbutton
+ * @param Softbutton_id contains id of softbutton
+ * @return Returns true if application contains softbutton id otherwise
+ * returns false.
+ */
+ virtual bool IsSubscribedToSoftButton(const uint32_t softbutton_id) = 0;
+
+ /**
+ * @brief Removes list of softbuttons which is created in commands
+ * @param cmd_id Unique command id from mobile API
+ */
+ virtual void UnsubscribeFromSoftButtons(int32_t cmd_id) = 0;
+
+ /**
+ * @brief Check's if it is media, voice communication or navigation
+ * application
+ *
+ * @return true if application is media, voice communication or navigation
+ */
+ virtual bool IsAudioApplication() const = 0;
+
+ /**
+ * @brief IsRegistered allows to distinguish if this
+ * application has been registered.
+ *
+ * @return true if registered, false otherwise.
+ */
+ bool IsRegistered() const {
+ return app_state_ == kRegistered;
+ }
+
+ /**
+ * @brief MarkRegistered allows to mark application as registered.
+ */
+ void MarkRegistered() {
+ app_state_ = kRegistered;
+ }
+
+ /**
+ * @brief MarkUnregistered allows to mark application as unregistered.
+ */
+ void MarkUnregistered() {
+ app_state_ = kWaitingForRegistration;
+ }
+
+ /**
+ * @brief schemaUrl contains application's url (for 4th protocol version)
+ *
+ * @return application's url.
+ */
+ std::string SchemaUrl() const {
+ return url_;
+ }
+
+ /**
+ * @brief SetShemaUrl allows to store schema url for application.
+ *
+ * @param url url to store.
+ */
+ void SetShemaUrl(const std::string& url) {
+ url_ = url;
+ }
+
+ /**
+ * @brief packagName allows to obtain application's package name.
+ *
+ * @return pakage name.
+ */
+ std::string PackageName() const {
+ return package_name_;
+ }
+
+ /**
+ * @brief SetPackageName allows to store package name for application.
+ *
+ * @param packageName package name to store.
+ */
+ void SetPackageName(const std::string& packageName) {
+ package_name_ = packageName;
+ }
+
+ /**
+ * @brief GetDeviceId allows to obtain device id which posseses
+ * by this application.
+ *
+ * @return device the device id.
+ */
+ std::string GetDeviceId() const {
+ return device_id_;
+ }
+
+ /**
+ * @brief Returns is application should be greyed out on HMI
+ */
+ bool is_greyed_out() const {
+ return is_greyed_out_;
+ }
+
+ /**
+ * @brief Sets application as should be greyed out on HMI
+ * @param is_greyed_out True, if should be greyed out on HMI,
+ * otherwise - false
+ */
+ void set_greyed_out(bool is_greyed_out) {
+ is_greyed_out_ = is_greyed_out;
+ }
+ /**
+ * @brief Load persistent files from application folder.
+ */
+ virtual void LoadPersistentFiles() = 0;
+
+ protected:
+ mutable sync_primitives::Lock hmi_states_lock_;
+
+ ApplicationRegisterState app_state_;
+ ApplicationState state_;
+ std::string url_;
+ std::string package_name_;
+ std::string device_id_;
+ ssize_t connection_id_;
+ bool is_greyed_out_;
};
typedef utils::SharedPtr<Application> ApplicationSharedPtr;
diff --git a/src/components/application_manager/include/application_manager/application_data_impl.h b/src/components/application_manager/include/application_manager/application_data_impl.h
index 62d3d1c8c7..35c638e207 100644
--- a/src/components/application_manager/include/application_manager/application_data_impl.h
+++ b/src/components/application_manager/include/application_manager/application_data_impl.h
@@ -63,6 +63,11 @@ class InitialApplicationDataImpl : public virtual Application {
void set_language(const mobile_api::Language::eType& language);
void set_ui_language(const mobile_api::Language::eType& ui_language);
+ void set_perform_interaction_layout(
+ mobile_api::LayoutMode::eType layout) OVERRIDE;
+ mobile_api::LayoutMode::eType perform_interaction_layout() const OVERRIDE;
+
+
protected:
smart_objects::SmartObject* app_types_;
smart_objects::SmartObject* vr_synonyms_;
@@ -71,6 +76,7 @@ class InitialApplicationDataImpl : public virtual Application {
smart_objects::SmartObject* ngn_media_screen_name_;
mobile_api::Language::eType language_;
mobile_api::Language::eType ui_language_;
+ mobile_apis::LayoutMode::eType perform_interaction_layout_;
private:
DISALLOW_COPY_AND_ASSIGN(InitialApplicationDataImpl);
};
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 f23b53632f..dbe7ee9b2b 100644
--- a/src/components/application_manager/include/application_manager/application_impl.h
+++ b/src/components/application_manager/include/application_manager/application_impl.h
@@ -46,8 +46,10 @@
#include "protocol_handler/protocol_handler.h"
#include "connection_handler/device.h"
-#include "utils/timer_thread.h"
#include "utils/lock.h"
+#include "utils/atomic_object.h"
+#include "utils/custom_string.h"
+#include "utils/timer.h"
namespace usage_statistics {
@@ -59,14 +61,17 @@ using namespace utils;
using namespace timer;
namespace mobile_api = mobile_apis;
+namespace custom_str = custom_string;
class ApplicationImpl : public virtual InitialApplicationDataImpl,
- public virtual DynamicApplicationDataImpl {
+ public virtual DynamicApplicationDataImpl {
public:
- ApplicationImpl(uint32_t application_id,
- const std::string& mobile_app_id,
- const std::string& app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager);
+ ApplicationImpl(
+ uint32_t application_id,
+ const std::string& mobile_app_id,
+ const std::string& mac_address,
+ const custom_str::CustomString& app_name,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager);
~ApplicationImpl();
@@ -84,7 +89,9 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
*/
virtual void ChangeSupportingAppHMIType();
- inline bool is_navi() const { return is_navi_; }
+ inline bool is_navi() const {
+ return is_navi_;
+ }
void set_is_navi(bool allow);
bool video_streaming_approved() const;
@@ -99,9 +106,10 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
void StartStreaming(
protocol_handler::ServiceType service_type);
+ void StopStreamingForce(
+ protocol_handler::ServiceType service_type);
void StopStreaming(
protocol_handler::ServiceType service_type);
-
void SuspendStreaming(
protocol_handler::ServiceType service_type);
void WakeUpStreaming(
@@ -118,7 +126,8 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
void set_hmi_application_id(uint32_t hmi_app_id);
inline uint32_t hmi_app_id() const;
inline uint32_t app_id() const;
- const std::string& name() const;
+ const custom_str::CustomString& name() const;
+ void set_folder_name(const std::string& folder_name) OVERRIDE;
const std::string folder_name() const;
bool is_media_application() const;
virtual bool is_foreground() const;
@@ -128,16 +137,17 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
const uint32_t delete_file_in_none_count() const;
const uint32_t list_files_in_none_count() const;
const mobile_api::SystemContext::eType system_context() const;
- inline const mobile_apis::AudioStreamingState::eType audio_streaming_state() const;
+ inline const mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const;
const std::string& app_icon_path() const;
connection_handler::DeviceHandle device() const;
- bool tts_speak_state();
+ const std::string& mac_address() const OVERRIDE;
void set_tts_properties_in_none(bool active);
bool tts_properties_in_none();
void set_tts_properties_in_full(bool active);
bool tts_properties_in_full();
void set_version(const Version& ver);
- void set_name(const std::string& name);
+ void set_name(const custom_str::CustomString& name);
void set_is_media_application(bool is_media);
void increment_put_file_in_none_count();
void increment_delete_file_in_none_count();
@@ -148,13 +158,14 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
virtual uint32_t get_grammar_id() const;
virtual void set_grammar_id(uint32_t value);
-
virtual void set_protocol_version(const ProtocolVersion& protocol_version);
virtual ProtocolVersion protocol_version() const;
- bool AddFile(AppFile& file);
- bool UpdateFile(AppFile& file);
+ virtual void set_is_resuming(bool is_resuming);
+ virtual bool is_resuming() const;
+ bool AddFile(const AppFile& file);
+ bool UpdateFile(const AppFile& file);
bool DeleteFile(const std::string& file_name);
virtual const AppFilesMap& getAppFiles() const;
@@ -164,17 +175,17 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
bool IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name);
bool UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name);
- bool SubscribeToIVI(uint32_t vehicle_info_type_);
- bool IsSubscribedToIVI(uint32_t vehicle_info_type_);
- bool UnsubscribeFromIVI(uint32_t vehicle_info_type_);
+ bool SubscribeToIVI(uint32_t vehicle_info_type) OVERRIDE;
+ bool IsSubscribedToIVI(uint32_t vehicle_info_type) const OVERRIDE;
+ bool UnsubscribeFromIVI(uint32_t vehicle_info_type) OVERRIDE;
+ DataAccessor<VehicleInfoSubscriptions> SubscribedIVI() const OVERRIDE;
/**
* @brief ResetDataInNone reset data counters in NONE
*/
virtual void ResetDataInNone();
- virtual const std::set<mobile_apis::ButtonName::eType>& SubscribedButtons() const;
- virtual const std::set<uint32_t>& SubscribesIVI() const;
+ virtual DataAccessor<ButtonSubscriptions> SubscribedButtons() const OVERRIDE;
virtual const std::string& curHash() const;
/**
@@ -194,20 +205,41 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
virtual void UnsubscribeFromSoftButtons(int32_t cmd_id);
+ virtual bool is_application_data_changed() const;
+
+ virtual void set_is_application_data_changed(bool state_application_data);
+
/**
- * @brief Check's if it is media, voice communication or navigation application
+ * @brief Check's if it is media, voice communication or navigation
+ * application
*
* @return true if application is media, voice communication or navigation
*/
virtual bool IsAudioApplication() const;
- /*
+ /**
+ * @brief Load persistent files from application folder.
+ */
+ virtual void LoadPersistentFiles();
+
+ /**
* @brief SetRegularState set permanent state of application
+ *
* @param state state to setup
*/
virtual void SetRegularState(HmiStatePtr state);
/**
+ * @brief SetPostponedState sets postponed state to application.
+ * This state could be set as regular later
+ *
+ * @param state state to setup
+ */
+ virtual void SetPostponedState(HmiStatePtr state);
+
+ virtual void RemovePostponedState();
+
+ /**
* @brief AddHMIState the function that will change application's
* hmi state.
*
@@ -239,6 +271,14 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
*/
virtual const HmiStatePtr RegularHmiState() const;
+ /**
+ * @brief PostponedHmiState returns postponed hmi state of application
+ * if it's present
+ *
+ * @return Postponed hmi state of application
+ */
+ virtual const HmiStatePtr PostponedHmiState() const;
+
uint32_t audio_stream_retry_number() const;
void set_audio_stream_retry_number(const uint32_t& audio_stream_retry_number);
@@ -247,20 +287,13 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
void set_video_stream_retry_number(const uint32_t& video_stream_retry_number);
- protected:
-
+ protected:
/**
* @brief Clean up application folder. Persistent files will stay
*/
void CleanupFiles();
- /**
- * @brief Load persistent files from application folder.
- */
- void LoadPersistentFiles();
-
private:
- typedef SharedPtr<TimerThread<ApplicationImpl>> ApplicationTimerPtr;
/**
* @brief Callback for video streaming suspend timer.
@@ -269,55 +302,68 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
void OnVideoStreamSuspend();
/**
+ * @brief Stops video streaming for application
+ */
+ inline void StopNaviStreaming();
+
+ /**
+ * @brief Stops audio streaming for application
+ */
+ inline void StopAudioStreaming();
+
+ /**
* @brief Callback for audio streaming suspend timer.
* Suspends audio streaming process for application
*/
void OnAudioStreamSuspend();
- std::string hash_val_;
- uint32_t grammar_id_;
+ std::string hash_val_;
+ uint32_t grammar_id_;
Version version_;
- std::string app_name_;
- uint32_t hmi_app_id_;
- uint32_t app_id_;
- smart_objects::SmartObject* active_message_;
- bool is_media_;
- bool is_navi_;
-
- bool video_streaming_approved_;
- bool audio_streaming_approved_;
- bool video_streaming_allowed_;
- bool audio_streaming_allowed_;
- bool video_streaming_suspended_;
- bool audio_streaming_suspended_;
- sync_primitives::Lock video_streaming_suspended_lock_;
- sync_primitives::Lock audio_streaming_suspended_lock_;
-
- bool is_app_allowed_;
- bool has_been_activated_;
- bool tts_properties_in_none_;
- bool tts_properties_in_full_;
- bool is_foreground_;
- uint32_t put_file_in_none_count_;
- uint32_t delete_file_in_none_count_;
- uint32_t list_files_in_none_count_;
- std::string app_icon_path_;
- connection_handler::DeviceHandle device_;
-
- AppFilesMap app_files_;
+ custom_str::CustomString app_name_;
+ uint32_t hmi_app_id_;
+ uint32_t app_id_;
+ smart_objects::SmartObject* active_message_;
+ bool is_media_;
+ bool is_navi_;
+
+ bool video_streaming_approved_;
+ bool audio_streaming_approved_;
+ bool video_streaming_allowed_;
+ bool audio_streaming_allowed_;
+ bool video_streaming_suspended_;
+ bool audio_streaming_suspended_;
+ sync_primitives::Lock video_streaming_suspended_lock_;
+ sync_primitives::Lock audio_streaming_suspended_lock_;
+
+ bool is_app_allowed_;
+ bool has_been_activated_;
+ bool tts_properties_in_none_;
+ bool tts_properties_in_full_;
+ bool is_foreground_;
+ bool is_application_data_changed_;
+ uint32_t put_file_in_none_count_;
+ uint32_t delete_file_in_none_count_;
+ uint32_t list_files_in_none_count_;
+ std::string app_icon_path_;
+ connection_handler::DeviceHandle device_;
+ const std::string mac_address_;
+
+ AppFilesMap app_files_;
std::set<mobile_apis::ButtonName::eType> subscribed_buttons_;
- std::set<uint32_t> subscribed_vehicle_info_;
- UsageStatistics usage_report_;
- ProtocolVersion protocol_version_;
- bool is_voice_communication_application_;
-
- uint32_t video_stream_retry_number_;
- uint32_t audio_stream_retry_number_;
- uint32_t video_stream_suspend_timeout_;
- uint32_t audio_stream_suspend_timeout_;
- ApplicationTimerPtr video_stream_suspend_timer_;
- ApplicationTimerPtr audio_stream_suspend_timer_;
+ VehicleInfoSubscriptions subscribed_vehicle_info_;
+ UsageStatistics usage_report_;
+ ProtocolVersion protocol_version_;
+ bool is_voice_communication_application_;
+ sync_primitives::atomic_bool is_resuming_;
+
+ uint32_t video_stream_retry_number_;
+ uint32_t audio_stream_retry_number_;
+ uint32_t video_stream_suspend_timeout_;
+ uint32_t audio_stream_suspend_timeout_;
+ Timer video_stream_suspend_timer_;
+ Timer audio_stream_suspend_timer_;
/**
* @brief Defines number per time in seconds limits
@@ -328,17 +374,19 @@ class ApplicationImpl : public virtual InitialApplicationDataImpl,
* @brief Defines specific command number per time in seconds limits
*/
typedef std::map<mobile_apis::FunctionID::eType, TimeToNumberLimit>
- CommandNumberTimeLimit;
+ CommandNumberTimeLimit;
/**
* @brief Defines id of SoftButton which is related from name of command
*/
- typedef std::map<int32_t, SoftButtonID>
- CommandSoftButtonID;
+ typedef std::map<int32_t, SoftButtonID> CommandSoftButtonID;
CommandNumberTimeLimit cmd_number_to_time_limits_;
CommandSoftButtonID cmd_softbuttonid_;
// Lock for command soft button id
sync_primitives::Lock cmd_softbuttonid_lock_;
+ mutable sync_primitives::Lock vi_lock_;
+ sync_primitives::Lock button_lock_;
+ std::string folder_name_;
DISALLOW_COPY_AND_ASSIGN(ApplicationImpl);
};
@@ -354,8 +402,8 @@ const mobile_api::AudioStreamingState::eType
ApplicationImpl::audio_streaming_state() const {
using namespace mobile_apis;
const HmiStatePtr hmi_state = CurrentHmiState();
- return hmi_state ? hmi_state->audio_streaming_state() :
- AudioStreamingState::INVALID_ENUM;
+ return hmi_state ? hmi_state->audio_streaming_state()
+ : AudioStreamingState::INVALID_ENUM;
}
bool ApplicationImpl::app_allowed() const {
diff --git a/src/components/application_manager/include/application_manager/application_manager.h b/src/components/application_manager/include/application_manager/application_manager.h
index c5a0402687..f35577fcab 100644
--- a/src/components/application_manager/include/application_manager/application_manager.h
+++ b/src/components/application_manager/include/application_manager/application_manager.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,44 +33,194 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
+#include <string>
+#include <vector>
+#include <set>
+
+#include "application_manager/application.h"
+#include "application_manager/hmi_capabilities.h"
+#include "application_manager/commands/command.h"
+
+#include "utils/data_accessor.h"
+#include "utils/shared_ptr.h"
+#include "telemetry_monitor/telemetry_observable.h"
+
// Other compomnents class declaration
namespace hmi_message_handler {
- class HMIMessageHandler;
+class HMIMessageHandler;
}
namespace protocol_handler {
- class ProtocolHandler;
+class ProtocolHandler;
}
namespace connection_handler {
- class ConnectionHandler;
+class ConnectionHandler;
}
namespace application_manager {
-class Application;
+struct ApplicationsAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) const {
+ return lhs->app_id() < rhs->app_id();
+ }
+};
+typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplicationSet;
+
+// typedef for Applications list iterator
+typedef ApplicationSet::iterator ApplicationSetIt;
+
+// typedef for Applications list const iterator
+typedef ApplicationSet::const_iterator ApplicationSetConstIt;
class ApplicationManager {
- public:
- virtual ~ApplicationManager() {
- }
-
- /**
- * Inits application manager
- */
- virtual bool Init() = 0;
-
- /**
- * @brief Stop work.
- *
- * @return TRUE on success otherwise FALSE.
- **/
- virtual bool Stop() = 0;
-
- virtual void set_hmi_message_handler(
+ public:
+ virtual ~ApplicationManager() {}
+
+ /**
+ * Inits application manager
+ */
+ virtual bool Init() = 0;
+
+ /**
+ * @brief Stop work.
+ *
+ * @return TRUE on success otherwise FALSE.
+ **/
+ virtual bool Stop() = 0;
+
+ virtual void set_hmi_message_handler(
hmi_message_handler::HMIMessageHandler* handler) = 0;
- virtual void set_protocol_handler(
+ virtual void set_protocol_handler(
protocol_handler::ProtocolHandler* handler) = 0;
- virtual void set_connection_handler(
+ virtual void set_connection_handler(
connection_handler::ConnectionHandler* handler) = 0;
+
+ virtual DataAccessor<ApplicationSet> applications() const = 0;
+
+ virtual ApplicationSharedPtr application(uint32_t app_id) const = 0;
+ virtual ApplicationSharedPtr active_application() const = 0;
+ //
+
+ /**
+ * Function used only by HMI request/response/notification base classes
+ * to change HMI app id to Mobile app id and vice versa.
+ * Don't use it inside Core
+ */
+ virtual ApplicationSharedPtr application_by_hmi_app(
+ uint32_t hmi_app_id) const = 0;
+
+ virtual ApplicationSharedPtr application_by_policy_id(
+ const std::string& policy_app_id) const = 0;
+
+ virtual std::vector<ApplicationSharedPtr> applications_by_button(
+ uint32_t button) = 0;
+ virtual std::vector<ApplicationSharedPtr> applications_with_navi() = 0;
+
+ /**
+ * @brief Returns media application with LIMITED HMI Level if exists
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer.
+ */
+ virtual ApplicationSharedPtr get_limited_media_application() const = 0;
+
+ /**
+ * @brief Returns navigation application with LIMITED HMI Level if exists
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer
+ */
+ virtual ApplicationSharedPtr get_limited_navi_application() const = 0;
+
+ /**
+ * @brief Returns voice communication application with
+ * LIMITED HMI Level if exists
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer
+ */
+ virtual ApplicationSharedPtr get_limited_voice_application() const = 0;
+
+ /**
+ * @brief Retrieves application id associated with correlation id
+ *
+ * @param correlation_id Correlation ID of the HMI request
+ *
+ * @return application id associated with correlation id
+ */
+ virtual const uint32_t application_id(const int32_t correlation_id) = 0;
+
+ /**
+ * @brief Sets application id correlation id
+ *
+ * @param correlation_id Correlation ID of the HMI request
+ * @param app_id Application ID
+ */
+ virtual void set_application_id(const int32_t correlation_id,
+ const uint32_t app_id) = 0;
+
+ /**
+ * @brief OnHMILevelChanged the callback that allows SDL to react when
+ * application's HMI level has been changed.
+ *
+ * @param app_id application identifier for which HMILevel has been chaned.
+ *
+ * @param from previous HMILevel.
+ * @param to current HMILevel.
+ */
+ virtual void OnHMILevelChanged(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to) = 0;
+
+ /**
+ * @brief Sends HMI status notification to mobile
+ *
+ * @param application_impl application with changed HMI status
+ *
+ **/
+ virtual void SendHMIStatusNotification(
+ const utils::SharedPtr<Application> app) = 0;
+
+ virtual void SendMessageToMobile(const commands::MessageSharedPtr message,
+ bool final_message = false) = 0;
+
+ virtual void SendMessageToHMI(const commands::MessageSharedPtr message) = 0;
+
+ virtual bool ManageHMICommand(const commands::MessageSharedPtr message) = 0;
+ virtual bool ManageMobileCommand(const commands::MessageSharedPtr message,
+ commands::Command::CommandOrigin origin) = 0;
+
+
+ virtual mobile_api::HMILevel::eType GetDefaultHmiLevel(
+ ApplicationConstSharedPtr application) const = 0;
+ /**
+ * @brief hmi_capabilities return capabilities of hmi
+ * @return capabilities of hmi
+ */
+ virtual HMICapabilities& hmi_capabilities() = 0;
+
+ virtual bool is_attenuated_supported() = 0;
+
+ /**
+ * @brief Checks if application with the same HMI type
+ * (media, voice communication or navi) exists
+ * in HMI_FULL or HMI_LIMITED level.
+ *
+ * @param app Pointer to application to compare with
+ *
+ * @return true if exist otherwise false
+ */
+ virtual bool IsAppTypeExistsInFullOrLimited(
+ ApplicationConstSharedPtr app) const = 0;
+
+ /**
+ * @brief Sets default HMI level and configure application after its
+ * registration
+ * @param app Application
+ */
+ virtual void OnApplicationRegistered(ApplicationSharedPtr app) = 0;
+
+ virtual connection_handler::ConnectionHandler& connection_handler() const = 0;
};
} // namespace application_manager
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 dd9cd33fa3..561a8d4f6e 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -46,7 +46,7 @@
#include "application_manager/message.h"
#include "application_manager/message_helper.h"
#include "application_manager/request_controller.h"
-#include "application_manager/resume_ctrl.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/vehicle_info_data.h"
#include "application_manager/state_controller.h"
#include "protocol_handler/protocol_observer.h"
@@ -58,7 +58,7 @@
#include "connection_handler/connection_handler.h"
#include "connection_handler/connection_handler_observer.h"
#include "connection_handler/device.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
#include "interfaces/HMI_API.h"
#include "interfaces/HMI_API_schema.h"
@@ -66,9 +66,15 @@
#include "interfaces/v4_protocol_v1_2_no_extra.h"
#include "interfaces/v4_protocol_v1_2_no_extra_schema.h"
-#ifdef TIME_TESTER
-#include "time_metric_observer.h"
-#endif // TIME_TESTER
+
+#ifdef ENABLE_SECURITY
+#include "security_manager/security_manager_listener.h"
+#include "security_manager/ssl_context.h"
+#endif // ENABLE_SECURITY
+
+#ifdef TELEMETRY_MONITOR
+#include "telemetry_observer.h"
+#endif // TELEMETRY_MONITOR
#include "utils/macro.h"
#include "utils/shared_ptr.h"
@@ -79,6 +85,7 @@
#include "utils/lock.h"
#include "utils/singleton.h"
#include "utils/data_accessor.h"
+#include "utils/timer.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -96,15 +103,15 @@ namespace application_manager {
namespace mobile_api = mobile_apis;
using namespace utils;
using namespace timer;
+namespace custom_str = custom_string;
class ApplicationManagerImpl;
-enum VRTTSSessionChanging {
- kVRSessionChanging = 0,
- kTTSSessionChanging
-};
+enum VRTTSSessionChanging { kVRSessionChanging = 0, kTTSSessionChanging };
struct CommandParametersPermissions;
+typedef std::map<std::string, hmi_apis::Common_TransportType::eType>
+ DeviceTypes;
namespace impl {
using namespace threads;
@@ -113,27 +120,27 @@ using namespace threads;
* These dummy classes are here to locally impose strong typing on different
* kinds of messages
* Currently there is no type difference between incoming and outgoing messages
- * And due to ApplicationManagerImpl works as message router it has to distinguish
+ * And due to ApplicationManagerImpl works as message router it has to
+ * distinguish
* messages passed from it's different connection points
* TODO(ik): replace these with globally defined message types
* when we have them.
*/
-struct MessageFromMobile: public utils::SharedPtr<Message> {
+struct MessageFromMobile : public utils::SharedPtr<Message> {
+ MessageFromMobile() {}
explicit MessageFromMobile(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {
- }
+ : utils::SharedPtr<Message>(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
}
};
-struct MessageToMobile: public utils::SharedPtr<Message> {
+struct MessageToMobile : public utils::SharedPtr<Message> {
+ MessageToMobile() : is_final(false) {}
explicit MessageToMobile(const utils::SharedPtr<Message>& message,
bool final_message)
- : utils::SharedPtr<Message>(message),
- is_final(final_message) {
- }
+ : utils::SharedPtr<Message>(message), is_final(final_message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
@@ -142,20 +149,20 @@ struct MessageToMobile: public utils::SharedPtr<Message> {
bool is_final;
};
-struct MessageFromHmi: public utils::SharedPtr<Message> {
+struct MessageFromHmi : public utils::SharedPtr<Message> {
+ MessageFromHmi() {}
explicit MessageFromHmi(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {
- }
+ : utils::SharedPtr<Message>(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
}
};
-struct MessageToHmi: public utils::SharedPtr<Message> {
+struct MessageToHmi : public utils::SharedPtr<Message> {
+ MessageToHmi() {}
explicit MessageToHmi(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {
- }
+ : utils::SharedPtr<Message>(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
@@ -163,1255 +170,1331 @@ struct MessageToHmi: public utils::SharedPtr<Message> {
};
// Short type names for prioritized message queues
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile> > FromMobileQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile> > ToMobileQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi> > FromHmiQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> > ToHmiQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile>>
+ FromMobileQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile>>
+ ToMobileQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi>>
+ FromHmiQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi>>
+ ToHmiQueue;
// AudioPassThru
-typedef struct {
-std::vector<uint8_t> binary_data;
-int32_t session_key;
+typedef struct {
+ std::vector<uint8_t> binary_data;
+ int32_t session_key;
} AudioData;
-typedef std::queue<AudioData> RawAudioDataQueue;
-typedef threads::MessageLoopThread<RawAudioDataQueue> AudioPassThruQueue;
+typedef std::queue<AudioData> RawAudioDataQueue;
+typedef threads::MessageLoopThread<RawAudioDataQueue> AudioPassThruQueue;
}
-
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
typedef std::vector<std::string> RPCParams;
-class ApplicationManagerImpl : public ApplicationManager,
- public hmi_message_handler::HMIMessageObserver,
- public protocol_handler::ProtocolObserver,
- public connection_handler::ConnectionHandlerObserver,
- public policy::PolicyHandlerObserver,
- public impl::FromMobileQueue::Handler, public impl::ToMobileQueue::Handler,
- public impl::FromHmiQueue::Handler, public impl::ToHmiQueue::Handler,
- public impl::AudioPassThruQueue::Handler,
- public utils::Singleton<ApplicationManagerImpl> {
-
- friend class ResumeCtrl;
- friend class CommandImpl;
+class ApplicationManagerImpl
+ : public ApplicationManager,
+ public hmi_message_handler::HMIMessageObserver,
+ public protocol_handler::ProtocolObserver,
+ public connection_handler::ConnectionHandlerObserver,
+ public policy::PolicyHandlerObserver,
+#ifdef ENABLE_SECURITY
+ public security_manager::SecurityManagerListener,
+#endif // ENABLE_SECURITY
+ public impl::FromMobileQueue::Handler,
+ public impl::ToMobileQueue::Handler,
+ public impl::FromHmiQueue::Handler,
+ public impl::ToHmiQueue::Handler,
+ public impl::AudioPassThruQueue::Handler,
+#ifdef TELEMETRY_MONITOR
+ public telemetry_monitor::TelemetryObservable<AMTelemetryObserver>,
+#endif // TELEMETRY_MONITOR
+ public utils::Singleton<ApplicationManagerImpl> {
+
+ friend class ResumeCtrl;
+ friend class CommandImpl;
public:
- ~ApplicationManagerImpl();
-
- /**
- * Inits application manager
- */
- virtual bool Init();
-
- /**
- * @brief Stop work.
- *
- * @return TRUE on success otherwise FALSE.
- **/
- virtual bool Stop();
-
- /////////////////////////////////////////////////////
-
- ApplicationSharedPtr application(uint32_t app_id) const;
- ApplicationSharedPtr application_by_policy_id(
- const std::string& policy_app_id) const;
- ApplicationSharedPtr active_application() const;
- std::vector<ApplicationSharedPtr> applications_by_button(uint32_t button);
- std::vector<ApplicationSharedPtr> applications_by_ivi(uint32_t vehicle_info);
- std::vector<ApplicationSharedPtr> applications_with_navi();
-
- /**
- * @brief Returns media application with LIMITED HMI Level if exist.
- *
- * @return Shared pointer to application if application does not
- * exist returns empty shared pointer.
- */
- ApplicationSharedPtr get_limited_media_application() const;
-
- /**
- * @brief Returns navigation application with LIMITED HMI Level if exist.
- *
- * @return Shared pointer to application if application does not
- * exist returns empty shared pointer
- */
- ApplicationSharedPtr get_limited_navi_application() const;
-
- /**
- * @brief Returns voice communication application with LIMITED HMI Level if exist.
- *
- * @return Shared pointer to application if application does not
- * exist returns empty shared pointer
- */
- ApplicationSharedPtr get_limited_voice_application() const;
-
- /**
- * @brief Checks if application with the same HMI type
- * (media, voice communication or navi) exists
- * in HMI_FULL or HMI_LIMITED level.
- *
- * @param app Pointer to application to compare with
- *
- * @return true if exist otherwise false
- */
- bool IsAppTypeExistsInFullOrLimited(ApplicationSharedPtr app) const;
-
- /**
- * @brief Notifies all components interested in Vehicle Data update
- * i.e. new value of odometer etc and returns list of applications
- * subscribed for event.
- * @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);
-
- /////////////////////////////////////////////////////
-
- HMICapabilities& hmi_capabilities();
-
- /**
- * @brief ProcessQueryApp executes logic related to QUERY_APP system request.
- *
- * @param sm_object smart object wich is actually parsed json obtained within
- * system request.
- * @param connection_key connection key for app, which sent system request
- */
- void ProcessQueryApp(const smart_objects::SmartObject& sm_object,
- const uint32_t connection_key);
-
-#ifdef TIME_TESTER
- /**
- * @brief Setup observer for time metric.
- *
- * @param observer - pointer to observer
- */
- void SetTimeMetricObserver(AMMetricObserver* observer);
-#endif // TIME_TESTER
-
- ApplicationSharedPtr RegisterApplication(
- const utils::SharedPtr<smart_objects::SmartObject>& request_for_registration);
- /*
- * @brief Closes application by id
- *
- * @param app_id Application id
- * @param reason reason of unregistering application
- * @param is_resuming describes - is this unregister
- * is normal or need to be resumed\
- * @param is_unexpected_disconnect
- * Indicates if connection was unexpectedly lost(TM layer, HB)
- */
- void UnregisterApplication(const uint32_t& app_id,
- mobile_apis::Result::eType reason,
- bool is_resuming = false,
- bool is_unexpected_disconnect = false);
-
- /**
- * @brief Handle sequence for unauthorized application
- * @param app_id Application id
- */
- void OnAppUnauthorized(const uint32_t& app_id);
-
- /*
- * @brief Sets unregister reason for closing all registered applications
- * duringHU switching off
- *
- * @param reason Describes the reason for HU switching off
- */
- void SetUnregisterAllApplicationsReason(
+ ~ApplicationManagerImpl();
+
+ /**
+ * Inits application manager
+ */
+ bool Init() OVERRIDE;
+
+ /**
+ * @brief Stop work.
+ *
+ * @return TRUE on success otherwise FALSE.
+ **/
+ bool Stop() OVERRIDE;
+
+ /////////////////////////////////////////////////////
+
+ DataAccessor<ApplicationSet> applications() const OVERRIDE;
+ ApplicationSharedPtr application(uint32_t app_id) const;
+ ApplicationSharedPtr application_by_policy_id(
+ const std::string& policy_app_id) const;
+ ApplicationSharedPtr active_application() const;
+ std::vector<ApplicationSharedPtr> applications_by_button(uint32_t button);
+ std::vector<ApplicationSharedPtr> applications_by_ivi(uint32_t vehicle_info);
+ std::vector<ApplicationSharedPtr> applications_with_navi();
+
+ /**
+ * @brief Returns media application with LIMITED HMI Level if exist.
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer.
+ */
+ ApplicationSharedPtr get_limited_media_application() const;
+
+ /**
+ * @brief Returns navigation application with LIMITED HMI Level if exist.
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer
+ */
+ ApplicationSharedPtr get_limited_navi_application() const;
+
+ /**
+ * @brief Returns voice communication application with LIMITED HMI Level if
+ * exist.
+ *
+ * @return Shared pointer to application if application does not
+ * exist returns empty shared pointer
+ */
+ ApplicationSharedPtr get_limited_voice_application() const;
+
+ void OnHMILevelChanged(uint32_t app_id,
+ mobile_apis::HMILevel::eType from,
+ mobile_apis::HMILevel::eType to) OVERRIDE;
+
+ void SendHMIStatusNotification(const ApplicationSharedPtr app) OVERRIDE;
+ /**
+ * @brief Checks if application with the same HMI type
+ * (media, voice communication or navi) exists
+ * in HMI_FULL or HMI_LIMITED level.
+ *
+ * @param app Pointer to application to compare with
+ *
+ * @return true if exist otherwise false
+ */
+ bool IsAppTypeExistsInFullOrLimited(ApplicationConstSharedPtr app) const;
+
+ /**
+ * @brief Notifies all components interested in Vehicle Data update
+ * i.e. new value of odometer etc and returns list of applications
+ * subscribed for event.
+ * @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);
+
+ void OnApplicationRegistered(ApplicationSharedPtr app) OVERRIDE;
+ /////////////////////////////////////////////////////
+
+ HMICapabilities& hmi_capabilities();
+
+ /**
+ * @brief ProcessQueryApp executes logic related to QUERY_APP system request.
+ *
+ * @param sm_object smart object wich is actually parsed json obtained within
+ * system request.
+ * @param connection_key connection key for app, which sent system request
+ */
+ void ProcessQueryApp(const smart_objects::SmartObject& sm_object,
+ const uint32_t connection_key);
+
+ bool is_attenuated_supported() OVERRIDE;
+
+#ifdef TELEMETRY_MONITOR
+ /**
+ * @brief Setup observer for time metric.
+ *
+ * @param observer - pointer to observer
+ */
+ void SetTelemetryObserver(AMTelemetryObserver* observer);
+#endif // TELEMETRY_MONITOR
+
+ ApplicationSharedPtr RegisterApplication(
+ const utils::SharedPtr<smart_objects::SmartObject>&
+ request_for_registration);
+ /*
+ * @brief Closes application by id
+ *
+ * @param app_id Application id
+ * @param reason reason of unregistering application
+ * @param is_resuming describes - is this unregister
+ * is normal or need to be resumed\
+ * @param is_unexpected_disconnect
+ * Indicates if connection was unexpectedly lost(TM layer, HB)
+ */
+ void UnregisterApplication(const uint32_t& app_id,
+ mobile_apis::Result::eType reason,
+ bool is_resuming = false,
+ bool is_unexpected_disconnect = false);
+
+ /**
+ * @brief Handle sequence for unauthorized application
+ * @param app_id Application id
+ */
+ void OnAppUnauthorized(const uint32_t& app_id);
+
+ /*
+ * @brief Sets unregister reason for closing all registered applications
+ * duringHU switching off
+ *
+ * @param reason Describes the reason for HU switching off
+ */
+ void SetUnregisterAllApplicationsReason(
mobile_api::AppInterfaceUnregisteredReason::eType reason);
- /*
- * @brief Called on Master_reset or Factory_defaults
- * when User chooses to reset HU.
- * Resets Policy Table if applicable.
- */
- void HeadUnitReset(
- mobile_api::AppInterfaceUnregisteredReason::eType reason);
-
- /*
- * @brief Closes all registered applications
- */
- void UnregisterAllApplications();
-
- bool RemoveAppDataFromHMI(ApplicationSharedPtr app);
- bool LoadAppDataToHMI(ApplicationSharedPtr app);
- bool ActivateApplication(ApplicationSharedPtr app);
-
- /**
- * @brief Put application in FULL HMI Level if possible,
- * otherwise put applicatuion other HMI level.
- * do not send any notifications to mobile
- * @param app, application, that need to be puted in FULL
- * @return seted HMI Level
- */
- mobile_api::HMILevel::eType IsHmiLevelFullAllowed(ApplicationSharedPtr app);
-
- void ConnectToDevice(const std::string& device_mac);
- void OnHMIStartedCooperation();
-
- /*
- * @brief Returns unique correlation ID for HMI request
- *
- * @return Unique correlation ID
- */
- uint32_t GetNextHMICorrelationID();
-
- /* @brief Starts audio passthru process
- *
- * @return true on success, false if passthru is already in process
- */
- bool begin_audio_pass_thru();
-
- /*
- * @brief Finishes already started audio passthru process
- *
- * @return true on success, false if passthru is not active
- */
- bool end_audio_pass_thru();
-
- /*
- * @brief Retrieves driver distraction state
- *
- * @return Current state of the distraction state
- */
- inline bool driver_distraction() const;
-
- /*
- * @brief Sets state for driver distraction
- *
- * @param state New state to be set
- */
- void set_driver_distraction(bool is_distracting);
-
- /*
- * @brief Retrieves if VR session has started
- *
- * @return Current VR session state (started, stopped)
- */
- inline bool vr_session_started() const;
-
- /*
- * @brief Sets VR session state
- *
- * @param state Current HMI VR session state
- */
- void set_vr_session_started(const bool& state);
-
- /*
- * @brief Retrieves SDL access to all mobile apps
- *
- * @return Currently active state of the access
- */
- inline bool all_apps_allowed() const;
-
- /*
- * @brief Sets SDL access to all mobile apps
- *
- * @param allowed SDL access to all mobile apps
- */
- void set_all_apps_allowed(const bool& allowed);
-
- /**
- * @brief CreateRegularState create regular HMI state for application
- * @param app_id
- * @param hmi_level of returned state
- * @param audio_state of returned state
- * @param system_context of returned state
- * @return new regular HMI state
- */
- HmiStatePtr CreateRegularState(
- uint32_t app_id, mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context) const;
-
- /**
- * @brief SetState set regular audio state
- * @param app_id applicatio id
- * @param audio_state aaudio streaming state
- */
- void SetState(uint32_t app_id,
- mobile_apis::AudioStreamingState::eType audio_state) {
- ApplicationSharedPtr app = application(app_id);
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID="<<app_id<<" does not exist");
- return;
- }
- state_ctrl_.SetRegularState(app, audio_state);
+ /*
+ * @brief Called on Master_reset or Factory_defaults
+ * when User chooses to reset HU.
+ * Resets Policy Table if applicable.
+ */
+ void HeadUnitReset(mobile_api::AppInterfaceUnregisteredReason::eType reason);
+
+ /*
+ * @brief Closes all registered applications
+ */
+ void UnregisterAllApplications();
+
+ bool RemoveAppDataFromHMI(ApplicationSharedPtr app);
+ bool LoadAppDataToHMI(ApplicationSharedPtr app);
+ bool ActivateApplication(ApplicationSharedPtr app);
+
+ /**
+ * @brief Put application in FULL HMI Level if possible,
+ * otherwise put applicatuion other HMI level.
+ * do not send any notifications to mobile
+ * @param app, application, that need to be puted in FULL
+ * @return seted HMI Level
+ */
+ mobile_api::HMILevel::eType IsHmiLevelFullAllowed(ApplicationSharedPtr app);
+
+ void ConnectToDevice(const std::string& device_mac);
+ void OnHMIStartedCooperation();
+
+ /*
+ * @brief Returns unique correlation ID for HMI request
+ *
+ * @return Unique correlation ID
+ */
+ uint32_t GetNextHMICorrelationID();
+
+ /* @brief Starts audio passthru process
+ *
+ * @return true on success, false if passthru is already in process
+ */
+ bool begin_audio_pass_thru();
+
+ /*
+ * @brief Finishes already started audio passthru process
+ *
+ * @return true on success, false if passthru is not active
+ */
+ bool end_audio_pass_thru();
+
+ /*
+ * @brief Retrieves driver distraction state
+ *
+ * @return Current state of the distraction state
+ */
+ inline bool driver_distraction() const;
+
+ /*
+ * @brief Sets state for driver distraction
+ *
+ * @param state New state to be set
+ */
+ void set_driver_distraction(bool is_distracting);
+
+ /*
+ * @brief Retrieves if VR session has started
+ *
+ * @return Current VR session state (started, stopped)
+ */
+ inline bool vr_session_started() const;
+
+ /*
+ * @brief Sets VR session state
+ *
+ * @param state Current HMI VR session state
+ */
+ void set_vr_session_started(const bool& state);
+
+ /*
+ * @brief Retrieves SDL access to all mobile apps
+ *
+ * @return Currently active state of the access
+ */
+ inline bool all_apps_allowed() const;
+
+ /*
+ * @brief Sets SDL access to all mobile apps
+ *
+ * @param allowed SDL access to all mobile apps
+ */
+ void set_all_apps_allowed(const bool& allowed);
+
+ /**
+ * @brief CreateRegularState create regular HMI state for application
+ * @param app_id
+ * @param hmi_level of returned state
+ * @param audio_state of returned state
+ * @param system_context of returned state
+ * @return new regular HMI state
+ */
+ HmiStatePtr CreateRegularState(
+ uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context) const;
+
+ /**
+ * @brief SetState set regular audio state
+ * @param app_id applicatio id
+ * @param audio_state aaudio streaming state
+ */
+ void SetState(uint32_t app_id,
+ mobile_apis::AudioStreamingState::eType audio_state) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState(app, audio_state);
+ }
- /**
- * @brief SetState setup regular hmi state, tha will appear if no
- * specific events are active
- * @param app appication to setup regular State
- * @param state state of new regular state
- */
- template <bool SendActivateApp>
- void SetState(uint32_t app_id,
- HmiStatePtr new_state) {
- ApplicationSharedPtr app = application(app_id);
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID="<<app_id<<" does not exist");
- return;
- }
- state_ctrl_.SetRegularState<SendActivateApp>(app, new_state);
+ /**
+ * @brief SetState setup regular hmi state, that will appear if no
+ * specific events are active
+ * @param app appication to setup regular State
+ * @param state state of new regular state
+ */
+ template <bool SendActivateApp>
+ void SetState(uint32_t app_id, HmiStatePtr new_state) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState<SendActivateApp>(app, new_state);
+ }
- /**
- * @brief SetState Change regular audio state
- * @param app appication to setup regular State
- * @param audio_state of new regular state
- */
- template <bool SendActivateApp>
- void SetState(uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level){
- ApplicationSharedPtr app = application(app_id);
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID="<<app_id<<" does not exist");
- return;
- }
- state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level);
+ /**
+ * @brief SetState Change regular audio state
+ * @param app appication to setup regular State
+ * @param audio_state of new regular state
+ */
+ template <bool SendActivateApp>
+ void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level);
+ }
- /**
- * @brief SetState Change regular hmi level and audio state
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
- */
- template <bool SendActivateApp>
- void SetState(uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state){
- ApplicationSharedPtr app = application(app_id);
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID="<<app_id<<" does not exist");
- return;
- }
- state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level, audio_state);
+ /**
+ * @brief SetState Change regular hmi level and audio state
+ * @param app appication to setup regular State
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
+ */
+ template <bool SendActivateApp>
+ void SetState(uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level, audio_state);
+ }
- /**
- * @brief SetState Change regular hmi level and audio state
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
- */
- template <bool SendActivateApp>
- void SetState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context) {
- ApplicationSharedPtr app = application(app_id);
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID="<<app_id<<" does not exist");
- return;
- }
- state_ctrl_.SetRegularState<SendActivateApp>(app, hmi_level,
- audio_state, system_context);
+ /**
+ * @brief SetState Change regular hmi level and audio state
+ * @param app appication to setup regular State
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
+ */
+ template <bool SendActivateApp>
+ void SetState(uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState<SendActivateApp>(
+ app, hmi_level, audio_state, system_context);
+ }
- /**
- * @brief SetState Change regular system context
- * @param app appication to setup regular State
- * @param system_context of new regular state
- */
- void SetState(uint32_t app_id,
- mobile_apis::SystemContext::eType system_context) {
- ApplicationSharedPtr app = application(app_id);
- if (!app) {
- LOG4CXX_ERROR(logger_, "Application with appID="<<app_id<<" does not exist");
- return;
- }
- state_ctrl_.SetRegularState(app, system_context);
+ /**
+ * @brief SetState Change regular system context
+ * @param app appication to setup regular State
+ * @param system_context of new regular state
+ */
+ void SetState(uint32_t app_id,
+ mobile_apis::SystemContext::eType system_context) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState(app, system_context);
+ }
- /**
- * @brief Notification from PolicyHandler about PTU.
- * Compares AppHMIType between saved in app and received from PTU. If they are different method sends:
- * UI_ChangeRegistration with list new AppHMIType;
- * ActivateApp with HMI level BACKGROUND;
- * OnHMIStatus notification;
- * for app with HMI level FULL or LIMITED.
- * method sends:
- * UI_ChangeRegistration with list new AppHMIType
- * for app with HMI level BACKGROUND.
- */
- virtual void OnUpdateHMIAppType(std::map<std::string, std::vector<std::string> > app_hmi_types);
-
- /*
- * @brief Starts audio pass thru thread
- *
- * @param session_key Session key of connection for Mobile side
- * @param correlation_id Correlation id for response for Mobile side
- * @param max_duration Max duration of audio recording in milliseconds
- * @param sampling_rate Value for rate(8, 16, 22, 44 kHz)
- * @param bits_per_sample The quality the audio is recorded.
- * @param audio_type Type of audio data
- */
- void StartAudioPassThruThread(int32_t session_key, int32_t correlation_id,
- int32_t max_duration, int32_t sampling_rate,
- int32_t bits_per_sample, int32_t audio_type);
-
- /*
- * @brief Terminates audio pass thru thread
- * @param application_key Id of application for which
- * audio pass thru should be stopped
- */
- void StopAudioPassThru(int32_t application_key);
-
- /*
- * @brief Creates AudioPassThru data chunk and inserts it
- * to audio_pass_thru_messages_
- *
- * @param session_key Id of application for which
- * audio pass thru should be sent
- *
- * @param binary_data AudioPassThru data chunk
- */
- void SendAudioPassThroughNotification(uint32_t session_key,
- std::vector<uint8_t>& binary_data);
-
- std::string GetDeviceName(connection_handler::DeviceHandle handle);
-
- /*
- * @brief Converts connection string transport type representation
- * to HMI Common_TransportType
- *
- * @param transport_type String representing connection type
- *
- * @return Corresponding HMI TransporType value
- */
- hmi_apis::Common_TransportType::eType GetDeviceTransportType(
- const std::string& transport_type);
-
- /////////////////////////////////////////////////////
-
- void set_hmi_message_handler(hmi_message_handler::HMIMessageHandler* handler);
- void set_connection_handler(connection_handler::ConnectionHandler* handler);
- void set_protocol_handler(protocol_handler::ProtocolHandler* handler);
-
- ///////////////////////////////////////////////////////
-
- void StartDevicesDiscovery();
-
- // Put message to the queue to be sent to mobile.
- // if |final_message| parameter is set connection to mobile will be closed
- // after processing this message
- void SendMessageToMobile(const commands::MessageSharedPtr message,
- bool final_message = false);
-
- /**
- * @brief TerminateRequest forces termination of request
- * @param connection_key - application id of request
- * @param corr_id correlation id of request
- */
- void TerminateRequest(uint32_t connection_key, uint32_t corr_id);
-
- bool ManageMobileCommand(
- const commands::MessageSharedPtr message,
- commands::Command::CommandOrigin origin =
- commands::Command::ORIGIN_SDL);
- void SendMessageToHMI(const commands::MessageSharedPtr message);
- bool ManageHMICommand(const commands::MessageSharedPtr message);
-
- /////////////////////////////////////////////////////////
- // Overriden ProtocolObserver method
- virtual void OnMessageReceived(
- const ::protocol_handler::RawMessagePtr message) OVERRIDE;
- virtual void OnMobileMessageSent(
- const ::protocol_handler::RawMessagePtr message) OVERRIDE;
-
- // Overriden HMIMessageObserver method
- void OnMessageReceived(hmi_message_handler::MessageSharedPointer message) OVERRIDE;
- void OnErrorSending(hmi_message_handler::MessageSharedPointer message) OVERRIDE;
-
- // Overriden ConnectionHandlerObserver method
- void OnDeviceListUpdated(const connection_handler::DeviceMap& device_list) OVERRIDE;
- //TODO (EZamakhov): fix all indentations in this file
- void OnFindNewApplicationsRequest() OVERRIDE;
- void RemoveDevice(const connection_handler::DeviceHandle& device_handle) OVERRIDE;
- bool OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key, const protocol_handler::ServiceType& type) OVERRIDE;
- void OnServiceEndedCallback(
- const int32_t& session_key,
- const protocol_handler::ServiceType& type,
- const connection_handler::CloseSessionReason& close_reason) OVERRIDE;
-
- /**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
- void addNotification(const CommandSharedPtr ptr);
-
- /**
- * @ Add notification to collection
- *
- * @param ptr Reference to shared pointer that point on hmi notification
- */
- void removeNotification(const commands::Command* notification);
-
- /**
- * @ Updates request timeout
- *
- * @param connection_key Connection key of application
- * @param mobile_correlation_id Correlation ID of the mobile request
- * @param new_timeout_value New timeout in milliseconds to be set
- */
- void updateRequestTimeout(uint32_t connection_key,
- uint32_t mobile_correlation_id,
- uint32_t new_timeout_value);
-
- /*
- * @brief Retrieves application id associated whith correlation id
- *
- * @param correlation_id Correlation ID of the HMI request
- *
- * @return application id associated whith correlation id
- */
- const uint32_t application_id(const int32_t correlation_id);
-
- /*
- * @brief Sets application id correlation id
- *
- * @param correlation_id Correlation ID of the HMI request
- * @param app_id Application ID
- */
- void set_application_id(const int32_t correlation_id, const uint32_t app_id);
-
- /**
- * @brief AddPolicyObserver allows to subscribe needed component to events
- * from policy.
- *
- * @param listener the component to subscribe.
- */
- void AddPolicyObserver(PolicyHandlerObserver* listener);
-
- /**
- * @brief RemovePolicyObserver allows to remove observer from collection.
- *
- * @param listener observer to remove.
- */
- void RemovePolicyObserver(PolicyHandlerObserver* listener);
-
- /**
- * @brief Checks HMI level and returns true if streaming is allowed
- * @param app_id Application id
- * @param service_type Service type to check
- * @return True if streaming is allowed, false in other case
- */
- bool HMILevelAllowsStreaming(
- uint32_t app_id, protocol_handler::ServiceType service_type) const;
-
- /**
- * @brief Checks if application can stream (streaming service is started and
- * streaming is enabled in application)
- * @param app_id Application id
- * @param service_type Service type to check
- * @return True if streaming is allowed, false in other case
- */
- bool CanAppStream(
- uint32_t app_id, protocol_handler::ServiceType service_type) const;
-
- /**
- * @brief Ends opened navi services (audio/video) for application
- * @param app_id Application id
- */
- void EndNaviServices(uint32_t app_id);
-
- /**
- * @brief ForbidStreaming forbid the stream over the certain application.
- * @param app_id the application's id which should stop streaming.
- */
- void ForbidStreaming(uint32_t app_id);
-
- /**
- * @brief Callback calls when application starts/stops data streaming
- * @param app_id Streaming application id
- * @param service_type Streaming service type
- * @param state Shows if streaming started or stopped
- */
- void OnAppStreaming(
- uint32_t app_id, protocol_handler::ServiceType service_type, bool state);
-
- /**
- * @brief OnHMILevelChanged the callback that allows SDL to react when
- * application's HMILeval has been changed.
- *
- * @param app_id application identifier for which HMILevel has been chaned.
- *
- * @param from previous HMILevel.
- * @param to current HMILevel.
- */
- void OnHMILevelChanged(uint32_t app_id,
- mobile_apis::HMILevel::eType from,
- mobile_apis::HMILevel::eType to);
-
- mobile_api::HMILevel::eType GetDefaultHmiLevel(
- ApplicationSharedPtr application) const;
-
- /**
- * Getter for resume_controller
- * @return Resume Controller
- */
- ResumeCtrl& resume_controller() {
- return resume_ctrl_;
+ /**
+ * @brief SetState Change regular hmi level
+ * @param app appication to setup regular State
+ * @param hmi_level hmi level of new regular state
+ */
+ void SetHmiState(uint32_t app_id, mobile_apis::HMILevel::eType hmi_level) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
}
+ state_ctrl_.SetRegularState(app, hmi_level);
+ }
- /**
- * Generate grammar ID
- *
- * @return New grammar ID
- */
- uint32_t GenerateGrammarID();
-
- /**
- * Generate new HMI application ID
- *
- * @return New HMI application ID
- */
- uint32_t GenerateNewHMIAppID();
-
- /**
- * @brief Parse smartObject and replace mobile app Id by HMI app ID
- *
- * @param message Smartobject to be parsed
- */
- void ReplaceMobileByHMIAppId(
- smart_objects::SmartObject& message);
-
- /**
- * @brief Parse smartObject and replace HMI app ID by mobile app Id
- *
- * @param message Smartobject to be parsed
- */
- void ReplaceHMIByMobileAppId(
- smart_objects::SmartObject& message);
-
- /*
- * @brief Save binary data to specified directory
- *
- * @param binary data
- * @param path for saving data
- * @param file_name File name
- * @param offset for saving data to existing file with offset.
- * If offset is 0 - create new file ( overrite existing )
- *
- *
- * @return SUCCESS if file was saved, other code otherwise
- */
- mobile_apis::Result::eType SaveBinary(
- const std::vector<uint8_t>& binary_data,
- const std::string& file_path,
- const std::string& file_name,
- const int64_t offset);
-
- /**
- * @brief Get available app space
- * @param name of the app folder(make + mobile app id)
- * @return free app space.
- */
- uint32_t GetAvailableSpaceForApp(const std::string& folder_name);
-
- /*
- * @brief returns true if HMI is cooperating
- */
- bool IsHMICooperating() const;
+ /**
+ * @brief SetState Change regular hmi state
+ * @param app appication to setup regular State
+ * @param state new regular hmi state
+ */
+ void SetState(uint32_t app_id, HmiStatePtr state) {
+ ApplicationSharedPtr app = application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Application with appID=" << app_id << " does not exist");
+ return;
+ }
+ state_ctrl_.SetRegularState(app, state);
+ }
- /**
- * @brief Method used to send default app tts globalProperties
- * in case they were not provided from mobile side after defined time
- */
- void OnTimerSendTTSGlobalProperties();
+ /**
+ * @brief Checks, if particular state is active
+ * @param state_id State
+ * @return True, if state is active, otherwise - false
+ */
+ bool IsStateActive(HmiState::StateID state_id) const;
+
+ /**
+ * @brief Notification from PolicyHandler about PTU.
+ * Compares AppHMIType between saved in app and received from PTU. If they are
+ * different method sends:
+ * UI_ChangeRegistration with list new AppHMIType;
+ * ActivateApp with HMI level BACKGROUND;
+ * OnHMIStatus notification;
+ * for app with HMI level FULL or LIMITED.
+ * method sends:
+ * UI_ChangeRegistration with list new AppHMIType
+ * for app with HMI level BACKGROUND.
+ */
+ void OnUpdateHMIAppType(
+ std::map<std::string, std::vector<std::string>> app_hmi_types) OVERRIDE;
+
+ /*
+ * @brief Starts audio pass thru thread
+ *
+ * @param session_key Session key of connection for Mobile side
+ * @param correlation_id Correlation id for response for Mobile side
+ * @param max_duration Max duration of audio recording in milliseconds
+ * @param sampling_rate Value for rate(8, 16, 22, 44 kHz)
+ * @param bits_per_sample The quality the audio is recorded.
+ * @param audio_type Type of audio data
+ */
+ void StartAudioPassThruThread(int32_t session_key,
+ int32_t correlation_id,
+ int32_t max_duration,
+ int32_t sampling_rate,
+ int32_t bits_per_sample,
+ int32_t audio_type);
+
+ /*
+ * @brief Terminates audio pass thru thread
+ * @param application_key Id of application for which
+ * audio pass thru should be stopped
+ */
+ void StopAudioPassThru(int32_t application_key);
+
+ /*
+ * @brief Creates AudioPassThru data chunk and inserts it
+ * to audio_pass_thru_messages_
+ *
+ * @param session_key Id of application for which
+ * audio pass thru should be sent
+ *
+ * @param binary_data AudioPassThru data chunk
+ */
+ void SendAudioPassThroughNotification(uint32_t session_key,
+ std::vector<uint8_t>& binary_data);
+
+ std::string GetDeviceName(connection_handler::DeviceHandle handle);
+
+ /*
+ * @brief Converts connection string transport type representation
+ * to HMI Common_TransportType
+ *
+ * @param transport_type String representing connection type
+ *
+ * @return Corresponding HMI TransporType value
+ */
+ hmi_apis::Common_TransportType::eType GetDeviceTransportType(
+ const std::string& transport_type);
+ /////////////////////////////////////////////////////
+
+ void set_hmi_message_handler(hmi_message_handler::HMIMessageHandler* handler);
+ void set_connection_handler(connection_handler::ConnectionHandler* handler);
+ void set_protocol_handler(protocol_handler::ProtocolHandler* handler);
+ ///////////////////////////////////////////////////////
+
+ void StartDevicesDiscovery();
+
+ // Put message to the queue to be sent to mobile.
+ // if |final_message| parameter is set connection to mobile will be closed
+ // after processing this message
+ void SendMessageToMobile(const commands::MessageSharedPtr message,
+ bool final_message = false) OVERRIDE;
+
+ /**
+ * @brief TerminateRequest forces termination of request
+ * @param connection_key - application id of request
+ * @param corr_id correlation id of request
+ */
+ void TerminateRequest(uint32_t connection_key, uint32_t corr_id);
+
+ bool ManageMobileCommand(
+ const commands::MessageSharedPtr message,
+ commands::Command::CommandOrigin origin = commands::Command::ORIGIN_SDL) OVERRIDE;
+ void SendMessageToHMI(const commands::MessageSharedPtr message) OVERRIDE;
+ bool ManageHMICommand(const commands::MessageSharedPtr message) OVERRIDE;
+
+ /////////////////////////////////////////////////////////
+ // Overriden ProtocolObserver method
+ void OnMessageReceived(
+ const ::protocol_handler::RawMessagePtr message) OVERRIDE;
+ void OnMobileMessageSent(
+ const ::protocol_handler::RawMessagePtr message) OVERRIDE;
+
+ // Overriden HMIMessageObserver method
+ void OnMessageReceived(
+ hmi_message_handler::MessageSharedPointer message) OVERRIDE;
+ void OnErrorSending(
+ hmi_message_handler::MessageSharedPointer message) OVERRIDE;
+
+ // Overriden ConnectionHandlerObserver method
+ void OnDeviceListUpdated(
+ const connection_handler::DeviceMap& device_list) OVERRIDE;
+ // TODO (EZamakhov): fix all indentations in this file
+ void OnFindNewApplicationsRequest() OVERRIDE;
+ void RemoveDevice(
+ const connection_handler::DeviceHandle& device_handle) OVERRIDE;
+ bool OnServiceStartedCallback(
+ const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type) OVERRIDE;
+ void OnServiceEndedCallback(
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type,
+ const connection_handler::CloseSessionReason& close_reason) OVERRIDE;
+
+#ifdef ENABLE_SECURITY
+ // Overriden SecurityManagerListener method
+ bool OnHandshakeDone(
+ uint32_t connection_key,
+ security_manager::SSLContext::HandshakeResult result) OVERRIDE FINAL;
+
+ void OnCertificateUpdateRequired() OVERRIDE FINAL;
+
+ security_manager::SSLContext::HandshakeContext GetHandshakeContext(
+ uint32_t key) const OVERRIDE FINAL;
+#endif // ENABLE_SECURITY
+ /**
+ * @ Add notification to collection
+ *
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
+ void addNotification(const CommandSharedPtr ptr);
+
+ /**
+ * @ Add notification to collection
+ *
+ * @param ptr Reference to shared pointer that point on hmi notification
+ */
+ void removeNotification(const commands::Command* notification);
+
+ /**
+ * @ Updates request timeout
+ *
+ * @param connection_key Connection key of application
+ * @param mobile_correlation_id Correlation ID of the mobile request
+ * @param new_timeout_value New timeout in milliseconds to be set
+ */
+ void updateRequestTimeout(uint32_t connection_key,
+ uint32_t mobile_correlation_id,
+ uint32_t new_timeout_value);
+
+ /*
+ * @brief Retrieves application id associated whith correlation id
+ *
+ * @param correlation_id Correlation ID of the HMI request
+ *
+ * @return application id associated whith correlation id
+ */
+ const uint32_t application_id(const int32_t correlation_id);
+
+ /*
+ * @brief Sets application id correlation id
+ *
+ * @param correlation_id Correlation ID of the HMI request
+ * @param app_id Application ID
+ */
+ void set_application_id(const int32_t correlation_id, const uint32_t app_id);
+ /**
+ * @brief AddPolicyObserver allows to subscribe needed component to events
+ * from policy.
+ *
+ * @param listener the component to subscribe.
+ */
+ void AddPolicyObserver(PolicyHandlerObserver* listener);
+
+ /**
+ * @brief RemovePolicyObserver allows to remove observer from collection.
+ *
+ * @param listener observer to remove.
+ */
+ void RemovePolicyObserver(PolicyHandlerObserver* listener);
+
+ /**
+ * @brief Checks HMI level and returns true if streaming is allowed
+ * @param app_id Application id
+ * @param service_type Service type to check
+ * @return True if streaming is allowed, false in other case
+ */
+ bool HMILevelAllowsStreaming(
+ uint32_t app_id, protocol_handler::ServiceType service_type) const;
+
+ /**
+ * @brief Checks if application can stream (streaming service is started and
+ * streaming is enabled in application)
+ * @param app_id Application id
+ * @param service_type Service type to check
+ * @return True if streaming is allowed, false in other case
+ */
+ bool CanAppStream(uint32_t app_id,
+ protocol_handler::ServiceType service_type) const;
+
+ /**
+ * @brief Ends opened navi services (audio/video) for application
+ * @param app_id Application id
+ */
+ void EndNaviServices(uint32_t app_id);
+
+ /**
+ * @brief ForbidStreaming forbid the stream over the certain application.
+ * @param app_id the application's id which should stop streaming.
+ */
+ void ForbidStreaming(uint32_t app_id);
+
+ /**
+ * @brief Callback calls when application starts/stops data streaming
+ * @param app_id Streaming application id
+ * @param service_type Streaming service type
+ * @param state Shows if streaming started or stopped
+ */
+ void OnAppStreaming(uint32_t app_id,
+ protocol_handler::ServiceType service_type,
+ bool state);
+
+ mobile_api::HMILevel::eType GetDefaultHmiLevel(
+ ApplicationConstSharedPtr application) const;
+
+ /**
+ * Getter for resume_controller
+ * @return Resume Controller
+ */
+ resumption::ResumeCtrl& resume_controller() {
+ return resume_ctrl_;
+ }
- /**
- * @brief method adds application
- * to tts_global_properties_app_list_
- * @param app_id contains application which will
- * send TTS global properties after timeout
- */
- void AddAppToTTSGlobalPropertiesList(const uint32_t app_id);
+ /**
+ * Generate grammar ID
+ *
+ * @return New grammar ID
+ */
+ uint32_t GenerateGrammarID();
+
+ /**
+ * Generate new HMI application ID
+ *
+ * @return New HMI application ID
+ */
+ uint32_t GenerateNewHMIAppID();
+
+ /**
+ * @brief Parse smartObject and replace mobile app Id by HMI app ID
+ *
+ * @param message Smartobject to be parsed
+ */
+ void ReplaceMobileByHMIAppId(smart_objects::SmartObject& message);
+
+ /**
+ * @brief Parse smartObject and replace HMI app ID by mobile app Id
+ *
+ * @param message Smartobject to be parsed
+ */
+ void ReplaceHMIByMobileAppId(smart_objects::SmartObject& message);
+
+ /*
+ * @brief Save binary data to specified directory
+ *
+ * @param binary data
+ * @param path for saving data
+ * @param file_name File name
+ * @param offset for saving data to existing file with offset.
+ * If offset is 0 - create new file ( overrite existing )
+ *
+ *
+ * @return SUCCESS if file was saved, other code otherwise
+ */
+ mobile_apis::Result::eType SaveBinary(const std::vector<uint8_t>& binary_data,
+ const std::string& file_path,
+ const std::string& file_name,
+ const int64_t offset);
+
+ /**
+ * @brief Get available app space
+ * @param name of the app folder(make + mobile app id)
+ * @return free app space.
+ */
+ uint32_t GetAvailableSpaceForApp(const std::string& folder_name);
+
+ /*
+ * @brief returns true if HMI is cooperating
+ */
+ bool IsHMICooperating() const;
+
+ /**
+ * @brief Method used to send default app tts globalProperties
+ * in case they were not provided from mobile side after defined time
+ */
+ void OnTimerSendTTSGlobalProperties();
+
+ /**
+ * @brief method adds application
+ * to tts_global_properties_app_list_
+ * @param app_id contains application which will
+ * send TTS global properties after timeout
+ */
+ void AddAppToTTSGlobalPropertiesList(const uint32_t app_id);
+
+ /**
+ * @brief method removes application
+ * from tts_global_properties_app_list_
+ * @param app_id contains application which will
+ * send TTS global properties after timeout
+ */
+ void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id);
+
+ /**
+ * @brief method adds application in FULL and LIMITED state
+ * to on_phone_call_app_list_.
+ * Also OnHMIStateNotification with BACKGROUND state sent for these apps
+ */
+ void CreatePhoneCallAppList();
+
+ /**
+ * @brief method removes application from on_phone_call_app_list_.
+ *
+ * Also OnHMIStateNotification with previous HMI state sent for these apps
+ */
+ void ResetPhoneCallAppList();
+
+ /**
+ * Function used only by HMI request/response/notification base classes
+ * to change HMI app id to Mobile app id and vice versa.
+ * Dot use it inside Core
+ */
+ ApplicationSharedPtr application_by_hmi_app(uint32_t hmi_app_id) const;
+ // TODO(AOleynik): Temporary added, to fix build. Should be reworked.
+ connection_handler::ConnectionHandler& connection_handler() const OVERRIDE;
+
+ /**
+ * @brief Checks, if given RPC is allowed at current HMI level for specific
+ * application in policy table
+ * @param policy_app_id Application id
+ * @param hmi_level Current HMI level of application
+ * @param function_id FunctionID of RPC
+ * @param params_permissions Permissions for RPC parameters (e.g.
+ * SubscribeVehicleData) defined in policy table
+ * @return SUCCESS, if allowed, otherwise result code of check
+ */
+ mobile_apis::Result::eType CheckPolicyPermissions(
+ const std::string& policy_app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::FunctionID::eType function_id,
+ const RPCParams& rpc_params,
+ CommandParametersPermissions* params_permissions = NULL);
+ /*
+ * @brief Function Should be called when Low Voltage is occured
+ */
+ void OnLowVoltage();
+
+ /*
+ * @brief Function Should be called when WakeUp occures after Low Voltage
+ */
+ void OnWakeUp();
+
+ /**
+ * @brief IsApplicationForbidden allows to distinguish if application is
+ * not allowed to register, because of spamming.
+ *
+ * @param connection_key the connection key ofthe required application
+ *
+ * @param mobile_app_id application's mobile(policy) identifier.
+ *
+ * @return true in case application is allowed to register, false otherwise.
+ */
+ bool IsApplicationForbidden(uint32_t connection_key,
+ const std::string& mobile_app_id);
+
+ struct ApplicationsAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) {
+ return lhs->app_id() < rhs->app_id();
+ }
+ };
- /**
- * @brief method removes application
- * from tts_global_properties_app_list_
- * @param app_id contains application which will
- * send TTS global properties after timeout
- */
- void RemoveAppFromTTSGlobalPropertiesList(const uint32_t app_id);
+ struct ApplicationsMobileAppIdSorter {
+ bool operator()(const ApplicationSharedPtr lhs,
+ const ApplicationSharedPtr rhs) {
+ if (lhs->mobile_app_id() == rhs->mobile_app_id()) {
+ return lhs->device() < rhs->device();
+ }
+ return lhs->mobile_app_id() < rhs->mobile_app_id();
+ }
+ };
- /**
- * @brief method adds application in FULL and LIMITED state
- * to on_phone_call_app_list_.
- * Also OnHMIStateNotification with BACKGROUND state sent for these apps
- */
- void CreatePhoneCallAppList();
+ // typedef for Applications list
+ typedef std::set<ApplicationSharedPtr, ApplicationsAppIdSorter> ApplictionSet;
- /**
- * @brief method removes application from on_phone_call_app_list_.
- *
- * Also OnHMIStateNotification with previous HMI state sent for these apps
- */
- void ResetPhoneCallAppList();
+ typedef std::multiset<ApplicationSharedPtr, ApplicationsMobileAppIdSorter>
+ AppsWaitRegistrationSet;
- /**
- * Function used only by HMI request/response/notification base classes
- * to change HMI app id to Mobile app id and vice versa.
- * Dot use it inside Core
- */
- ApplicationSharedPtr application_by_hmi_app(uint32_t hmi_app_id) const;
+ typedef std::set<std::string> ForbiddenApps;
+ // typedef for Applications list iterator
- // TODO(AOleynik): Temporary added, to fix build. Should be reworked.
- connection_handler::ConnectionHandler* connection_handler();
+ DataAccessor<AppsWaitRegistrationSet> apps_waiting_for_registration() const;
+ ApplicationConstSharedPtr waiting_app(const uint32_t hmi_id) const;
+ /**
+ * Class for thread-safe access to applications list
+ */
+ class ApplicationListAccessor : public DataAccessor<ApplicationSet> {
+ public:
/**
- * @brief Checks, if given RPC is allowed at current HMI level for specific
- * application in policy table
- * @param policy_app_id Application id
- * @param hmi_level Current HMI level of application
- * @param function_id FunctionID of RPC
- * @param params_permissions Permissions for RPC parameters (e.g.
- * SubscribeVehicleData) defined in policy table
- * @return SUCCESS, if allowed, otherwise result code of check
+ * @brief ApplicationListAccessor class constructor
*/
- mobile_apis::Result::eType CheckPolicyPermissions(
- const std::string& policy_app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::FunctionID::eType function_id,
- const RPCParams& rpc_params,
- CommandParametersPermissions* params_permissions = NULL);
- /*
- * @brief Function Should be called when Low Voltage is occured
- */
- void OnLowVoltage();
-
- /*
- * @brief Function Should be called when WakeUp occures after Low Voltage
- */
- void OnWakeUp();
-
- struct ApplicationsAppIdSorter {
- bool operator() (const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
- return lhs->app_id() < rhs->app_id();
- }
- };
+ ApplicationListAccessor()
+ : DataAccessor<ApplicationSet>(
+ ApplicationManagerImpl::instance()->applications_,
+ ApplicationManagerImpl::instance()->applications_list_lock_) {}
- struct ApplicationsMobileAppIdSorter {
- bool operator() (const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
-
- if (lhs->mobile_app_id() == rhs->mobile_app_id()) {
- return lhs->device() < rhs->device();
- }
- return lhs->mobile_app_id() < rhs->mobile_app_id();
- }
- };
-
- // typedef for Applications list
- typedef std::set<ApplicationSharedPtr,
- ApplicationsAppIdSorter> ApplictionSet;
-
- typedef std::multiset<ApplicationSharedPtr,
- ApplicationsMobileAppIdSorter> AppsWaitRegistrationSet;
-
- // typedef for Applications list iterator
- typedef ApplictionSet::iterator ApplictionSetIt;
-
- // typedef for Applications list const iterator
- typedef ApplictionSet::const_iterator ApplictionSetConstIt;
-
- DataAccessor<AppsWaitRegistrationSet> apps_waiting_for_registration() const;
- ApplicationConstSharedPtr waiting_app(const uint32_t hmi_id) const;
+ ~ApplicationListAccessor();
/**
- * Class for thread-safe access to applications list
+ * @brief thread-safe getter for applications
+ * @return applications list
*/
- class ApplicationListAccessor: public DataAccessor<ApplictionSet> {
- public:
-
- /**
- * @brief ApplicationListAccessor class constructor
- */
- ApplicationListAccessor() :
- DataAccessor<ApplictionSet>(ApplicationManagerImpl::instance()->applications_,
- ApplicationManagerImpl::instance()->applications_list_lock_) {
- }
-
- ~ApplicationListAccessor();
-
- /**
- * @brief thread-safe getter for applications
- * @return applications list
- */
- const ApplictionSet& applications() const {
- return GetData();
- }
+ const ApplicationSet& applications() const {
+ return GetData();
+ }
- ApplictionSetConstIt begin() {
- return applications().begin();
- }
+ ApplicationSetConstIt begin() {
+ return applications().begin();
+ }
- ApplictionSetConstIt end() {
- return applications().end();
- }
+ ApplicationSetConstIt end() {
+ return applications().end();
+ }
- template<class UnaryPredicate>
- ApplicationSharedPtr Find(UnaryPredicate finder) {
- ApplicationSharedPtr result;
- ApplictionSetConstIt it = std::find_if(begin(), end(), finder);
- if (it != end()) {
- result = *it;
- }
- return result;
+ template <class UnaryPredicate>
+ ApplicationSharedPtr Find(UnaryPredicate finder) {
+ ApplicationSharedPtr result;
+ ApplicationSetConstIt it = std::find_if(begin(), end(), finder);
+ if (it != end()) {
+ result = *it;
}
+ return result;
+ }
- template<class UnaryPredicate>
- std::vector<ApplicationSharedPtr> FindAll(UnaryPredicate finder) {
- std::vector<ApplicationSharedPtr> result;
- ApplictionSetConstIt it = std::find_if(begin(), end(), finder);
- while (it != end()) {
- result.push_back(*it);
- it = std::find_if(++it, end(), finder);
- }
- return result;
+ template <class UnaryPredicate>
+ std::vector<ApplicationSharedPtr> FindAll(UnaryPredicate finder) {
+ std::vector<ApplicationSharedPtr> result;
+ ApplicationSetConstIt it = std::find_if(begin(), end(), finder);
+ while (it != end()) {
+ result.push_back(*it);
+ it = std::find_if(++it, end(), finder);
}
+ return result;
+ }
- void Erase(ApplicationSharedPtr app_to_remove) {
- ApplicationManagerImpl::instance()->applications_.erase(app_to_remove);
- }
+ void Erase(ApplicationSharedPtr app_to_remove) {
+ ApplicationManagerImpl::instance()->applications_.erase(app_to_remove);
+ }
- void Insert(ApplicationSharedPtr app_to_insert) {
- ApplicationManagerImpl::instance()->applications_.insert(app_to_insert);
- }
+ void Insert(ApplicationSharedPtr app_to_insert) {
+ ApplicationManagerImpl::instance()->applications_.insert(app_to_insert);
+ }
- bool Empty() {
- return ApplicationManagerImpl::instance()->applications_.empty();
- }
+ bool Empty() {
+ return ApplicationManagerImpl::instance()->applications_.empty();
+ }
- private:
- DISALLOW_COPY_AND_ASSIGN(ApplicationListAccessor);
- };
+ private:
+ DISALLOW_COPY_AND_ASSIGN(ApplicationListAccessor);
+ };
- friend class ApplicationListAccessor;
+ friend class ApplicationListAccessor;
- struct AppIdPredicate {
- uint32_t app_id_;
- AppIdPredicate(uint32_t app_id): app_id_(app_id) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return app ? app_id_ == app->app_id() : false;
- }
- };
+ struct AppIdPredicate {
+ uint32_t app_id_;
+ AppIdPredicate(uint32_t app_id) : app_id_(app_id) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? app_id_ == app->app_id() : false;
+ }
+ };
- struct HmiAppIdPredicate {
- uint32_t hmi_app_id_;
- HmiAppIdPredicate(uint32_t hmi_app_id): hmi_app_id_(hmi_app_id) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return app ? hmi_app_id_ == app->hmi_app_id() : false;
- }
- };
-
- struct MobileAppIdPredicate {
- std::string policy_app_id_;
- MobileAppIdPredicate(const std::string& policy_app_id):
- policy_app_id_(policy_app_id) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return app ? policy_app_id_ == app->mobile_app_id() : false;
- }
- };
+ struct HmiAppIdPredicate {
+ uint32_t hmi_app_id_;
+ HmiAppIdPredicate(uint32_t hmi_app_id) : hmi_app_id_(hmi_app_id) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? hmi_app_id_ == app->hmi_app_id() : false;
+ }
+ };
+
+ struct MobileAppIdPredicate {
+ std::string policy_app_id_;
+ MobileAppIdPredicate(const std::string& policy_app_id)
+ : policy_app_id_(policy_app_id) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? policy_app_id_ == app->mobile_app_id() : false;
+ }
+ };
- struct SubscribedToButtonPredicate {
- mobile_apis::ButtonName::eType button_;
- SubscribedToButtonPredicate(mobile_apis::ButtonName::eType button)
+ struct SubscribedToButtonPredicate {
+ mobile_apis::ButtonName::eType button_;
+ SubscribedToButtonPredicate(mobile_apis::ButtonName::eType button)
: button_(button) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return app ? app->IsSubscribedToButton(button_) : false;
- }
- };
-
- struct AppV4DevicePredicate {
- connection_handler::DeviceHandle handle_;
- AppV4DevicePredicate(const connection_handler::DeviceHandle handle):
- handle_(handle) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return app ? handle_ == app->device() &&
- ProtocolVersion::kV4 == app->protocol_version() : false;
- }
- };
-
- struct DevicePredicate {
- connection_handler::DeviceHandle handle_;
- DevicePredicate(const connection_handler::DeviceHandle handle):
- handle_(handle) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return handle_ == app->device() ? true : false;
- }
- };
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? app->IsSubscribedToButton(button_) : false;
+ }
+ };
+
+ struct AppV4DevicePredicate {
+ connection_handler::DeviceHandle handle_;
+ AppV4DevicePredicate(const connection_handler::DeviceHandle handle)
+ : handle_(handle) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app
+ ? handle_ == app->device() &&
+ ProtocolVersion::kV4 == app->protocol_version()
+ : false;
+ }
+ };
+
+ struct DevicePredicate {
+ connection_handler::DeviceHandle handle_;
+ DevicePredicate(const connection_handler::DeviceHandle handle)
+ : handle_(handle) {}
+ bool operator()(const ApplicationSharedPtr app) const {
+ return handle_ == app->device() ? true : false;
+ }
+ };
- struct SubscribedToIVIPredicate {
- int32_t vehicle_info_;
- SubscribedToIVIPredicate(int32_t vehicle_info)
+ struct SubscribedToIVIPredicate {
+ int32_t vehicle_info_;
+ SubscribedToIVIPredicate(int32_t vehicle_info)
: vehicle_info_(vehicle_info) {}
- bool operator () (const ApplicationSharedPtr app) const {
- return app ? app->IsSubscribedToIVI(vehicle_info_) : false;
- }
- };
-
- /**
- * @brief Sends UpdateAppList notification to HMI
- */
- void SendUpdateAppList();
-
- /**
- * @brief Marks applications received through QueryApps as should be
- * greyed out on HMI
- * @param is_greyed_out, true, if should be greyed out, otherwise - false
- * @param handle, device handle
- */
- void MarkAppsGreyOut(const connection_handler::DeviceHandle handle,
- bool is_greyed_out);
-
- /**
- * @brief Checks, if apps list had been queried already from certain device
- * @param handle, Device handle
- * @return true, if list had been queried already, otherwise - false
- */
- bool IsAppsQueriedFrom(const connection_handler::DeviceHandle handle) const;
-
- bool IsStopping() const {
- return is_stopping_;
+ bool operator()(const ApplicationSharedPtr app) const {
+ return app ? app->IsSubscribedToIVI(vehicle_info_) : false;
}
+ };
+
+ /**
+ * @brief Sends UpdateAppList notification to HMI
+ */
+ void SendUpdateAppList();
+
+ /**
+ * @brief Marks applications received through QueryApps as should be
+ * greyed out on HMI
+ * @param is_greyed_out, true, if should be greyed out, otherwise - false
+ * @param handle, device handle
+ */
+ void MarkAppsGreyOut(const connection_handler::DeviceHandle handle,
+ bool is_greyed_out);
+
+ /**
+ * @brief Checks, if apps list had been queried already from certain device
+ * @param handle, Device handle
+ * @return true, if list had been queried already, otherwise - false
+ */
+ bool IsAppsQueriedFrom(const connection_handler::DeviceHandle handle) const;
+
+ bool IsStopping() const {
+ return is_stopping_;
+ }
- private:
- /**
- * @brief PullLanguagesInfo allows to pull information about languages.
- *
- * @param app_data entry to parse
- *
- * @param ttsName tts name that should be filled.
- * @param vrSynonym vr synonymus that should be filled.
- */
- void PullLanguagesInfo(const smart_objects::SmartObject& app_data,
- smart_objects::SmartObject& ttsName,
- smart_objects::SmartObject& vrSynonym);
-
- ApplicationManagerImpl();
-
- /**
- * @brief Method transforms string to AppHMIType
- * @param str contains string AppHMIType
- * @return enum AppHMIType
- */
- mobile_apis::AppHMIType::eType StringToAppHMIType(std::string str);
-
- /**
- * @brief Method compares arrays of app HMI type
- * @param from_policy contains app HMI type from policy
- * @param from_application contains app HMI type from application
- * @return return TRUE if arrays of appHMIType equal, otherwise return FALSE
- */
- bool CompareAppHMIType (const smart_objects::SmartObject& from_policy,
- const smart_objects::SmartObject& from_application);
-
- hmi_apis::HMI_API& hmi_so_factory();
- mobile_apis::MOBILE_API& mobile_so_factory();
-
- bool ConvertMessageToSO(const Message& message,
- smart_objects::SmartObject& output);
- bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
- Message& output);
- utils::SharedPtr<Message> ConvertRawMsgToMessage(
+ private:
+ /**
+ * @brief PullLanguagesInfo allows to pull information about languages.
+ *
+ * @param app_data entry to parse
+ *
+ * @param ttsName tts name that should be filled.
+ * @param vrSynonym vr synonymus that should be filled.
+ */
+ void PullLanguagesInfo(const smart_objects::SmartObject& app_data,
+ smart_objects::SmartObject& ttsName,
+ smart_objects::SmartObject& vrSynonym);
+
+ ApplicationManagerImpl();
+
+ /**
+ * @brief Method transforms string to AppHMIType
+ * @param str contains string AppHMIType
+ * @return enum AppHMIType
+ */
+ mobile_apis::AppHMIType::eType StringToAppHMIType(std::string str);
+
+ /**
+ * @brief Method compares arrays of app HMI type
+ * @param from_policy contains app HMI type from policy
+ * @param from_application contains app HMI type from application
+ * @return return TRUE if arrays of appHMIType equal, otherwise return FALSE
+ */
+ bool CompareAppHMIType(const smart_objects::SmartObject& from_policy,
+ const smart_objects::SmartObject& from_application);
+
+ hmi_apis::HMI_API& hmi_so_factory();
+ mobile_apis::MOBILE_API& mobile_so_factory();
+
+ bool ConvertMessageToSO(const Message& message,
+ smart_objects::SmartObject& output);
+ bool ConvertSOtoMessage(const smart_objects::SmartObject& message,
+ Message& output);
+ utils::SharedPtr<Message> ConvertRawMsgToMessage(
const ::protocol_handler::RawMessagePtr message);
- void ProcessMessageFromMobile(const utils::SharedPtr<Message> message);
- void ProcessMessageFromHMI(const utils::SharedPtr<Message> message);
-
- // threads::MessageLoopThread<*>::Handler implementations
- /*
- * @brief Handles for threads pumping different types
- * of messages. Beware, each is called on different thread!
- */
- // CALLED ON messages_from_mobile_ thread!
- virtual void Handle(const impl::MessageFromMobile message) OVERRIDE;
-
- // CALLED ON messages_to_mobile_ thread!
- virtual void Handle(const impl::MessageToMobile message) OVERRIDE;
-
- // CALLED ON messages_from_hmi_ thread!
- virtual void Handle(const impl::MessageFromHmi message) OVERRIDE;
-
- // CALLED ON messages_to_hmi_ thread!
- virtual void Handle(const impl::MessageToHmi message) OVERRIDE;
-
- // CALLED ON audio_pass_thru_messages_ thread!
- virtual void Handle(const impl::AudioData message) OVERRIDE;
-
- template<typename ApplicationList>
- void PrepareApplicationListSO(ApplicationList app_list,
- smart_objects::SmartObject& applications) {
- CREATE_LOGGERPTR_LOCAL(logger_, "ApplicatinManagerImpl");
-
- smart_objects::SmartArray* app_array = applications.asArray();
- uint32_t app_count = NULL == app_array ? 0 : app_array->size();
- typename ApplicationList::const_iterator it;
- for (it = app_list.begin(); it != app_list.end(); ++it) {
- if (!it->valid()) {
- LOG4CXX_ERROR(logger_, "Application not found ");
- continue;
- }
-
- smart_objects::SmartObject hmi_application(smart_objects::SmartType_Map);;
- if (MessageHelper::CreateHMIApplicationStruct(*it, hmi_application)) {
- applications[app_count++] = hmi_application;
- } else {
- LOG4CXX_DEBUG(logger_, "Can't CreateHMIApplicationStruct ");
- }
+ void ProcessMessageFromMobile(const utils::SharedPtr<Message> message);
+ void ProcessMessageFromHMI(const utils::SharedPtr<Message> message);
+
+ // threads::MessageLoopThread<*>::Handler implementations
+ /*
+ * @brief Handles for threads pumping different types
+ * of messages. Beware, each is called on different thread!
+ */
+ // CALLED ON messages_from_mobile_ thread!
+ void Handle(const impl::MessageFromMobile message) OVERRIDE;
+
+ // CALLED ON messages_to_mobile_ thread!
+ void Handle(const impl::MessageToMobile message) OVERRIDE;
+
+ // CALLED ON messages_from_hmi_ thread!
+ void Handle(const impl::MessageFromHmi message) OVERRIDE;
+
+ // CALLED ON messages_to_hmi_ thread!
+ void Handle(const impl::MessageToHmi message) OVERRIDE;
+
+ // CALLED ON audio_pass_thru_messages_ thread!
+ void Handle(const impl::AudioData message) OVERRIDE;
+
+ template <typename ApplicationList>
+ void PrepareApplicationListSO(ApplicationList app_list,
+ smart_objects::SmartObject& applications) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "ApplicationManager");
+
+ smart_objects::SmartArray* app_array = applications.asArray();
+ uint32_t app_count = NULL == app_array ? 0 : app_array->size();
+ typename ApplicationList::const_iterator it;
+ for (it = app_list.begin(); it != app_list.end(); ++it) {
+ if (!it->valid()) {
+ LOG4CXX_ERROR(logger_, "Application not found ");
+ continue;
}
- if (0 == app_count) {
- LOG4CXX_WARN(logger_, "Empty applications list");
+ smart_objects::SmartObject hmi_application(smart_objects::SmartType_Map);
+ const protocol_handler::SessionObserver& session_observer =
+ connection_handler().get_session_observer();
+ if (MessageHelper::CreateHMIApplicationStruct(
+ *it, session_observer, &hmi_application)) {
+ applications[app_count++] = hmi_application;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Can't CreateHMIApplicationStruct ");
}
}
- void OnApplicationListUpdateTimer();
-
- /**
- * @brief CreateApplications creates aplpication adds it to application list
- * and prepare data for sending AppIcon request.
- *
- * @param obj_array applications array.
- *
- * @param connection_key connection key of app, which provided app list to
- * be created
- */
- void CreateApplications(smart_objects::SmartArray& obj_array,
- const uint32_t connection_key);
-
- /*
- * @brief Function is called on IGN_OFF, Master_reset or Factory_defaults
- * to notify HMI that SDL is shutting down.
- */
- void SendOnSDLClose();
-
- /*
- * @brief returns true if low voltage state is active
- */
- bool IsLowVoltage();
-
- private:
- /*
- * NaviServiceStatusMap shows which navi service (audio/video) is opened
- * for specified application. Two bool values in std::pair mean:
- * 1st value - is video service opened or not
- * 2nd value - is audio service opened or not
- */
- typedef std::map<uint32_t, std::pair<bool, bool> > NaviServiceStatusMap;
-
- typedef SharedPtr<TimerThread<ApplicationManagerImpl> > ApplicationManagerTimerPtr;
-
- /**
- * @brief Removes suspended and stopped timers from timer pool
- */
- void ClearTimerPool();
-
- /**
- * @brief CloseNaviApp allows to unregister application in case the EndServiceEndedAck
- * didn't come for at least one of services(audio or video)
- */
- void CloseNaviApp();
-
- /**
- * @brief Suspends streaming ability of application in case application's HMI level
- * has been changed to not allowed for streaming
- */
- void EndNaviStreaming();
-
- /**
- * @brief Starts specified navi service for application
- * @param app_id Application to proceed
- * @param service_type Type of service to start
- * @return True on success, false on fail
- */
- bool StartNaviService(
- uint32_t app_id, protocol_handler::ServiceType service_type);
-
- /**
- * @brief Stops specified navi service for application
- * @param app_id Application to proceed
- * @param service_type Type of service to stop
- */
- void StopNaviService(
- uint32_t app_id, protocol_handler::ServiceType service_type);
-
- /**
- * @brief Allows streaming for application if it was disallowed by
- * DisallowStreaming()
- * @param app_id Application to proceed
- */
- void AllowStreaming(uint32_t app_id);
-
- /**
- * @brief Disallows streaming for application, but doesn't close
- * opened services. Streaming ability could be restored by AllowStreaming();
- * @param app_id Application to proceed
- */
- void DisallowStreaming(uint32_t app_id);
-
- /**
- * @brief Function returns supported SDL Protocol Version
- * @return protocol version depends on parameters from smartDeviceLink.ini.
- */
- ProtocolVersion SupportedSDLVersion() const;
-
- /**
- * @brief Types of directories used by Application Manager
- */
- enum DirectoryType {
- TYPE_STORAGE,
- TYPE_SYSTEM,
- TYPE_ICONS
- };
-
- typedef std::map<DirectoryType, std::string> DirectoryTypeMap;
- DirectoryTypeMap dir_type_to_string_map_;
-
- /**
- * @brief Converts directory type to string
- * @param type Directory type
- * @return Stringified type
- */
- const std::string DirectoryTypeToString(DirectoryType type) const;
-
- /**
- * @brief Creates directory path, if necessary
- * @param path Directory path
- * @param type Directory type
- * @return true, if succedeed, otherwise - false
- */
- bool InitDirectory(const std::string& path, DirectoryType type) const;
-
- /**
- * @brief Checks, whether r/w permissions are present for particular path
- * @param path Directory path
- * @param type Directory type
- * @return true, if allowed, otherwise - false
- */
- bool IsReadWriteAllowed(const std::string& path, DirectoryType type) const;
-
- /**
- * @brief Removes apps, waiting for registration related to
- * certain device handle
- * @param handle, Device handle
- */
- void RemoveAppsWaitingForRegistration(
- const connection_handler::DeviceHandle handle);
-
- /**
- * @brief Clears TTS global properties list of apps
- */
- void ClearTTSGlobalPropertiesList();
-
- private:
- /**
- * @brief List of applications
- */
- ApplictionSet applications_;
- AppsWaitRegistrationSet apps_to_register_;
-
- // Lock for applications list
- mutable sync_primitives::Lock applications_list_lock_;
- mutable sync_primitives::Lock apps_to_register_list_lock_;
-
- /**
- * @brief Map of correlation id and associated application id.
- */
- std::map<const int32_t, const uint32_t> appID_list_;
-
- /**
- * @brief Map contains applications which
- * will send TTS global properties to HMI after timeout
- */
- std::map<uint32_t, TimevalStruct> tts_global_properties_app_list_;
-
- bool audio_pass_thru_active_;
- sync_primitives::Lock audio_pass_thru_lock_;
- sync_primitives::Lock tts_global_properties_app_list_lock_;
- bool is_distracting_driver_;
- bool is_vr_session_strated_;
- bool hmi_cooperating_;
- bool is_all_apps_allowed_;
- media_manager::MediaManager* media_manager_;
-
- hmi_message_handler::HMIMessageHandler* hmi_handler_;
- connection_handler::ConnectionHandler* connection_handler_;
- protocol_handler::ProtocolHandler* protocol_handler_;
- request_controller::RequestController request_ctrl_;
-
- hmi_apis::HMI_API* hmi_so_factory_;
- mobile_apis::MOBILE_API* mobile_so_factory_;
-
- static uint32_t corelation_id_;
- static const uint32_t max_corelation_id_;
-
-
- // Construct message threads when everything is already created
-
- // Thread that pumps messages coming from mobile side.
- impl::FromMobileQueue messages_from_mobile_;
- // Thread that pumps messages being passed to mobile side.
- impl::ToMobileQueue messages_to_mobile_;
- // Thread that pumps messages coming from HMI.
- impl::FromHmiQueue messages_from_hmi_;
- // Thread that pumps messages being passed to HMI.
- impl::ToHmiQueue messages_to_hmi_;
- // Thread that pumps messages audio pass thru to mobile.
- impl::AudioPassThruQueue audio_pass_thru_messages_;
-
-
- HMICapabilities hmi_capabilities_;
- // The reason of HU shutdown
- mobile_api::AppInterfaceUnregisteredReason::eType unregister_reason_;
-
- /**
- * @brief Resume controler is responcible for save and load information
- * about persistent application data on disk, and save session ID for resuming
- * application in case INGITION_OFF or MASTER_RESSET
- */
- ResumeCtrl resume_ctrl_;
-
- NaviServiceStatusMap navi_service_status_;
- std::deque<uint32_t> navi_app_to_stop_;
- std::deque<uint32_t> navi_app_to_end_stream_;
- uint32_t navi_close_app_timeout_;
- uint32_t navi_end_stream_timeout_;
-
- std::vector<ApplicationManagerTimerPtr> timer_pool_;
- sync_primitives::Lock timer_pool_lock_;
- sync_primitives::Lock stopping_flag_lock_;
-
- StateController state_ctrl_;
-
-#ifdef TIME_TESTER
- AMMetricObserver* metric_observer_;
-#endif // TIME_TESTER
-
- class ApplicationListUpdateTimer : public timer::TimerThread<ApplicationManagerImpl> {
- public:
- ApplicationListUpdateTimer(ApplicationManagerImpl* callee) :
- timer::TimerThread<ApplicationManagerImpl>("AM ListUpdater",
- callee, &ApplicationManagerImpl::OnApplicationListUpdateTimer) {
- }
- };
- typedef utils::SharedPtr<ApplicationListUpdateTimer> ApplicationListUpdateTimerSptr;
- ApplicationListUpdateTimerSptr application_list_update_timer_;
-
- timer::TimerThread<ApplicationManagerImpl> tts_global_properties_timer_;
-
- bool is_low_voltage_;
- volatile bool is_stopping_;
-
- DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl);
+ if (0 == app_count) {
+ LOG4CXX_WARN(logger_, "Empty applications list");
+ }
+ }
- FRIEND_BASE_SINGLETON_CLASS(ApplicationManagerImpl);
+ void ClearTTSGlobalPropertiesList();
+
+ void OnApplicationListUpdateTimer();
+
+ /**
+ * @brief CreateApplications creates aplpication adds it to application list
+ * and prepare data for sending AppIcon request.
+ *
+ * @param obj_array applications array.
+ *
+ * @param connection_key connection key of app, which provided app list to
+ * be created
+ */
+ void CreateApplications(smart_objects::SmartArray& obj_array,
+ const uint32_t connection_key);
+
+ /*
+ * @brief Function is called on IGN_OFF, Master_reset or Factory_defaults
+ * to notify HMI that SDL is shutting down.
+ */
+ void SendOnSDLClose();
+
+ /*
+ * @brief returns true if low voltage state is active
+ */
+ bool IsLowVoltage();
+
+ private:
+ /*
+ * NaviServiceStatusMap shows which navi service (audio/video) is opened
+ * for specified application. Two bool values in std::pair mean:
+ * 1st value - is video service opened or not
+ * 2nd value - is audio service opened or not
+ */
+ typedef std::map<uint32_t, std::pair<bool, bool>> NaviServiceStatusMap;
+
+typedef utils::SharedPtr<timer::Timer> TimerSPtr;
+ /**
+ * @brief GetHashedAppID allows to obtain unique application id as a string.
+ * It concatenates device mac and application id to obtain unique id.
+ *
+ * @param connection_key connection key for which need to obtain device mac;
+ *
+ * @param mobile_app_id mobile(policy) application id on particular device.
+ * This parameter will be concatenated with device id.
+ *
+ * @return unique aplication identifier.
+ */
+ std::string GetHashedAppID(uint32_t connection_key,
+ const std::string& mobile_app_id);
+
+ /**
+ * @brief Removes suspended and stopped timers from timer pool
+ */
+ void ClearTimerPool();
+
+ /**
+ * @brief CloseNaviApp allows to unregister application in case the
+ * EndServiceEndedAck
+ * didn't come for at least one of services(audio or video)
+ */
+ void CloseNaviApp();
+
+ /**
+ * @brief Suspends streaming ability of application in case application's HMI
+ * level
+ * has been changed to not allowed for streaming
+ */
+ void EndNaviStreaming();
+
+ /**
+ * @brief Starts specified navi service for application
+ * @param app_id Application to proceed
+ * @param service_type Type of service to start
+ * @return True on success, false on fail
+ */
+ bool StartNaviService(uint32_t app_id,
+ protocol_handler::ServiceType service_type);
+
+ /**
+ * @brief Stops specified navi service for application
+ * @param app_id Application to proceed
+ * @param service_type Type of service to stop
+ */
+ void StopNaviService(uint32_t app_id,
+ protocol_handler::ServiceType service_type);
+
+ /**
+ * @brief Allows streaming for application if it was disallowed by
+ * DisallowStreaming()
+ * @param app_id Application to proceed
+ */
+ void AllowStreaming(uint32_t app_id);
+
+ /**
+ * @brief Disallows streaming for application, but doesn't close
+ * opened services. Streaming ability could be restored by AllowStreaming();
+ * @param app_id Application to proceed
+ */
+ void DisallowStreaming(uint32_t app_id);
+
+ /**
+ * @brief Function returns supported SDL Protocol Version
+ * @return protocol version depends on parameters from smartDeviceLink.ini.
+ */
+ ProtocolVersion SupportedSDLVersion() const;
+
+ /**
+ * @brief Types of directories used by Application Manager
+ */
+ enum DirectoryType { TYPE_STORAGE, TYPE_SYSTEM, TYPE_ICONS };
+
+ typedef std::map<DirectoryType, std::string> DirectoryTypeMap;
+ DirectoryTypeMap dir_type_to_string_map_;
+
+ /**
+ * @brief Converts directory type to string
+ * @param type Directory type
+ * @return Stringified type
+ */
+ const std::string DirectoryTypeToString(DirectoryType type) const;
+
+ /**
+ * @brief Creates directory path, if necessary
+ * @param path Directory path
+ * @param type Directory type
+ * @return true, if succedeed, otherwise - false
+ */
+ bool InitDirectory(const std::string& path, DirectoryType type) const;
+
+ /**
+ * @brief Checks, whether r/w permissions are present for particular path
+ * @param path Directory path
+ * @param type Directory type
+ * @return true, if allowed, otherwise - false
+ */
+ bool IsReadWriteAllowed(const std::string& path, DirectoryType type) const;
+
+ /**
+ * @brief Removes apps, waiting for registration related to
+ * certain device handle
+ * @param handle, Device handle
+ */
+ void RemoveAppsWaitingForRegistration(
+ const connection_handler::DeviceHandle handle);
+
+ private:
+ /**
+ * @brief List of applications
+ */
+ ApplicationSet applications_;
+ AppsWaitRegistrationSet apps_to_register_;
+ ForbiddenApps forbidden_applications;
+
+ // Lock for applications list
+ mutable sync_primitives::Lock applications_list_lock_;
+ mutable sync_primitives::Lock apps_to_register_list_lock_;
+
+ /**
+ * @brief Map of correlation id and associated application id.
+ */
+ std::map<const int32_t, const uint32_t> appID_list_;
+
+ /**
+ * @brief Map contains applications which
+ * will send TTS global properties to HMI after timeout
+ */
+ std::map<uint32_t, TimevalStruct> tts_global_properties_app_list_;
+
+ bool audio_pass_thru_active_;
+ sync_primitives::Lock audio_pass_thru_lock_;
+ sync_primitives::Lock tts_global_properties_app_list_lock_;
+ bool is_distracting_driver_;
+ bool is_vr_session_strated_;
+ bool hmi_cooperating_;
+ bool is_all_apps_allowed_;
+ media_manager::MediaManager* media_manager_;
+
+ hmi_message_handler::HMIMessageHandler* hmi_handler_;
+ connection_handler::ConnectionHandler* connection_handler_;
+ protocol_handler::ProtocolHandler* protocol_handler_;
+ request_controller::RequestController request_ctrl_;
+
+ hmi_apis::HMI_API* hmi_so_factory_;
+ mobile_apis::MOBILE_API* mobile_so_factory_;
+
+ static uint32_t corelation_id_;
+ static const uint32_t max_corelation_id_;
+
+ // Construct message threads when everything is already created
+
+ // Thread that pumps messages coming from mobile side.
+ impl::FromMobileQueue messages_from_mobile_;
+ // Thread that pumps messages being passed to mobile side.
+ impl::ToMobileQueue messages_to_mobile_;
+ // Thread that pumps messages coming from HMI.
+ impl::FromHmiQueue messages_from_hmi_;
+ // Thread that pumps messages being passed to HMI.
+ impl::ToHmiQueue messages_to_hmi_;
+ // Thread that pumps messages audio pass thru to mobile.
+ impl::AudioPassThruQueue audio_pass_thru_messages_;
+
+ HMICapabilities hmi_capabilities_;
+ // The reason of HU shutdown
+ mobile_api::AppInterfaceUnregisteredReason::eType unregister_reason_;
+
+ /**
+ * @brief Resume controler is responcible for save and load information
+ * about persistent application data on disk, and save session ID for resuming
+ * application in case INGITION_OFF or MASTER_RESSET
+ */
+ resumption::ResumeCtrl resume_ctrl_;
+
+ NaviServiceStatusMap navi_service_status_;
+ std::deque<uint32_t> navi_app_to_stop_;
+ std::deque<uint32_t> navi_app_to_end_stream_;
+ uint32_t navi_close_app_timeout_;
+ uint32_t navi_end_stream_timeout_;
+
+ std::vector<TimerSPtr> timer_pool_;
+ sync_primitives::Lock timer_pool_lock_;
+ sync_primitives::Lock stopping_flag_lock_;
+ StateController state_ctrl_;
+
+#ifdef TELEMETRY_MONITOR
+ AMTelemetryObserver* metric_observer_;
+#endif // TELEMETRY_MONITOR
+
+ Timer application_list_update_timer_;
+
+ Timer tts_global_properties_timer_;
+
+ bool is_low_voltage_;
+ volatile bool is_stopping_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApplicationManagerImpl);
+ FRIEND_BASE_SINGLETON_CLASS(ApplicationManagerImpl);
};
bool ApplicationManagerImpl::vr_session_started() const {
@@ -1425,6 +1508,7 @@ bool ApplicationManagerImpl::driver_distraction() const {
inline bool ApplicationManagerImpl::all_apps_allowed() const {
return is_all_apps_allowed_;
}
+
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_
diff --git a/src/components/application_manager/include/application_manager/application_state.h b/src/components/application_manager/include/application_manager/application_state.h
new file mode 100644
index 0000000000..bf894eaf94
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/application_state.h
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
+#include <vector>
+#include "utils/lock.h"
+#include "utils/macro.h"
+#include "application_manager/hmi_state.h"
+
+namespace application_manager {
+
+typedef std::vector<HmiStatePtr> HmiStates;
+
+/*
+ * Class represents application state, i.e. current HMI level, audio streaming
+ * state and context
+ * Current implementation:
+ * - has regular state, which is default or base state
+ * - temporary states can be applied on top of regular state
+ * - on temporary state end it is being removed from states list
+ * - current state is the consolidated state of all the states, since different
+ * temporary state can affect one or more parameters (HMI state, audio, context)
+ * - can have postponed state (comes from resumption process), which is
+ * not applied on top, but is being added before base and can replace base later
+ * on
+ */
+class ApplicationState {
+ public:
+ /**
+ * @brief ApplicationState constructor
+ */
+ ApplicationState();
+
+ /**
+ * @brief Init state
+ * @param state Initial state
+ */
+ void InitState(HmiStatePtr state);
+
+ /**
+ * @brief Adds state to states storage
+ * @param state State of application
+ */
+ void AddState(HmiStatePtr state);
+
+ /**
+ * @brief Removes state from states storage
+ * @param state State of application
+ */
+ void RemoveState(HmiState::StateID state);
+
+ /**
+ * @brief Gets state by state id
+ * @param state_id State id
+ * @return Pointer to application state
+ */
+ HmiStatePtr GetState(HmiState::StateID state_id) const;
+
+ private:
+ /**
+ * @brief AddHMIState the function that will change application's
+ * hmi state.
+ *
+ * @param app_id id of the application whose hmi level should be changed.
+ *
+ * @param state new hmi state for certain application.
+ */
+ void AddHMIState(HmiStatePtr state);
+
+ /**
+ * @brief RemoveHMIState the function that will turn back hmi_level after end
+ * of some event
+ *
+ * @param app_id id of the application whose hmi level should be changed.
+ *
+ * @param state_id that should be removed
+ */
+ void RemoveHMIState(HmiState::StateID state_id);
+
+ /**
+ * @brief Removes postponed state
+ */
+ void RemovePostponedState();
+
+ /**
+ * @brief Sets regular state of application
+ * @param state State of application
+ */
+ void SetRegularState(HmiStatePtr state);
+
+ /**
+ * @brief Sets postponed state of application.
+ * This state could be set as regular later on
+ *
+ * @param state state to setup
+ */
+ void SetPostponedState(HmiStatePtr state);
+
+ /**
+ * @brief HmiState of application within active events PhoneCall, TTS< etc ...
+ * @return Active HmiState of application
+ */
+ HmiStatePtr CurrentHmiState() const;
+
+ /**
+ * @brief RegularHmiState of application without active events VR, TTS etc ...
+ * @return HmiState of application
+ */
+ HmiStatePtr RegularHmiState() const;
+
+ /**
+ * @brief PostponedHmiState returns postponed hmi state of application
+ * if it's present
+ *
+ * @return Postponed hmi state of application
+ */
+ HmiStatePtr PostponedHmiState() const;
+
+ /**
+ * @brief Active states of application
+ */
+ HmiStates hmi_states_;
+ mutable sync_primitives::Lock hmi_states_lock_;
+
+ DISALLOW_COPY_AND_ASSIGN(ApplicationState);
+};
+}
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_APPLICATION_STATE_H_
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 0401a3bf46..164871e1af 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
@@ -50,19 +50,14 @@ namespace commands {
namespace NsSmart = NsSmartDeviceLink::NsSmartObjects;
class CommandRequestImpl : public CommandImpl,
- public event_engine::EventObserver {
+ public event_engine::EventObserver {
public:
-
- enum RequestState {
- kAwaitingHMIResponse = 0,
- kTimedOut,
- kCompleted
- };
+ enum RequestState { kAwaitingHMIResponse = 0, kTimedOut, kCompleted };
explicit CommandRequestImpl(const MessageSharedPtr& message);
virtual ~CommandRequestImpl();
virtual bool CheckPermissions();
- virtual bool Init();
+ virtual bool Init();
virtual bool CleanUp();
virtual void Run();
@@ -99,7 +94,7 @@ class CommandRequestImpl : public CommandImpl,
* @param allow_empty_string if true methods allow empty sting
* @return true if success otherwise return false
*/
- bool CheckSyntax(std::string str, bool allow_empty_line = false);
+ bool CheckSyntax(const std::string& str, bool allow_empty_line = false);
/*
* @brief Sends HMI request
@@ -110,8 +105,8 @@ class CommandRequestImpl : public CommandImpl,
* @return hmi correlation id
*/
uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id,
- const smart_objects::SmartObject* msg_params = NULL,
- bool use_events = false);
+ const smart_objects::SmartObject* msg_params = NULL,
+ bool use_events = false);
/*
* @brief Creates HMI request
@@ -131,8 +126,7 @@ class CommandRequestImpl : public CommandImpl,
mobile_apis::Result::eType GetMobileResultCode(
const hmi_apis::Common_Result::eType& hmi_code) const;
-protected:
-
+ protected:
/**
* @brief Checks message permissions and parameters according to policy table
* permissions
@@ -161,14 +155,13 @@ protected:
bool HasDisallowedParams() const;
protected:
- RequestState current_state_;
- sync_primitives::Lock state_lock_;
- CommandParametersPermissions parameters_permissions_;
+ RequestState current_state_;
+ sync_primitives::Lock state_lock_;
+ CommandParametersPermissions parameters_permissions_;
private:
DISALLOW_COPY_AND_ASSIGN(CommandRequestImpl);
-
/**
* @brief Adds param to disallowed parameters enumeration
* @param info string with disallowed params enumeration
@@ -181,7 +174,8 @@ protected:
* @brief Adds disallowed parameters to response info
* @param response Response message, which info should be extended
*/
- void AddDisallowedParametersToInfo(smart_objects::SmartObject& response) const;
+ void AddDisallowedParametersToInfo(
+ smart_objects::SmartObject& response) const;
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_play_tone_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h
index ceba0528fa..59ad705e80 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_play_tone_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_request.h
@@ -30,31 +30,32 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PLAY_TONE_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PLAY_TONE_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_DIAL_NUMBER_REQUEST_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_DIAL_NUMBER_REQUEST_H_
-#include "application_manager/commands/hmi/notification_to_hmi.h"
+#include "application_manager/commands/hmi/request_to_hmi.h"
namespace application_manager {
namespace commands {
+namespace hmi {
/**
- * @brief OnPlayToneNotification command class
+ * @brief DialNumberRequest command class
**/
-class OnPlayToneNotification : public NotificationToHMI {
+class DialNumberRequest : public RequestToHMI {
public:
/**
- * @brief OnPlayToneNotification class constructor
+ * @brief DialNumberRequest class constructor
*
* @param message Incoming SmartObject message
**/
- explicit OnPlayToneNotification(const MessageSharedPtr& message);
+ explicit DialNumberRequest(const MessageSharedPtr& message);
/**
- * @brief OnPlayToneNotification class destructor
+ * @brief DialNumberRequest class destructor
**/
- virtual ~OnPlayToneNotification();
+ virtual ~DialNumberRequest();
/**
* @brief Execute command
@@ -62,11 +63,13 @@ class OnPlayToneNotification : public NotificationToHMI {
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(OnPlayToneNotification);
+ DISALLOW_COPY_AND_ASSIGN(DialNumberRequest);
};
+} // namespace hmi
+
} // namespace commands
} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PLAY_TONE_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_DIAL_NUMBER_REQUEST_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h
index 45d831eb03..d6c1401783 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_phone_call_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/dial_number_response.h
@@ -30,10 +30,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_DIAL_NUMBER_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_DIAL_NUMBER_RESPONSE_H_
-#include "application_manager/commands/hmi/notification_from_hmi.h"
+#include "application_manager/commands/hmi/response_from_hmi.h"
namespace application_manager {
@@ -41,23 +41,22 @@ namespace commands {
namespace hmi {
-
/**
- * @brief OnPhoneCallNotification command class
+ * @brief DialNumberResponse command class
**/
-class OnPhoneCallNotification : public NotificationFromHMI {
+class DialNumberResponse : public ResponseFromHMI {
public:
/**
- * @brief OnPhoneCallNotification class constructor
+ * @brief DialNumberResponse class constructor
*
* @param message Incoming SmartObject message
**/
- explicit OnPhoneCallNotification(const MessageSharedPtr& message);
+ explicit DialNumberResponse(const MessageSharedPtr& message);
/**
- * @brief OnPhoneCallNotification class destructor
+ * @brief DialNumberResponse class destructor
**/
- virtual ~OnPhoneCallNotification();
+ virtual ~DialNumberResponse();
/**
* @brief Execute command
@@ -65,13 +64,13 @@ class OnPhoneCallNotification : public NotificationFromHMI {
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(OnPhoneCallNotification);
+ DISALLOW_COPY_AND_ASSIGN(DialNumberResponse);
};
-} // namespace hmi
+} // namespace hmi
} // namespace commands
} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_PHONE_CALL_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_DIAL_NUMBER_RESPONSE_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_event_changed_notification.h
index aa82de4d89..b40bfb6ca0 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_emergency_event_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_event_changed_notification.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,8 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_
#include "application_manager/commands/hmi/notification_from_hmi.h"
@@ -40,21 +40,21 @@ namespace application_manager {
namespace commands {
/**
- * @brief OnEmergencyEventNotification command class
+ * @brief OnEventChangedNotification command class
**/
-class OnEmergencyEventNotification : public NotificationFromHMI {
+class OnEventChangedNotification : public NotificationFromHMI {
public:
/**
- * @brief OnEmergencyEventNotification class constructor
+ * @brief OnEventChangedNotification class constructor
*
* @param message Incoming SmartObject message
**/
- explicit OnEmergencyEventNotification(const MessageSharedPtr& message);
+ explicit OnEventChangedNotification(const MessageSharedPtr& message);
/**
- * @brief OnEmergencyEventNotification class destructor
+ * @brief OnEventChangedNotification class destructor
**/
- virtual ~OnEmergencyEventNotification();
+ virtual ~OnEventChangedNotification();
/**
* @brief Execute command
@@ -62,11 +62,11 @@ class OnEmergencyEventNotification : public NotificationFromHMI {
virtual void Run();
private:
- DISALLOW_COPY_AND_ASSIGN(OnEmergencyEventNotification);
+ DISALLOW_COPY_AND_ASSIGN(OnEventChangedNotification);
};
} // namespace commands
} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EMERGENCY_EVENT_NOTIFICATION_H_
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_HMI_ON_EVENT_CHANGED_NOTIFICATION_H_
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h b/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h
index 35d6f49daa..b410c7b397 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/on_system_context_notification.h
@@ -64,9 +64,6 @@ class OnSystemContextNotification : public NotificationFromHMI {
virtual void Run();
private:
- void SendSystemContextNotification(ApplicationSharedPtr app,
- mobile_api::SystemContext::eType system_context);
-
DISALLOW_COPY_AND_ASSIGN(OnSystemContextNotification);
};
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h
index af991186fd..5a39891839 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h
@@ -60,7 +60,7 @@ class VIGetVehicleDataRequestTemplate : public RequestToHMI {
* @brief Execute command with sending DBus thin request to HMI
**/
virtual void Run() {
- LOG4CXX_INFO(logger_, "VIGetVehicleDataRequestTemplate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h
index 156664cac3..9942110ca8 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h
@@ -58,7 +58,7 @@ class VIGetVehicleDataResponseTemplate : public ResponseFromHMI {
* @brief Execute command
**/
virtual void Run() {
- LOG4CXX_INFO(logger_, "VIGetVehicleDataResponseTemplate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(eventID);
event.set_smart_object(*message_);
event.raise();
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h
index fc9b7dd2ea..5cf16c3610 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h
@@ -61,7 +61,7 @@ class VISubscribeVehicleDataRequestTemplate : public RequestToHMI {
* @brief Execute command with sending DBus thin request to HMI
**/
virtual void Run() {
- LOG4CXX_INFO(logger_, "VISubscriveVehicleDataRequestTemplate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h
index 64f3c51cbc..be67ab0106 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h
@@ -58,7 +58,7 @@ class VISubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
* @brief Execute command
**/
virtual void Run() {
- LOG4CXX_INFO(logger_, "VISubscribeVehicleDataResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(eventID);
event.set_smart_object(*message_);
event.raise();
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
index 9aa529d407..6014078ce3 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
@@ -61,7 +61,7 @@ class VIUnsubscribeVehicleDataRequestTemplate : public RequestToHMI {
* @brief Execute command with sending DBus thin request to HMI
**/
virtual void Run() {
- LOG4CXX_INFO(logger_, "VIUnsubscriveVehicleDataRequestTemplate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h
index 3dfcc763cb..a74f71fdf2 100644
--- a/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h
+++ b/src/components/application_manager/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h
@@ -59,7 +59,7 @@ class VIUnsubscribeVehicleDataResponseTemplate : public ResponseFromHMI {
* @brief Execute command
**/
virtual void Run() {
- LOG4CXX_INFO(logger_, "VIUnsubscriveVehicleDataResponseTemplate::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(eventID);
event.set_smart_object(*message_);
event.raise();
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 705a1d1454..dea6790a60 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
@@ -102,15 +102,15 @@ class AlertRequest : public CommandRequestImpl {
* @brief Sends TTS Speak request
*
* @param app_id Id of application requested this RPC
- */
- void SendSpeakRequest(int32_t app_id);
-
- /*
- * @brief Sends Basic communication playtone notification
*
- * @param app_id Id of application requested this RPC
+ * @param tts_chunks_exists if tts chunks exists in
+ * message contains true, otherwise contains false
+ *
+ * @param length_tts_chunks contains length of array
+ * tts chunks.
*/
- void SendPlayToneNotification(int32_t app_id);
+ void SendSpeakRequest(int32_t app_id, bool tts_chunks_exists,
+ size_t length_tts_chunks);
/*
* @brief Tells if there are sent requests without responses
@@ -127,11 +127,11 @@ class AlertRequest : public CommandRequestImpl {
bool awaiting_ui_alert_response_;
bool awaiting_tts_speak_response_;
bool awaiting_tts_stop_speaking_response_;
- bool response_success_;
- bool flag_other_component_sent_;
- mobile_apis::Result::eType response_result_;
- smart_objects::SmartObject response_params_;
- mobile_apis::Result::eType tts_speak_response_;
+ bool is_alert_succeeded_;
+ bool is_ui_alert_sent_;
+ mobile_apis::Result::eType alert_result_;
+ smart_objects::SmartObject alert_response_params_;
+ mobile_apis::Result::eType tts_speak_result_;
DISALLOW_COPY_AND_ASSIGN(AlertRequest);
};
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 d36f16a976..5e12b1f08d 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
@@ -39,15 +39,18 @@
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/pending.h"
#include "utils/macro.h"
+#include "utils/custom_string.h"
namespace application_manager {
namespace commands {
+namespace custom_str = utils::custom_string;
+
/**
* @brief ChangeRegistrationRequest command class
**/
-class ChangeRegistrationRequest : public CommandRequestImpl {
+class ChangeRegistrationRequest : public CommandRequestImpl {
public:
/**
* @brief ChangeRegistrationRequest class constructor
@@ -107,9 +110,9 @@ class ChangeRegistrationRequest : public CommandRequestImpl {
*
* @return true if all of result codes is success
*/
- bool AllHmiResponsesSuccess(const hmi_apis::Common_Result::eType ui,
- const hmi_apis::Common_Result::eType vr,
- const hmi_apis::Common_Result::eType tts);
+ bool AllHmiResponsesSuccess(const hmi_apis::Common_Result::eType ui,
+ const hmi_apis::Common_Result::eType vr,
+ const hmi_apis::Common_Result::eType tts);
/**
* @brief Checks change_registration params(ttsName, appname,
@@ -118,42 +121,49 @@ class ChangeRegistrationRequest : public CommandRequestImpl {
* @return true if command contains \t\n \\t \\n of whitespace otherwise
* returns false.
*/
- bool IsWhiteSpaceExist();
-
- /**
- * @brief Check parameters (name, vr) for
- * coincidence with already known parameters of registered applications
- *
- * @return SUCCESS if there is no coincidence of app.name/VR synonyms,
- * otherwise appropriate error code returns
- */
- mobile_apis::Result::eType CheckCoincidence();
-
- /**
- * @brief Predicate for using with CheckCoincidence method to compare with VR synonym SO
- *
- * @return TRUE if there is coincidence of VR, otherwise FALSE
- */
- struct CoincidencePredicateVR {
- explicit CoincidencePredicateVR(const std::string &newItem)
- :newItem_(newItem)
- {};
-
- bool operator()(smart_objects::SmartObject obj) {
- const std::string vr_synonym = obj.asString();
- return !(strcasecmp(vr_synonym.c_str(), newItem_.c_str()));
- };
-
- const std::string &newItem_;
- };
-
- Pending pending_requests_;
-
- hmi_apis::Common_Result::eType ui_result_;
- hmi_apis::Common_Result::eType vr_result_;
- hmi_apis::Common_Result::eType tts_result_;
-
- DISALLOW_COPY_AND_ASSIGN(ChangeRegistrationRequest);
+ bool IsWhiteSpaceExist();
+
+ /**
+ * @brief Check parameters (name, vr) for
+ * coincidence with already known parameters of registered applications
+ *
+ * @return SUCCESS if there is no coincidence of app.name/VR synonyms,
+ * otherwise appropriate error code returns
+ */
+ mobile_apis::Result::eType CheckCoincidence();
+
+ /**
+ * @brief Checks if requested name is allowed by policy
+ * @param app_name Application name
+ * @return true, if allowed, otherwise - false
+ */
+ bool IsNicknameAllowed(const custom_str::CustomString& app_name) const;
+
+ /**
+ * @brief Predicate for using with CheckCoincidence method to compare with VR
+ * synonym SO
+ *
+ * @return TRUE if there is coincidence of VR, otherwise FALSE
+ */
+ struct CoincidencePredicateVR {
+ explicit CoincidencePredicateVR(const custom_str::CustomString& newItem)
+ : newItem_(newItem){};
+
+ bool operator()(const smart_objects::SmartObject& obj) const {
+ const custom_str::CustomString& vr_synonym = obj.asCustomString();
+ return newItem_.CompareIgnoreCase(vr_synonym);
+ };
+
+ const custom_str::CustomString& newItem_;
+ };
+
+ Pending pending_requests_;
+
+ hmi_apis::Common_Result::eType ui_result_;
+ hmi_apis::Common_Result::eType vr_result_;
+ hmi_apis::Common_Result::eType tts_result_;
+
+ DISALLOW_COPY_AND_ASSIGN(ChangeRegistrationRequest);
};
} // namespace commands
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h
index 10ffa5b324..0c046362e7 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_request.h
@@ -57,11 +57,31 @@ class DialNumberRequest : public CommandRequestImpl {
virtual ~DialNumberRequest();
/**
+ * @brief Initialize request params
+ **/
+ virtual bool Init();
+
+ /**
* @brief Execute command
**/
virtual void Run();
+ /**
+ * @brief Interface method that is called whenever new event received
+ *
+ * @param event The received event
+ */
+ void on_event(const event_engine::Event& event);
+
private:
+
+ /**
+ * @brief Removes from number param all characters
+ * except the + character and digits.
+ *
+ */
+ void StripNumberParam(std::string &number);
+
DISALLOW_COPY_AND_ASSIGN(DialNumberRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h
new file mode 100644
index 0000000000..6d85c14dd5
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/commands/mobile/dial_number_response.h
@@ -0,0 +1,73 @@
+/*
+
+ Copyright (c) 2013, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_DIAL_NUMBER_RESPONSE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_DIAL_NUMBER_RESPONSE_H_
+
+#include "application_manager/commands/command_response_impl.h"
+#include "utils/macro.h"
+
+namespace application_manager {
+
+namespace commands {
+
+/**
+ * @brief DialNumberResponse command class
+ **/
+class DialNumberResponse : public CommandResponseImpl {
+ public:
+ /**
+ * @brief DialNumberResponse class constructor
+ *
+ * @param message Incoming SmartObject message
+ **/
+ explicit DialNumberResponse(const MessageSharedPtr& message);
+
+ /**
+ * @brief DialNumberResponse class destructor
+ **/
+ virtual ~DialNumberResponse();
+
+ /**
+ * @brief Execute command
+ **/
+ virtual void Run();
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(DialNumberResponse);
+};
+
+} // namespace commands
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_DIAL_NUMBER_RESPONSE_H_
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 62ca1257bb..8aea1e07a0 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
@@ -114,6 +114,13 @@ class PerformAudioPassThruRequest : public CommandRequestImpl {
bool IsWhiteSpaceExist();
/**
+ * @brief Waiting for TTS.Speak response, after default timeout send
+ * GENERIC_ERROR response
+ * @return if receive TTS.Speak return TRUE, FALSE otherwise
+ */
+ bool WaitTTSSpeak();
+
+ /**
* @brief If is_active_tts_speak_ TRUE - set up to FALSE and send request
* TTS_StopSpeaking to HMI
*/
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h
index 02575c1126..591a28dc01 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/perform_interaction_request.h
@@ -36,7 +36,6 @@
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/application.h"
-#include "utils/timer_thread.h"
#include "utils/macro.h"
namespace application_manager {
@@ -95,7 +94,7 @@ class PerformInteractionRequest : public CommandRequestImpl {
* @param message which should send to mobile side
*
*/
- void ProcessVRResponse(const smart_objects::SmartObject& message);
+ void ProcessVRResponse(const smart_objects::SmartObject& message, smart_objects::SmartObject& msg_params);
/*
* @brief Sends PerformInteraction response to mobile side
@@ -104,7 +103,7 @@ class PerformInteractionRequest : public CommandRequestImpl {
*
*/
void ProcessPerformInteractionResponse
- (const smart_objects::SmartObject& message);
+ (const smart_objects::SmartObject& message, smart_objects::SmartObject &msg_params);
/*
@@ -132,12 +131,6 @@ class PerformInteractionRequest : public CommandRequestImpl {
*/
void SendUIShowVRHelpRequest(ApplicationSharedPtr const app);
- /**
- * @brief Creates and Sends Perform interaction to UI.
- */
- void CreateUIPerformInteraction(const smart_objects::SmartObject& msg_params,
- application_manager::ApplicationSharedPtr const app);
-
/*
* @brief Checks if incoming choice set doesn't has similar menu names.
*
@@ -197,13 +190,49 @@ class PerformInteractionRequest : public CommandRequestImpl {
*/
bool CheckChoiceIDFromResponse(ApplicationSharedPtr app, int32_t choice_id);
- // members
- mobile_apis::Result::eType vr_perform_interaction_code_;
+ /**
+ * @brief Checks for a match of choice ID, in
+ * choice sets.
+ * @param app contains pointer to application.
+ * @param choice_set_id_list_length contains amount
+ * of choice set ids.
+ * @param choice_set_id_list array of choice set ids
+ * @return If request contains several choice sets with
+ * same choice id returns false, otherwise returns
+ * true.
+ */
+ bool CheckChoiceIDFromRequest(ApplicationSharedPtr app,
+ const size_t choice_set_id_list_length,
+ const smart_objects::SmartObject& choice_set_id_list) const;
+
+ /**
+ * @brief Tells if there are sent requests without responses
+ * @return If there is request without response method returns TRUE
+ * otherwise returns FALSE
+ */
+ const bool HasHMIResponsesToWait() const;
+
+ /**
+ * @brief Check VR response result code, in case GENERIC_ERROR, REJECTED,
+ * send resultCode FALSE, in case WARNINGS send resultCode TRUE
+ */
+ void CheckResponseResultCode();
+
+ /**
+ * @brief Check UI & VR result codes, send response to mobile
+ * @param msg_param Message params to send
+ */
+ void SendBothModeResponse(const smart_objects::SmartObject &msg_param);
+
mobile_apis::InteractionMode::eType interaction_mode_;
bool ui_response_recived_;
bool vr_response_recived_;
+ bool ui_result_;
+ bool vr_result_;
bool app_pi_was_active_before_;
static uint32_t pi_requests_count_;
+ mobile_apis::Result::eType vr_resultCode_;
+ mobile_apis::Result::eType ui_resultCode_;
DISALLOW_COPY_AND_ASSIGN(PerformInteractionRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
index e5bcf40da9..f4c581e5d8 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/register_app_interface_request.h
@@ -37,6 +37,7 @@
#include <string.h>
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "utils/custom_string.h"
namespace policy {
struct DeviceInfo;
@@ -48,6 +49,8 @@ class Application;
namespace commands {
+namespace custom_str = utils::custom_string;
+
/**
* @brief Register app interface request command class
**/
@@ -79,10 +82,18 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
*@param application_impl application
*
**/
- void SendRegisterAppInterfaceResponseToMobile(
- mobile_apis::Result::eType result = mobile_apis::Result::SUCCESS);
+ void SendRegisterAppInterfaceResponseToMobile();
private:
+ /**
+ * @brief Sends OnAppRegistered notification to HMI
+ *
+ *@param application_impl application with changed HMI status
+ *
+ **/
+ void SendOnAppRegisteredNotificationToHMI(const Application& application_impl,
+ bool resumption = false,
+ bool need_restore_vr = false);
/*
* @brief Check new ID along with known mobile application ID
*
@@ -100,22 +111,21 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
mobile_apis::Result::eType CheckCoincidence();
/*
- * @brief Predicate for using with CheckCoincidence method to compare with VR synonym SO
+ * @brief Predicate for using with CheckCoincidence method to compare with VR
+ * synonym SO
*
* return TRUE if there is coincidence of VR, otherwise FALSE
*/
struct CoincidencePredicateVR {
- explicit CoincidencePredicateVR(const std::string &newItem)
- :newItem_(newItem)
- {};
-
- bool operator()(smart_objects::SmartObject obj) {
- const std::string vr_synonym = obj.asString();
- return !(strcasecmp(vr_synonym.c_str(), newItem_.c_str()));
- };
+ explicit CoincidencePredicateVR(const custom_str::CustomString& newItem)
+ : newItem_(newItem){};
- const std::string &newItem_;
+ bool operator()(const smart_objects::SmartObject& obj) {
+ const custom_str::CustomString& vr_synonym = obj.asCustomString();
+ return newItem_.CompareIgnoreCase(vr_synonym);
};
+ const custom_str::CustomString& newItem_;
+ };
/**
* @brief Check request parameters against policy table data
@@ -153,11 +163,10 @@ class RegisterAppInterfaceRequest : public CommandRequestImpl {
*/
void SendSubscribeCustomButtonNotification();
-private:
+ private:
std::string response_info_;
mobile_apis::Result::eType result_checking_app_hmi_type_;
-
DISALLOW_COPY_AND_ASSIGN(RegisterAppInterfaceRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h
index d9e18dd76f..c9f8399cfc 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/set_global_properties_request.h
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2015, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,6 +35,7 @@
#include "application_manager/commands/command_request_impl.h"
#include "utils/macro.h"
+#include "application_manager/application.h"
namespace application_manager {
@@ -71,21 +71,38 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl {
void on_event(const event_engine::Event& event);
private:
- /*
- * @brief Chec if HelpItems order is correct
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool CheckVrHelpItemsOrder();
+ // Verify correctness VrHelptitle value
+ static bool ValidateVRHelpTitle(const smart_objects::SmartObject* const vr_help_so_ptr);
+
+ // prepare UI sending data (VrHelps, Menus, Keyboard) to SmartObject
+ static void PrepareUIRequestVRHelpData(const ApplicationSharedPtr app,
+ const smart_objects::SmartObject& msg_params,
+ smart_objects::SmartObject& out_params);
+
+ static bool PrepareUIRequestDefaultVRHelpData(const ApplicationSharedPtr app,
+ smart_objects::SmartObject& out_params);
+
+ static void PrepareUIRequestMenuAndKeyboardData(const ApplicationSharedPtr app,
+ const smart_objects::SmartObject& msg_params,
+ smart_objects::SmartObject& out_params);
+
+ // Send TTS request to HMI
+ void SendTTSRequest(const smart_objects::SmartObject& params, bool use_events);
+
+ // Send UI request to HMI
+ void SendUIRequest(const smart_objects::SmartObject& params, bool use_events);
- /*
+ // VRHelp shall contain sequential positions and start from 1
+ static bool CheckVrHelpItemsOrder(const smart_objects::SmartObject& vr_help);
+
+ /**
* @brief Check if there some not delivered hmi responses exist
*
* @return true if all responses received
*/
bool IsPendingResponseExist();
- /*
+ /**
* @brief Checks if request has at least one parameter
*
* @param params request parameters
@@ -103,8 +120,6 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl {
*/
bool IsWhiteSpaceExist();
- DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest);
-
bool is_ui_send_;
bool is_tts_send_;
@@ -113,6 +128,8 @@ class SetGlobalPropertiesRequest : public CommandRequestImpl {
hmi_apis::Common_Result::eType ui_result_;
hmi_apis::Common_Result::eType tts_result_;
+
+ DISALLOW_COPY_AND_ASSIGN(SetGlobalPropertiesRequest);
};
} // namespace commands
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 288500e7e8..cd3d1ff3ee 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
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_SUBSCRIBE_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/application.h"
#include "utils/macro.h"
namespace application_manager {
@@ -85,9 +86,42 @@ class SubscribeVehicleDataRequest : public CommandRequestImpl {
#endif // #ifdef HMI_DBUS_API
private:
- bool IsAnythingAlreadySubscribed(
+ /**
+ * @brief Checks, if any app is subscribed for particular VI parameter
+ * @param param_id VI parameter id
+ * @return true, if there are registered apps subscribed for VI parameter,
+ * otherwise - false
+ */
+ bool IsSomeoneSubscribedFor(const uint32_t param_id) const;
+
+ /**
+ * @brief Adds VI parameters being subscribed by another or the same app to
+ * response with appropriate results
+ * @param msg_params 'message_params' response section reference
+ */
+ void AddAlreadySubscribedVI(smart_objects::SmartObject& msg_params) const;
+
+ /**
+ * @brief Removes subscription for VI parameters which subsription attempt
+ * returned an error
+ * @param app Pointer to application sent subscribe request
+ * @param msg_params 'message_parameters' response section reference
+ */
+ void UnsubscribeFailedSubscriptions(
+ ApplicationSharedPtr app,
const smart_objects::SmartObject& msg_params) const;
+ /**
+ * @brief VI parameters which had been already subscribed by another apps
+ * befor particular app subscribed for these parameters
+ */
+ VehicleInfoSubscriptions vi_already_subscribed_by_another_apps_;
+
+ /**
+ * @brief VI parameters which had been subscribed already by particular app
+ */
+ VehicleInfoSubscriptions vi_already_subscribed_by_this_app_;
+
DISALLOW_COPY_AND_ASSIGN(SubscribeVehicleDataRequest);
};
diff --git a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h
index dd52a77224..b560665c06 100644
--- a/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h
+++ b/src/components/application_manager/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h
@@ -35,6 +35,7 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_COMMANDS_MOBILE_UNSUBSCRIBE_VEHICLE_DATA_REQUEST_H_
#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/application.h"
#include "utils/macro.h"
namespace application_manager {
@@ -85,8 +86,37 @@ class UnsubscribeVehicleDataRequest : public CommandRequestImpl {
#endif // #ifdef HMI_DBUS_API
private:
- bool IsAnythingAlreadyUnsubscribed(
- const smart_objects::SmartObject& msg_params) const;
+ /**
+ * @brief Checks, if any app is subscribed for particular VI parameter
+ * @param param_id VI parameter id
+ * @return true, if there are registered apps subscribed for VI parameter,
+ * otherwise - false
+ */
+ bool IsSomeoneSubscribedFor(const uint32_t param_id) const;
+
+ /**
+ * @brief Adds VI parameters being unsubscribed by another or the same app to
+ * response with appropriate results
+ * @param msg_params 'message_params' response section reference
+ */
+ void AddAlreadyUnsubscribedVI(smart_objects::SmartObject& response) const;
+
+ /**
+ * @brief Allows to update hash after sending response to mobile.
+ */
+ void UpdateHash() const;
+
+ /**
+ * @brief VI parameters which still being subscribed by another apps after
+ * particular app had been unsubscribed from these parameters
+ */
+ VehicleInfoSubscriptions vi_still_subscribed_by_another_apps_;
+
+ /**
+ * @brief VI parameters which had been unsubscribed already by particular app
+ */
+ VehicleInfoSubscriptions vi_already_unsubscribed_by_this_app_;
+
DISALLOW_COPY_AND_ASSIGN(UnsubscribeVehicleDataRequest);
};
diff --git a/src/components/application_manager/include/application_manager/event_engine/event.h b/src/components/application_manager/include/application_manager/event_engine/event.h
index 55f5cd1320..18c9a972e9 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event.h
@@ -141,7 +141,7 @@ int32_t Event::smart_object_type() const {
strings::params).getElement(strings::message_type).asInt();
}
-}
-}
+} // namespace event_engine
+} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_H_
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
index ff21b01c58..1af42898be 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,11 +34,6 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_H_
#include <list>
-#include <map>
-
-#include "utils/lock.h"
-#include "utils/singleton.h"
-
#include "application_manager/event_engine/event.h"
namespace application_manager {
@@ -46,7 +41,7 @@ namespace event_engine {
class EventObserver;
-class EventDispatcher : public utils::Singleton<EventDispatcher> {
+class EventDispatcher {
public:
/*
@@ -54,7 +49,7 @@ class EventDispatcher : public utils::Singleton<EventDispatcher> {
*
* @param event Received event
*/
- void raise_event(const Event& event);
+ virtual void raise_event(const Event& event) = 0;
/*
* @brief Subscribe the observer to event
@@ -63,9 +58,9 @@ class EventDispatcher : public utils::Singleton<EventDispatcher> {
* @param hmi_correlation_id The event HMI correlation ID
* @param observer The observer to subscribe for event
*/
- void add_observer(const Event::EventID& event_id,
+ virtual void add_observer(const Event::EventID& event_id,
int32_t hmi_correlation_id,
- EventObserver* const observer);
+ EventObserver* const observer) = 0;
/*
* @brief Unsubscribes the observer from specific event
@@ -73,55 +68,24 @@ class EventDispatcher : public utils::Singleton<EventDispatcher> {
* @param event_id The event ID to unsubscribe from
* @param observer The observer to be unsubscribed
*/
- void remove_observer(const Event::EventID& event_id,
- EventObserver* const observer);
+ virtual void remove_observer(const Event::EventID& event_id,
+ EventObserver* const observer) = 0;
/*
* @brief Unsubscribes the observer from all events
*
* @param observer The observer to be unsubscribed
*/
- void remove_observer(EventObserver* const observer);
-
- protected:
-
- private:
-
- /*
- * @brief Default constructor
- */
- EventDispatcher();
+ virtual void remove_observer(EventObserver* const observer) = 0;
/*
* @brief Destructor
*/
- virtual ~EventDispatcher();
-
- /*
- * @brief removes observer
- * when occurs unsubscribe from event
- * @param observer to be removed
- */
- void remove_observer_from_list(EventObserver* const observer);
-
- DISALLOW_COPY_AND_ASSIGN(EventDispatcher);
-
- FRIEND_BASE_SINGLETON_CLASS(EventDispatcher);
-
- // Data types section
- typedef std::list<EventObserver*> ObserverList;
- typedef std::map<int32_t, ObserverList> ObserversMap;
- typedef std::map<Event::EventID, ObserversMap> EventObserverMap;
-
- // Members section
- sync_primitives::Lock state_lock_;
- sync_primitives::Lock observer_list_lock_;
- EventObserverMap observers_;
- ObserverList observers_list_;
-
+ virtual ~EventDispatcher() {
+ };
};
-}
-}
+} // namespace event_engine
+} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_H_
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
new file mode 100644
index 0000000000..e834889bff
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/event_engine/event_dispatcher_impl.h
@@ -0,0 +1,127 @@
+/*
+ Copyright (c) 2016, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_IMPL_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_IMPL_H_
+
+#include <vector>
+#include <map>
+
+#include "utils/lock.h"
+#include "utils/singleton.h"
+
+#include "application_manager/event_engine/event.h"
+#include "application_manager/event_engine/event_dispatcher.h"
+
+namespace application_manager {
+namespace event_engine {
+
+class EventObserver;
+
+class EventDispatcherImpl : public EventDispatcher,
+ public utils::Singleton<EventDispatcherImpl> {
+ public:
+
+ /*
+ * @brief Delivers the event to all subscribers
+ *
+ * @param event Received event
+ */
+ virtual void raise_event(const Event& event);
+
+ /*
+ * @brief Subscribe the observer to event
+ *
+ * @param event_id The event ID to subscribe for
+ * @param hmi_correlation_id The event HMI correlation ID
+ * @param observer The observer to subscribe for event
+ */
+ virtual void add_observer(const Event::EventID& event_id,
+ int32_t hmi_correlation_id,
+ EventObserver* const observer);
+
+ /*
+ * @brief Unsubscribes the observer from specific event
+ *
+ * @param event_id The event ID to unsubscribe from
+ * @param observer The observer to be unsubscribed
+ */
+ virtual void remove_observer(const Event::EventID& event_id,
+ EventObserver* const observer);
+
+ /*
+ * @brief Unsubscribes the observer from all events
+ *
+ * @param observer The observer to be unsubscribed
+ */
+ virtual void remove_observer(EventObserver* const observer);
+
+ /*
+ * @brief Destructor
+ */
+ virtual ~EventDispatcherImpl();
+
+ private:
+
+ /*
+ * @brief Default constructor
+ */
+ EventDispatcherImpl();
+
+ /*
+ * @brief removes observer
+ * when occurs unsubscribe from event
+ * @param observer to be removed
+ */
+ void remove_observer_from_vector(EventObserver* const observer);
+
+ DISALLOW_COPY_AND_ASSIGN(EventDispatcherImpl);
+
+ FRIEND_BASE_SINGLETON_CLASS(EventDispatcherImpl);
+
+ // Data types section
+ typedef std::vector<EventObserver*> ObserverVector;
+ typedef std::map<int32_t, ObserverVector> ObserversMap;
+ typedef std::map<Event::EventID, ObserversMap> EventObserverMap;
+
+ // Members section
+ sync_primitives::Lock state_lock_;
+ sync_primitives::Lock observer_lock_;
+ EventObserverMap observers_event_;
+ ObserverVector observers_;
+
+};
+
+} // namespace event_engine
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_DISPATCHER_IMPL_H_
diff --git a/src/components/application_manager/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/include/application_manager/event_engine/event_observer.h
index 8631203290..04e73e3d86 100644
--- a/src/components/application_manager/include/application_manager/event_engine/event_observer.h
+++ b/src/components/application_manager/include/application_manager/event_engine/event_observer.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#include <string>
#include "application_manager/event_engine/event.h"
-#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
namespace application_manager {
namespace event_engine {
@@ -44,8 +44,6 @@ class EventObserver
{
public:
- friend class EventDispatcher;
-
// Typedef for possible Observer ID's from mobile_apis functionID enum
typedef unsigned long ObserverID;
@@ -110,7 +108,7 @@ const EventObserver::ObserverID& EventObserver::id() const {
return id_;
}
-}
-}
+} // namespace event_engine
+} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_EVENT_OBSERVER_H_
diff --git a/src/components/application_manager/include/application_manager/hmi_capabilities.h b/src/components/application_manager/include/application_manager/hmi_capabilities.h
index 277455ff4e..a58e9478c8 100644
--- a/src/components/application_manager/include/application_manager/hmi_capabilities.h
+++ b/src/components/application_manager/include/application_manager/hmi_capabilities.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,7 @@
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
- */
+*/
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_
@@ -37,6 +37,7 @@
#include "interfaces/MOBILE_API.h"
#include "json/json.h"
#include "utils/macro.h"
+#include "application_manager/hmi_language_handler.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -121,8 +122,7 @@ class HMICapabilities {
*
* @return Currently active UI language
*/
- inline const hmi_apis::Common_Language::eType&
- active_ui_language() const;
+ const hmi_apis::Common_Language::eType active_ui_language() const;
/*
* @brief Sets currently active UI language
@@ -152,8 +152,7 @@ class HMICapabilities {
*
* @return Currently active VR language
*/
- inline const hmi_apis::Common_Language::eType&
- active_vr_language() const;
+ const hmi_apis::Common_Language::eType active_vr_language() const;
/*
* @brief Sets currently active VR language
@@ -183,8 +182,7 @@ class HMICapabilities {
*
* @return Currently active TTS language
*/
- inline const hmi_apis::Common_Language::eType&
- active_tts_language() const;
+ const hmi_apis::Common_Language::eType active_tts_language() const;
/*
* @brief Sets currently active TTS language
@@ -470,11 +468,12 @@ class HMICapabilities {
smart_objects::SmartObject* speech_capabilities_;
smart_objects::SmartObject* audio_pass_thru_capabilities_;
smart_objects::SmartObject* prerecorded_speech_;
+ std::string ccpu_version_;
bool is_navigation_supported_;
bool is_phone_call_supported_;
- std::string ccpu_version_;
ApplicationManagerImpl* app_mngr_;
+ HMILanguageHandler hmi_language_handler_;
DISALLOW_COPY_AND_ASSIGN(HMICapabilities);
};
@@ -499,31 +498,16 @@ bool HMICapabilities::is_ivi_cooperating() const {
return is_ivi_cooperating_;
}
-const hmi_apis::Common_Language::eType&
-HMICapabilities::active_ui_language() const {
- return ui_language_;
-}
-
const smart_objects::SmartObject*
HMICapabilities::ui_supported_languages() const {
return ui_supported_languages_;
}
-const hmi_apis::Common_Language::eType&
-HMICapabilities::active_vr_language() const {
- return vr_language_;
-}
-
const smart_objects::SmartObject*
HMICapabilities::vr_supported_languages() const {
return vr_supported_languages_;
}
-const hmi_apis::Common_Language::eType&
-HMICapabilities::active_tts_language() const {
- return tts_language_;
-}
-
const smart_objects::SmartObject*
HMICapabilities::tts_supported_languages() const {
return tts_supported_languages_;
@@ -580,6 +564,10 @@ HMICapabilities::prerecorded_speech() const {
return prerecorded_speech_;
}
+const std::string& HMICapabilities::ccpu_version() const {
+ return ccpu_version_;
+}
+
bool HMICapabilities::navigation_supported() const {
return is_navigation_supported_;
}
@@ -588,10 +576,6 @@ bool HMICapabilities::phone_call_supported() const {
return is_phone_call_supported_;
}
-const std::string& HMICapabilities::ccpu_version() const {
- return ccpu_version_;
-}
-
} // namespace application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_CAPABILITIES_H_
diff --git a/src/components/application_manager/include/application_manager/hmi_language_handler.h b/src/components/application_manager/include/application_manager/hmi_language_handler.h
new file mode 100644
index 0000000000..aa90da7562
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/hmi_language_handler.h
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_
+
+#include "application_manager/event_engine/event_observer.h"
+#include "interfaces/HMI_API.h"
+
+namespace application_manager {
+
+/**
+ * Class is used to handle edge case with slow HMI responses for current
+ * languages. Main idea is to cache values within some persistent storage and
+ * respond to applications with these values. In case app registered before
+ * responses are gotten and after responses were received their language(s)
+ * mismatch to current on HMI - apps have to be unregistered.
+ **/
+class HMILanguageHandler: public event_engine::EventObserver {
+public:
+ typedef std::map<uint32_t, bool> Apps;
+
+ /**
+ * @brief System interfaces
+ */
+ enum Interface {
+ INTERFACE_UI,
+ INTERFACE_VR,
+ INTERFACE_TTS
+ };
+
+ /**
+ * @brief Class constructor
+ */
+ HMILanguageHandler();
+
+ /**
+ * @brief Sets language for interface
+ * @param interface Interface
+ * @param language Language
+ */
+ void set_language_for(Interface interface,
+ hmi_apis::Common_Language::eType language);
+
+ /**
+ * @brief Gets language for interface
+ * @param interface Interface
+ * @return Language
+ */
+ hmi_apis::Common_Language::eType get_language_for(Interface interface) const;
+
+ void on_event(const event_engine::Event& event) OVERRIDE;
+
+ /**
+ * @brief Trigger waiting for response
+ * @param request Request object
+ */
+ void set_handle_response_for(
+ const event_engine::smart_objects::SmartObject& request);
+
+ /**
+ * @brief Sets default languages from HMI capabilities
+ * @param ui UI language
+ * @param vr VR language
+ * @param tts TTS language
+ */
+ void set_default_capabilities_languages(
+ hmi_apis::Common_Language::eType ui,
+ hmi_apis::Common_Language::eType vr,
+ hmi_apis::Common_Language::eType tts);
+
+private:
+ void SendOnLanguageChangeToMobile(uint32_t connection_key);
+
+ /**
+ * @brief Verifies languages gotten from HMI with persisted languages
+ */
+ void VerifyWithPersistedLanguages();
+
+ /**
+ * @brief Handles applications registered before actual HMI languages
+ * have been received
+ * @param app_id Application id
+ */
+ void HandleWrongLanguageApp(const Apps::value_type& app_id);
+
+ /**
+ * @brief Checks if application needs to be handled because of language(s)
+ * mismatch
+ * @param app Application
+ */
+ void CheckApplication(const Apps::value_type app);
+
+ sync_primitives::Lock apps_lock_;
+
+ /**
+ * @brief Applications, which needs to be handled
+ */
+ Apps apps_;
+
+ /**
+ * @brief UI language persisted from previous ignition cycle
+ */
+ hmi_apis::Common_Language::eType persisted_ui_language_;
+
+ /**
+ * @brief VR language persisted from previous ignition cycle
+ */
+ hmi_apis::Common_Language::eType persisted_vr_language_;
+
+ /**
+ * @brief TTS language persisted from previous ignition cycle
+ */
+ hmi_apis::Common_Language::eType persisted_tts_language_;
+
+ /**
+ * @brief Default UI language from HMI capabilitites
+ */
+ hmi_apis::Common_Language::eType capabilities_ui_language_;
+
+ /**
+ * @brief Default VR language from HMI capabilitites
+ */
+ hmi_apis::Common_Language::eType capabilities_vr_language_;
+
+ /**
+ * @brief Default TTS language from HMI capabilitites
+ */
+ hmi_apis::Common_Language::eType capabilities_tts_language_;
+
+ /**
+ * @brief Indicates if current UI language has been received from HMI
+ */
+ bool is_ui_language_received_;
+
+ /**
+ * @brief Indicates if current VR language has been received from HMI
+ */
+ bool is_vr_language_received_;
+
+ /**
+ * @brief Indicates if current TTS language has been received from HMI
+ */
+ bool is_tts_language_received_;
+};
+
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMI_LANGUAGE_HANDLER_H_
+
diff --git a/src/components/application_manager/include/application_manager/hmi_state.h b/src/components/application_manager/include/application_manager/hmi_state.h
index 4451fb6857..fbcb5a4f29 100644
--- a/src/components/application_manager/include/application_manager/hmi_state.h
+++ b/src/components/application_manager/include/application_manager/hmi_state.h
@@ -1,186 +1,302 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H
#include <list>
#include "interfaces/MOBILE_API.h"
#include "utils/shared_ptr.h"
-#include "application_manager/state_context.h"
namespace application_manager {
class HmiState;
+class ApplicationManager;
+
typedef utils::SharedPtr<HmiState> HmiStatePtr;
-typedef std::list<HmiStatePtr> HmiStateList;
- /**
- * @brief The HmiState class
- * Handle Hmi state of application (hmi level,
- * audio streaming state, system context)
- *
- */
+/**
+* @brief The HmiState class
+* Handle Hmi state of application (hmi level,
+* audio streaming state, system context)
+*
+*/
class HmiState {
+ public:
+ /**
+ * @brief The StateID enum describes state of application
+ * If no events occured STATE_ID_DEFAULT shuld be presented
+ */
+ enum StateID {
+ STATE_ID_CURRENT,
+ STATE_ID_REGULAR,
+ STATE_ID_POSTPONED,
+ STATE_ID_PHONE_CALL,
+ STATE_ID_SAFETY_MODE,
+ STATE_ID_VR_SESSION,
+ STATE_ID_TTS_SESSION,
+ STATE_ID_NAVI_STREAMING,
+ STATE_ID_DEACTIVATE_HMI,
+ STATE_ID_AUDIO_SOURCE,
+ STATE_ID_EMBEDDED_NAVI
+ };
- public:
- /**
- * @brief The StateID enum describes state of application
- * If no events occured STATE_ID_DEFAULT shuld be presented
- */
- enum StateID {
- STATE_ID_REGULAR,
- STATE_ID_PHONE_CALL,
- STATE_ID_SAFETY_MODE,
- STATE_ID_VR_SESSION,
- STATE_ID_TTS_SESSION,
- STATE_ID_NAVI_STREAMING,
- };
-
- HmiState(uint32_t app_id, const StateContext& state_context_);
- HmiState(uint32_t app_id, const StateContext& state_context_,
- StateID state_id);
-
-
- virtual ~HmiState() {}
-
- /**
- * @brief setParent setup parent state
- * @param parent state to setup
- */
- void set_parent(HmiStatePtr parent);
-
- /**
- * @brief parent get parent state
- * @return parent state
- */
- const HmiStatePtr parent() const {
- return parent_;
- }
+ HmiState(uint32_t app_id, ApplicationManager* app_mngr);
+ HmiState(uint32_t app_id, ApplicationManager* app_mngr, StateID state_id);
- /**
- * @brief hmi_level
- * @return return hmi level member
- */
- virtual mobile_apis::HMILevel::eType hmi_level() const {
- if (parent_) {
- return parent_->hmi_level();
- }
- return hmi_level_;
- }
- /**
- * @brief set_hmi_level set hmi_level member
- * @param hmi_level hmi level to setup
- */
- void set_hmi_level(mobile_apis::HMILevel::eType hmi_level) {
- hmi_level_ = hmi_level;
- }
+ virtual ~HmiState() {}
- /**
- * @brief audio_streaming_state
- * @return return audio streaming state member
- */
- virtual mobile_apis::AudioStreamingState::eType
- audio_streaming_state() const {
- if (parent_) {
- return parent_->audio_streaming_state();
- }
- return audio_streaming_state_;
- }
- /**
- * @brief set_audio_streaming_state set audio_streaming_state member
- * @param audio_state audio_state to setup
- */
- virtual void set_audio_streaming_state(
- mobile_apis::AudioStreamingState::eType audio_state) {
- audio_streaming_state_ = audio_state;
- }
+ /**
+ * @brief setParent setup parent state
+ * @param parent state to setup
+ */
+ void set_parent(HmiStatePtr parent);
+
+ /**
+ * @brief parent get parent state
+ * @return parent state
+ */
+ const HmiStatePtr parent() const {
+ return parent_;
+ }
- /**
- * @brief system_context
- * @return return system context member
- */
- virtual mobile_apis::SystemContext::eType system_context() const {
- if (parent_) {
- return parent_->system_context();
- }
- return system_context_;
+ /**
+ * @brief hmi_level
+ * @return return hmi level member
+ */
+ virtual mobile_apis::HMILevel::eType hmi_level() const {
+ if (parent_) {
+ return parent_->hmi_level();
}
+ return hmi_level_;
+ }
+ /**
+ * @brief set_hmi_level set hmi_level member
+ * @param hmi_level hmi level to setup
+ */
+ void set_hmi_level(mobile_apis::HMILevel::eType hmi_level) {
+ hmi_level_ = hmi_level;
+ }
- /**
- * @brief set_system_context set system_context member
- * @param system_context system_context to setup
- */
- virtual void set_system_context(
- mobile_apis::SystemContext::eType system_context){
- system_context_ = system_context;
+ /**
+ * @brief audio_streaming_state
+ * @return return audio streaming state member
+ */
+ virtual mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const {
+ if (parent_) {
+ return parent_->audio_streaming_state();
}
+ return audio_streaming_state_;
+ }
+ /**
+ * @brief set_audio_streaming_state set audio_streaming_state member
+ * @param audio_state audio_state to setup
+ */
+ virtual void set_audio_streaming_state(
+ mobile_apis::AudioStreamingState::eType audio_state) {
+ audio_streaming_state_ = audio_state;
+ }
- /**
- * @brief state_id state type
- * @return reutrn state type
- */
- StateID state_id() const {
- return state_id_;
+ /**
+ * @brief system_context
+ * @return return system context member
+ */
+ virtual mobile_apis::SystemContext::eType system_context() const {
+ if (parent_) {
+ return parent_->system_context();
}
- protected:
- uint32_t app_id_;
- StateID state_id_;
- const StateContext& state_context_;
- HmiStatePtr parent_;
- mobile_apis::HMILevel::eType hmi_level_;
- mobile_apis::AudioStreamingState::eType audio_streaming_state_;
- mobile_apis::SystemContext::eType system_context_;
- private:
- void operator=(const HmiState&);
+ return system_context_;
+ }
+
+ /**
+ * @brief set_system_context set system_context member
+ * @param system_context system_context to setup
+ */
+ virtual void set_system_context(
+ mobile_apis::SystemContext::eType system_context) {
+ system_context_ = system_context;
+ }
+
+ /**
+ * @brief state_id state type
+ * @return reutrn state type
+ */
+ StateID state_id() const {
+ return state_id_;
+ }
+
+ /**
+ * @brief set_state_id sets state id
+ * @param state_id state id to setup
+ */
+ virtual void set_state_id(StateID state_id) {
+ state_id_ = state_id;
+ }
+
+ protected:
+ uint32_t app_id_;
+ StateID state_id_;
+ ApplicationManager* app_mngr_;
+ HmiStatePtr parent_;
+ mobile_apis::HMILevel::eType hmi_level_;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state_;
+ mobile_apis::SystemContext::eType system_context_;
+
+ protected:
+ /**
+ * @brief is_navi_app check if app is navi
+ * @param app_id application id
+ * @return true if app is navi, otherwise return false
+ */
+ bool is_navi_app(const uint32_t app_id) const;
+
+ /**
+ * @brief is_media_app check if app is media
+ * @param app_id application id
+ * @return true if media_app, otherwise return false
+ */
+ bool is_media_app(const uint32_t app_id) const;
+
+ /**
+ * @brief is_voice_communicationn_app check if app is voice comunication
+ * @param app_id application id
+ * @return true if voice_communicationn_app, otherwise return false
+ */
+ bool is_voice_communication_app(const uint32_t app_id) const;
+
+ private:
+ void operator=(const HmiState&);
};
/**
- * @brief The VRHmiState class impement logic of VR temporary state
+ * @brief The VRHmiState class implements logic of VR temporary state
*/
class VRHmiState : public HmiState {
- public:
- virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const;
- VRHmiState(uint32_t app_id, StateContext& state_context);
+ public:
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE;
+ VRHmiState(uint32_t app_id, ApplicationManager* app_mngr);
};
/**
- * @brief The TTSHmiState class impement logic of TTS temporary state
+ * @brief The TTSHmiState class implements logic of TTS temporary state
*/
class TTSHmiState : public HmiState {
- public:
- TTSHmiState(uint32_t app_id, StateContext& state_context);
- virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const;
+ public:
+ TTSHmiState(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE;
};
/**
- * @brief The NaviStreamingState class impement logic of NaviStreaming temporary state
+ * @brief The NaviStreamingState class implements logic of NaviStreaming
+ * temporary state
*/
class NaviStreamingHmiState : public HmiState {
- public:
- NaviStreamingHmiState(uint32_t app_id, StateContext& state_context);
- virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const;
+ public:
+ NaviStreamingHmiState(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE;
};
/**
- * @brief The PhoneCallHmiState class impement logic of PhoneCall temporary state
+ * @brief The PhoneCallHmiState class implements logic of PhoneCall temporary
+ * state
*/
class PhoneCallHmiState : public HmiState {
- public:
- PhoneCallHmiState(uint32_t app_id, StateContext& state_context);
- virtual mobile_apis::HMILevel::eType hmi_level() const;
- virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const {
- return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
- }
+ public:
+ PhoneCallHmiState(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
};
/**
- * @brief The SafetyModeHmiState class impement logic of SafetyMode temporary state
+ * @brief The SafetyModeHmiState class implements logic of SafetyMode temporary
+ * state
*/
class SafetyModeHmiState : public HmiState {
- public:
- SafetyModeHmiState(uint32_t app_id, StateContext& state_context);
- virtual mobile_apis::AudioStreamingState::eType audio_streaming_state() const {
- return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
- }
+ public:
+ SafetyModeHmiState(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
+};
+
+/**
+ * @brief The DeactivateHMI class implements logic of DeactivateHMI temporary
+ * state
+ */
+class DeactivateHMI : public HmiState {
+ public:
+ DeactivateHMI(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
+};
+
+/**
+ * @brief The AudioSource class implements logic of OnEventChanged(AUDIO_SOURCE)
+ * temporary state
+ */
+class AudioSource : public HmiState {
+ public:
+ AudioSource(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
+};
+
+/**
+ * @brief The EmbeddedNavi class implements logic of OnEventChanged(EMBEDDED_NAVI)
+ * temporary state
+ */
+class EmbeddedNavi : public HmiState {
+ public:
+ EmbeddedNavi(uint32_t app_id, ApplicationManager* app_mngr);
+ mobile_apis::HMILevel::eType hmi_level() const OVERRIDE;
+ mobile_apis::AudioStreamingState::eType audio_streaming_state()
+ const OVERRIDE {
+ return mobile_apis::AudioStreamingState::NOT_AUDIBLE;
+ }
};
}
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_HMISTATE_H
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 cfd3d4c72f..0c072184ff 100644
--- a/src/components/application_manager/include/application_manager/message_helper.h
+++ b/src/components/application_manager/include/application_manager/message_helper.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2015, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,8 +34,9 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_MESSAGE_HELPER_H_
#include <map>
+#include <vector>
#include <string>
-#include <string.h>
+
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "utils/macro.h"
@@ -43,6 +44,7 @@
#include "application_manager/application.h"
#include "application_manager/vehicle_info_data.h"
#include "policy/policy_types.h"
+#include "protocol_handler/session_observer.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -66,63 +68,58 @@ typedef std::map<std::string, VehicleDataType> VehicleData;
* @brief MessageHelper class
**/
class MessageHelper {
- public:
- /**
- * @brief Creates request for different interfaces(JSON, DBUS)
- * @param correlation_id unique ID
- * @param params Vector of arguments that we need in GetVehicleData request (e.g. gps, odometer, fuel_level)
- */
- static void CreateGetVehicleDataRequest(uint32_t correlation_id, const std::vector<std::string>& params);
-
- /**
- * @brief Sends HMI status notification to mobile
- *
- *@param application_impl application with changed HMI status
- *
- **/
- static void SendHMIStatusNotification(const Application& application_impl);
-
- /**
- * @brief Sends OnAppRegistered notification to HMI
- *
- *@param application_impl application with changed HMI status
- *
- **/
- static void SendOnAppRegisteredNotificationToHMI(
- const Application& application_impl,
- bool resumption = false,
- bool need_restore_vr = false);
-
- /**
- * @brief Create mobile HashUpdateNotification
- */
- static smart_objects::SmartObjectSPtr GetHashUpdateNotification(const uint32_t app_id);
-
- /**
- * @brief Create OnSystemRequest notification for lock screen icon url
- */
- static smart_objects::SmartObject* GetLockScreenIconUrlNotification(const uint32_t connection_key);
-
- /**
- * @brief Send the OnSystemRequest notification for lock screen icon url to the mobile device
- */
- static void SendLockScreenIconUrlNotification(const uint32_t connection_key);
+ public:
+ /**
+ * @brief Creates request for different interfaces(JSON, DBUS)
+ * @param correlation_id unique ID
+ * @param params Vector of arguments that we need in GetVehicleData request
+ * (e.g. gps, odometer, fuel_level)
+ */
+ static void CreateGetVehicleDataRequest(
+ uint32_t correlation_id, const std::vector<std::string>& params);
+
+ /**
+ * @brief Create mobile HashUpdateNotification
+ */
+ static smart_objects::SmartObjectSPtr CreateHashUpdateNotification(
+ const uint32_t app_id);
+
+ static smart_objects::SmartObjectSPtr GetHashUpdateNotification(
+ const uint32_t app_id);
+
+ /**
+ * @brief Create OnSystemRequest notification for lock screen icon url
+ */
+ static smart_objects::SmartObject* GetLockScreenIconUrlNotification(
+ const uint32_t connection_key);
+
+ /**
+ * @brief Send the OnSystemRequest notification for lock screen icon url to the
+ * mobile device
+ */
+ static void SendLockScreenIconUrlNotification(const uint32_t connection_key);
+
+ /**
+ * @brief Sends to mobile HashUpdateNotification
+ */
+ static void SendHashUpdateNotification(const uint32_t app_id);
+
+ /**
+ * @brief Sends OnAppInterfaceUnregistered notification to mobile
+ *
+ *@param connection_key Connection key
+ *@param reason Reason
+ *
+ **/
+ static void SendOnAppInterfaceUnregisteredNotificationToMobile(
+ int32_t connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::eType reason);
/**
- * @brief Sends to mobile HashUpdateNotification
+ * @brief Sends OnLanguageChange notification to application
+ * @param connection_key Connection key of application
*/
- static void SendHashUpdateNotification(const uint32_t app_id);
-
- /**
- * @brief Sends OnAppInterfaceUnregistered notification to mobile
- *
- *@param connection_key Connection key
- *@param reason Reason
- *
- **/
- static void SendOnAppInterfaceUnregisteredNotificationToMobile(
- int32_t connection_key,
- mobile_apis::AppInterfaceUnregisteredReason::eType reason);
+ static void SendOnLanguageChangeToMobile(uint32_t connection_key);
/*
* @brief Retrieve vehicle data map for param name in mobile request
@@ -133,393 +130,489 @@ class MessageHelper {
static const VehicleData& vehicle_data();
/**
- * @brief Convert string to HMI level, if possible
- * @param hmi_level Stringified HMI level
- * @return Appropriate enum from HMI level, or INVALID_ENUM, if conversiion
- * is not possible
- */
- static mobile_api::HMILevel::eType StringToHMILevel(
+ * @brief Converts HMI Result enum value to string
+ * @param hmi_result HMI Result enum value
+ * @return stringified value for enum if succedeed, otherwise - empty string
+ */
+ static std::string HMIResultToString(
+ hmi_apis::Common_Result::eType hmi_result);
+
+ /**
+ * @brief Converts string to HMI Result enum value
+ * @param hmi_result stringified value
+ * @return HMI Result enum value if succedeed, otherwise - INVALID_ENUM
+ * value
+ */
+ static hmi_apis::Common_Result::eType HMIResultFromString(
+ const std::string& hmi_result);
+
+ /**
+ * @brief Converts mobile Result enum value to string
+ * @param mobile_result mobile Result enum value
+ * @return stringified value for enum if succedeed, otherwise - empty string
+ */
+ static std::string MobileResultToString(
+ mobile_apis::Result::eType mobile_result);
+
+ /**
+ * @brief Converts string to mobile Result enum value
+ * @param mobile_result stringified value
+ * @return mobile Result enum value if succedeed, otherwise - INVALID_ENUM
+ * value
+ */
+ static mobile_api::Result::eType MobileResultFromString(
+ const std::string& mobile_result);
+
+ /**
+ * @brief Converts HMI Result enum value to mobile Result enum value
+ * @param hmi_result HMI Result enum value
+ * @return mobile Result enum value if succedeed, otherwise - INVALID_ENUM
+ * value
+ */
+ static mobile_api::Result::eType HMIToMobileResult(
+ const hmi_apis::Common_Result::eType hmi_result);
+
+ /**
+ * @brief Converts mobile Result enum value to HMI Result enum value
+ * @param mobile_result mobile Result enum value
+ * @return HMI Result enum value
+ */
+ static hmi_apis::Common_Result::eType MobileToHMIResult(
+ const mobile_api::Result::eType mobile_result);
+
+ /**
+ * @brief Convert string to HMI level, if possible
+ * @param hmi_level Stringified HMI level
+ * @return Appropriate enum from HMI level, or INVALID_ENUM, if conversiion
+ * is not possible
+ */
+ static mobile_api::HMILevel::eType StringToHMILevel(
const std::string& hmi_level);
- /*
- * @brief Used to obtain string representation of app's
- * HMI Level.
- * @param hmi_level Desired HMI Level
- */
- static std::string StringifiedHMILevel(
+ /*
+ * @brief Used to obtain string representation of app's
+ * HMI Level.
+ * @param hmi_level Desired HMI Level
+ */
+ static std::string StringifiedHMILevel(
mobile_apis::HMILevel::eType hmi_level);
- /*
- * @brief Used to obtain function name by its id
- * @param function_id Function ID
- */
- static std::string StringifiedFunctionID(
+ /*
+ * @brief Used to obtain function name by its id
+ * @param function_id Function ID
+ */
+ static std::string StringifiedFunctionID(
mobile_apis::FunctionID::eType function_id);
- static smart_objects::SmartObjectSPtr CreateBlockedByPoliciesResponse(
+ static smart_objects::SmartObjectSPtr CreateBlockedByPoliciesResponse(
mobile_apis::FunctionID::eType function_id,
- mobile_apis::Result::eType result, uint32_t correlation_id,
+ mobile_apis::Result::eType result,
+ uint32_t correlation_id,
uint32_t connection_key);
- /*
- * @brief Prepare GetDeviceListResponse
- *
- *
- * @param devices Devices list
- *
- */
- static smart_objects::SmartObjectSPtr CreateDeviceListSO(
- const connection_handler::DeviceMap& devices);
-
- static smart_objects::SmartObjectSPtr CreateModuleInfoSO(
- uint32_t function_id);
-
- static smart_objects::SmartObjectSPtr CreateSetAppIcon(
- const std::string& path_to_icon, uint32_t app_id);
-
- /**
- * @brief Sends IVI subscription requests
- */
- static bool SendIVISubscribtions(const uint32_t app_id);
-
- /**
- * @brief Returns IVI subscription requests
- */
- static smart_objects::SmartObjectList GetIVISubscriptionRequests(ApplicationSharedPtr app);
-
- /**
- * @brief Sends button subscription notification
- */
- static void SendOnButtonSubscriptionNotification(
- uint32_t app_id, hmi_apis::Common_ButtonName::eType button, bool is_subscribed);
-
- /**
- * @brief Sends button subscription notifications for all buttons
- * that application is subscribed on
- */
- static void SendAllOnButtonSubscriptionNotificationsForApp(
- ApplicationConstSharedPtr app);
-
- static void SendAppDataToHMI(ApplicationConstSharedPtr app);
- static void SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app);
- static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI(ApplicationConstSharedPtr app);
-
- static smart_objects::SmartObjectSPtr CreateAppVrHelp(
- ApplicationConstSharedPtr app);
-
- static smart_objects::SmartObjectList CreateShowRequestToHMI(ApplicationConstSharedPtr app);
- static void SendShowRequestToHMI(ApplicationConstSharedPtr app);
- static void SendShowConstantTBTRequestToHMI(ApplicationConstSharedPtr app);
- static void SendAddCommandRequestToHMI(ApplicationConstSharedPtr app);
- static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(ApplicationConstSharedPtr app);
-
- /**
- * @brief Sends UI_ChangeRegistration to HMI with list of AppHMIType
- * @param app applicaton instace
- */
- static void SendUIChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app);
- static void SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app);
- static void SendAddVRCommandToHMI(
- uint32_t cmd_id, const smart_objects::SmartObject& vr_commands,
- uint32_t app_id);
-
- static smart_objects::SmartObjectSPtr CreateAddVRCommandToHMI(
- uint32_t cmd_id, const smart_objects::SmartObject& vr_commands,
- uint32_t app_id);
-
- /*
- * @brief Create Common.HMIApplication struct application instance
- * @param app : applicaton instace
- * @param output smart object to store Common.HMIApplication struct
- * @return true on succes, otherwise return false;
- */
- static bool CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
- smart_objects::SmartObject& output);
-
- static void SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app);
- static smart_objects::SmartObjectList CreateAddSubMenuRequestToHMI(ApplicationConstSharedPtr app);
+ /*
+ * @brief Prepare GetDeviceListResponse
+ *
+ *
+ * @param devices Devices list
+ *
+ */
+ static smart_objects::SmartObjectSPtr CreateDeviceListSO(
+ const connection_handler::DeviceMap& devices);
+
+ static smart_objects::SmartObjectSPtr CreateModuleInfoSO(
+ uint32_t function_id);
+
+ static smart_objects::SmartObjectSPtr CreateSetAppIcon(
+ const std::string& path_to_icon, uint32_t app_id);
+
+ /**
+ * @brief Sends IVI subscription requests
+ */
+ static bool SendIVISubscribtions(const uint32_t app_id);
+
+ /**
+ * @brief Returns IVI subscription requests
+ */
+ static smart_objects::SmartObjectList GetIVISubscriptionRequests(
+ ApplicationSharedPtr app);
+
+ /**
+ * @brief Sends button subscription notification
+ */
+ static void SendOnButtonSubscriptionNotification(
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button,
+ const bool is_subscribed);
+
+ /**
+ * @brief Sends button subscription notifications for all buttons
+ * that application is subscribed on
+ */
+ static void SendAllOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app);
- /*
- * @brief Creates BasicCommunication.OnAppUnregistered notification
- * @param app Application instance
- * @param is_unexpected_disconnect
- * Indicates if connection was unexpectedly lost by TM or HB
- */
- static void SendOnAppUnregNotificationToHMI(ApplicationConstSharedPtr app,
- bool is_unexpected_disconnect = false);
- static uint32_t SendActivateAppToHMI(
- uint32_t const app_id,
- hmi_apis::Common_HMILevel::eType level = hmi_apis::Common_HMILevel::FULL,
- bool send_policy_priority = true);
+ static void SendAppDataToHMI(ApplicationConstSharedPtr app);
+ static void SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app);
+ static smart_objects::SmartObjectList CreateGlobalPropertiesRequestsToHMI(
+ ApplicationConstSharedPtr app);
- static void SendOnResumeAudioSourceToHMI(const uint32_t app_id);
+ static smart_objects::SmartObjectSPtr CreateAppVrHelp(
+ ApplicationConstSharedPtr app);
- static std::string GetDeviceMacAddressForHandle(
- const uint32_t device_handle);
+ static smart_objects::SmartObjectList CreateShowRequestToHMI(
+ ApplicationConstSharedPtr app);
+ static void SendShowRequestToHMI(ApplicationConstSharedPtr app);
+ static void SendShowConstantTBTRequestToHMI(ApplicationConstSharedPtr app);
+ static void SendAddCommandRequestToHMI(ApplicationConstSharedPtr app);
+ static smart_objects::SmartObjectList CreateAddCommandRequestToHMI(
+ ApplicationConstSharedPtr app);
- static void GetDeviceInfoForHandle(const uint32_t device_handle,
- policy::DeviceParams* device_info);
- static void GetDeviceInfoForApp(uint32_t connection_key,
- policy::DeviceParams* device_info);
+ static smart_objects::SmartObjectList
+ CreateAddVRCommandRequestFromChoiceToHMI(ApplicationConstSharedPtr app);
- /**
- * @brief Send SDL_ActivateApp response to HMI
- * @param permissions response parameters
- */
- static void SendSDLActivateAppResponse(policy::AppPermissions& permissions,
- uint32_t correlation_id);
+ /**
+ * @brief Sends UI_ChangeRegistration to HMI with list of AppHMIType
+ * @param app applicaton instace
+ */
+ static void SendUIChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app);
+ static void SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app);
+ static void SendAddVRCommandToHMI(
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id);
+
+ static smart_objects::SmartObjectSPtr CreateAddVRCommandToHMI(
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id);
+
+ /*
+ * @brief Create Common.HMIApplication struct application instance
+ * @param app : applicaton instace
+ * @param output smart object to store Common.HMIApplication struct
+ * @return true on succes, otherwise return false;
+ */
+ static bool CreateHMIApplicationStruct(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ smart_objects::SmartObject* output);
+
+ static void SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app);
+ static smart_objects::SmartObjectList CreateAddSubMenuRequestToHMI(
+ ApplicationConstSharedPtr app);
- /**
- * @brief Send OnSDLConsentNeeded to HMI for device data consent by user
- * @param device_info Device info, e.g. mac, handle, name
+ /*
+ * @brief Creates BasicCommunication.OnAppUnregistered notification
+ * @param app Application instance
+ * @param is_unexpected_disconnect
+ * Indicates if connection was unexpectedly lost by TM or HB
+ */
+ static void SendOnAppUnregNotificationToHMI(
+ ApplicationConstSharedPtr app,
+ const bool is_unexpected_disconnect = false);
+
+ static smart_objects::SmartObjectSPtr GetBCActivateAppRequestToHMI(ApplicationConstSharedPtr app,
+ const hmi_apis::Common_HMILevel::eType level,
+ const bool send_policy_priority = true);
+
+ static void SendOnResumeAudioSourceToHMI(const uint32_t app_id);
+
+ /**
+ * @brief Send SDL_ActivateApp response to HMI
+ * @param permissions response parameters
+ */
+ static void SendSDLActivateAppResponse(policy::AppPermissions& permissions,
+ const uint32_t correlation_id);
+
+ /**
+ * @brief Send OnSDLConsentNeeded to HMI for device data consent by user
+ * @param device_info Device info, e.g. mac, handle, name
+ */
+ static void SendOnSDLConsentNeeded(const policy::DeviceParams& device_info);
+
+ /**
+ * @brief Send request to SyncP process to read file and send
+ * Policy Table Snapshot using Retry Strategy
+ * @param file_path Path to file with PTS
+ * @param timeout Timeout to wait for PTU
+ * @param retries Seconds between retries
*/
- static void SendOnSDLConsentNeeded(const policy::DeviceParams& device_info);
-
- /**
- * @brief Send request to SyncP process to read file and send
- * Policy Table Snapshot using Retry Strategy
- * @param file_path Path to file with PTS
- * @param timeout Timeout to wait for PTU
- * @param retries Seconds between retries
- */
- static void SendPolicyUpdate(const std::string& file_path,
- int timeout,
- const std::vector<int>& retries);
-
- /**
- * @brief Send GetUserFriendlyMessage response to HMI
- * @param msg Appopriate messages params
- * @param correlation_id Correlation id of request
- */
- static void SendGetUserFriendlyMessageResponse(
+ static void SendPolicyUpdate(const std::string& file_path,
+ const int timeout,
+ const std::vector<int>& retries);
+
+ /**
+ * @brief Send GetUserFriendlyMessage response to HMI
+ * @param msg Appopriate messages params
+ * @param correlation_id Correlation id of request
+ */
+ static void SendGetUserFriendlyMessageResponse(
const std::vector<policy::UserFriendlyMessage>& msg,
- uint32_t correlation_id);
-
- /**
- * @brief Send GetListOfPermissions response to HMI
- * @param permissions Array of groups permissions
- * @param correlation_id Correlation id of request
- */
- static void SendGetListOfPermissionsResponse(
+ const uint32_t correlation_id);
+
+ /**
+ * @brief Send GetListOfPermissions response to HMI
+ * @param permissions Array of groups permissions
+ * @param correlation_id Correlation id of request
+ */
+ static void SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
- uint32_t correlation_id);
-
- /*
- * @brief Sends notification to HMI to start video streaming
- *
- * @param connection_key Application connection key
- *
- */
- static void SendNaviStartStream(int32_t connection_key);
-
- /*
- * @brief Sends notification to HMI to stop video streaming
- *
- * @param connection_key Application connection key
- *
- */
- static void SendNaviStopStream(int32_t connection_key);
-
- /*
- * @brief Send notification for Update of Policy Table
- * with PT Snapshot.
- * @param connection_key Id of application to send message to
- * @param policy_data PT Snapshot
- * @param url If empty string, no URL is provided
- * @param timeout If -1 no timeout is provdied
- */
- static void SendPolicySnapshotNotification(
- unsigned int connection_key, const std::vector<uint8_t>& policy_data,
- const std::string& url = "", int timeout = -1);
+ const uint32_t correlation_id);
+
+ /*
+ * @brief Sends notification to HMI to start video streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendNaviStartStream(const int32_t app_id);
+
+ /*
+ * @brief Sends notification to HMI to stop video streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendNaviStopStream(const int32_t app_id);
+
+ /*
+ * @brief Send notification for Update of Policy Table
+ * with PT Snapshot.
+ * @param connection_key Id of application to send message to
+ * @param policy_data PT Snapshot
+ * @param url If empty string, no URL is provided
+ * @param timeout If -1 no timeout is provdied
+ */
+ static void SendPolicySnapshotNotification(const unsigned int connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url = "");
+
+ static void SendSystemRequestNotification(
+ const uint32_t connection_key,
+ NsSmartDeviceLink::NsSmartObjects::SmartObject*& content);
+
+ /**
+ * @brief SendLaunchApp allows to send OnSystemRequest with LAUNCH_UP.
+ *
+ * @param connection_key application id.
+ *
+ * @param urlSchema application's url schema.
+ *
+ * @param packageName application's package name.
+ */
+ static void SendLaunchApp(const uint32_t connection_key,
+ const std::string& urlSchema,
+ const std::string& packageName);
+
+ /**
+ * @brief Sends OnSystemRequest which queries remote apps list
+ * @param connection_key application id, which is used for sending out
+ */
+ static void SendQueryApps(const uint32_t connection_key);
+
+ /*
+ * @brief Send notification to mobile on application permissions update
+ * @param connection_key Id of application to send message to
+ * @param permissions updated permissions for application
+ */
+ static void SendOnPermissionsChangeNotification(
+ const uint32_t connection_key, const policy::Permissions& permissions);
+
+ /*
+ * @brief Send notification to HMI on application permissions update
+ * @param connection_key Id of application to send message to
+ * @param permissions updated permissions for application
+ */
+ static void SendOnAppPermissionsChangedNotification(
+ const uint32_t connection_key, const policy::AppPermissions& permissions);
+
+ /**
+ * @brief Send GetStatusUpdate response to HMI with current policy update
+ * status
+ * @param status Update status
+ * @param correlation_id Correlation id from request
+ */
+ static void SendGetStatusUpdateResponse(const std::string& status,
+ const uint32_t correlation_id);
+
+ /**
+ * @brief Send UpdateSDL response to HMI with policy update result
+ * @param result Update result
+ * @param correlation_id Correlation id from request
+ */
+ static void SendUpdateSDLResponse(const std::string& result,
+ const uint32_t correlation_id);
+
+ /**
+ * @brief Send OnStatusUpdate to HMI on policy update status change
+ * @param status Policy table update status
+ */
+ static void SendOnStatusUpdate(const std::string& status);
+
+ /**
+ * @brief Send GetSystemInfo request to HMI
+ */
+ static void SendGetSystemInfoRequest();
+
+ /*
+ * @brief Sends notification to HMI to start audio streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendAudioStartStream(const int32_t app_id);
+
+ /*
+ * @brief Sends notification to HMI to stop audio streaming
+ *
+ * @param connection_key Application connection key
+ *
+ */
+ static void SendAudioStopStream(const int32_t connection_key);
+
+ static void SendOnDataStreaming(const protocol_handler::ServiceType service,
+ const bool available);
+
+ /*
+ * @brief Sends notification to HMI to stop audioPathThru
+ *
+ * @param connection_key Application connection key
+ *
+ * @return TRUE on SUCCES otherwise return FALSE
+ */
+ static bool SendStopAudioPathThru();
+
+ static smart_objects::SmartObjectSPtr CreateNegativeResponse(
+ uint32_t connection_key,
+ int32_t function_id,
+ uint32_t correlation_id,
+ int32_t result_code);
+
+ /*
+ * @brief Verify image and add image file full path
+ *
+ * @param SmartObject with image
+ *
+ * @param app current application
+ *
+ * @return verification result
+ *
+ */
+ static mobile_apis::Result::eType VerifyImage(
+ smart_objects::SmartObject& image, ApplicationConstSharedPtr app);
+
+ /*
+ * @brief Finds "Image" structure in request and verify image file presence
+ * in Core.
+ *
+ * @param message SmartObject with request
+ *
+ * @param app current application
+ *
+ * @return verification result
+ *
+ */
+ static mobile_apis::Result::eType VerifyImageFiles(
+ smart_objects::SmartObject& message, ApplicationConstSharedPtr app);
- static void SendSystemRequestNotification(
- uint32_t connection_key,
- NsSmartDeviceLink::NsSmartObjects::SmartObject& content);
+ static mobile_apis::Result::eType VerifyImageVrHelpItems(
+ smart_objects::SmartObject& message, ApplicationConstSharedPtr app);
- /**
- * @brief SendLaunchApp allows to send OnSystemRequest with LAUNCH_UP.
- *
- * @param connection_key application id.
- *
- * @param urlSchema application's url schema.
- *
- * @param packageName application's package name.
- */
- static void SendLaunchApp(uint32_t connection_key,
- const std::string& urlSchema,
- const std::string& packageName);
+ /**
+ * @brief Checks string if it contains incorrect character \t\n \\t \\n
+ * or string contains only whitespace
+ * @param parameter str contains string which must be checked
+ * @return returns FALSE if string contains incorrect character or
+ * string is empty otherwise returns TRUE
+ */
+ static bool VerifySoftButtonString(const std::string& str);
- /**
- * @brief Sends OnSystemRequest which queries remote apps list
- * @param connection_key application id, which is used for sending out
- */
- static void SendQueryApps(uint32_t connection_key);
+ static mobile_apis::Result::eType ProcessSoftButtons(
+ smart_objects::SmartObject& message_params,
+ ApplicationConstSharedPtr app);
- /*
- * @brief Send notification to mobile on application permissions update
- * @param connection_key Id of application to send message to
- * @param permissions updated permissions for application
- */
- static void SendOnPermissionsChangeNotification(
- uint32_t connection_key, const policy::Permissions& permissions);
+ /**
+ * @brief checkWithPolicy allows to check soft button's parameters
+ * according to the current policy
+ * @param system_action system action
+ * @param app_mobile_id policy application id
+ * @return
+ */
+ static bool CheckWithPolicy(mobile_apis::SystemAction::eType system_action,
+ const std::string& app_mobile_id);
+
+ /*
+ * @brief subscribe application to softbutton
+ *
+ * @param message_params contains data of request
+ *
+ * @param app current application
+ *
+ * @param function_id Unique command id from mobile API
+ */
+ static void SubscribeApplicationToSoftButton(
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
+ int32_t function_id);
- /*
- * @brief Send notification to HMI on application permissions update
- * @param connection_key Id of application to send message to
- * @param permissions updated permissions for application
- */
- static void SendOnAppPermissionsChangedNotification(
- uint32_t connection_key, const policy::AppPermissions& permissions);
+ static bool PrintSmartObject(const smart_objects::SmartObject& object);
- /**
- * @brief Send GetStatusUpdate response to HMI with current policy update
- * status
- * @param status Update status
- * @param correlation_id Correlation id from request
- */
- static void SendGetStatusUpdateResponse(const std::string& status,
- uint32_t correlation_id);
+ template <typename From, typename To>
+ static To ConvertEnumAPINoCheck(const From& input) {
+ return static_cast<To>(input);
+ }
- /**
- * @brief Send UpdateSDL response to HMI with policy update result
- * @param result Update result
- * @param correlation_id Correlation id from request
- */
- static void SendUpdateSDLResponse(const std::string& result,
- uint32_t correlation_id);
+ static const uint32_t GetPriorityCode(const std::string& priority);
- /**
- * @brief Send OnStatusUpdate to HMI on policy update status change
- * @param status Policy table update status
- */
- static void SendOnStatusUpdate(const std::string& status);
+ /**
+ * @brief Convert common language to string representation
+ * @param language Common language
+ * @return Common language string representation
+ */
+ static std::string CommonLanguageToString(
+ hmi_apis::Common_Language::eType language);
/**
- * @brief Send GetSystemInfo request to HMI
- */
- static void SendGetSystemInfoRequest();
-
- /*
- * @brief Sends notification to HMI to start audio streaming
- *
- * @param connection_key Application connection key
- *
- */
- static void SendAudioStartStream(int32_t connection_key);
-
- /*
- * @brief Sends notification to HMI to stop audio streaming
- *
- * @param connection_key Application connection key
- *
- */
- static void SendAudioStopStream(int32_t connection_key);
-
- static void SendOnDataStreaming(protocol_handler::ServiceType service,
- bool available);
-
- /*
- * @brief Sends notification to HMI to stop audioPathThru
- *
- * @param connection_key Application connection key
- *
- * @return TRUE on SUCCES otherwise return FALSE
- */
- static bool SendStopAudioPathThru();
-
- static smart_objects::SmartObjectSPtr CreateNegativeResponse(
- uint32_t connection_key, int32_t function_id, uint32_t correlation_id,
- int32_t result_code);
-
- /*
- * @brief Verify image and add image file full path
- *
- * @param SmartObject with image
- *
- * @param app current application
- *
- * @return verification result
- *
- */
- static mobile_apis::Result::eType VerifyImage(smart_objects::SmartObject& image,
- ApplicationConstSharedPtr app);
-
- /*
- * @brief Finds "Image" structure in request and verify image file presence
- * in Core.
- *
- * @param message SmartObject with request
- *
- * @param app current application
- *
- * @return verification result
- *
+ * @brief Converts string to common language enum value
+ * @param language language as string
+ * @return Common language enum value
*/
- static mobile_apis::Result::eType VerifyImageFiles(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app);
-
- static mobile_apis::Result::eType VerifyImageVrHelpItems(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app);
+ static hmi_apis::Common_Language::eType CommonLanguageFromString(
+ const std::string& language);
/**
- * @brief Checks string if it contains incorrect character \t\n \\t \\n
- * or string contains only whitespace
- * @param parameter str contains string which must be checked
- * @return returns FALSE if string contains incorrect character or
- * string is empty otherwise returns TRUE
+ * @brief Converts mobile language to string representation
+ * @param language Mobile language
+ * @return Mobile language string representation
*/
- static bool VerifySoftButtonString(const std::string& str);
-
- static mobile_apis::Result::eType ProcessSoftButtons(
- smart_objects::SmartObject& message_params,
- ApplicationConstSharedPtr app);
+ static std::string MobileLanguageToString(
+ const mobile_apis::Language::eType language);
/**
- * @brief checkWithPolicy allows to check soft button's parameters
- * according to the current policy
- * @param system_action system action
- * @param app_mobile_id policy application id
- * @return
- */
- static bool CheckWithPolicy(mobile_apis::SystemAction::eType system_action,
- const std::string& app_mobile_id);
-
- /*
- * @brief subscribe application to softbutton
- *
- * @param message_params contains data of request
- *
- * @param app current application
- *
- * @param function_id Unique command id from mobile API
+ * @brief Converts string to mobile language enum value
+ * @param language language as string
+ * @return Mobile language enum value
*/
- static void SubscribeApplicationToSoftButton(
- smart_objects::SmartObject& message_params,
- ApplicationSharedPtr app,
- int32_t function_id);
-
- static bool PrintSmartObject(const smart_objects::SmartObject& object);
-
- template<typename From, typename To>
- static To ConvertEnumAPINoCheck(const From& input) {
- return static_cast<To>(input);
- }
+ static mobile_apis::Language::eType MobileLanguageFromString(
+ const std::string& language);
/**
- * @brief Convert common language to string representation
- * @param language Common language
- * @return Common language string representation
+ * @brief Converts mobile language enum to HMI language enum
+ * @param language Mobile language enum
+ * @return HMI language enum
*/
- static std::string CommonLanguageToString(
- hmi_apis::Common_Language::eType language);
+ static hmi_apis::Common_Language::eType MobileToCommonLanguage(
+ const mobile_apis::Language::eType language);
/**
- * @brief Converts string to common language enum value
- * @param language language as string
- * @return Common language enum value
+ * @brief Converts HMI language enum to mobile language enum
+ * @param language HMI language enum
+ * @return Mobile language enum
*/
- static hmi_apis::Common_Language::eType CommonLanguageFromString(
- const std::string& language);
+ static mobile_apis::Language::eType CommonToMobileLanguage(
+ const hmi_apis::Common_Language::eType language);
/**
* @brief Gets command limit number per minute for specific application
@@ -540,7 +633,7 @@ class MessageHelper {
* with empty helpPrompt array.
*/
static void SendTTSGlobalProperties(
- ApplicationSharedPtr app, bool default_help_prompt);
+ ApplicationSharedPtr app, const bool default_help_prompt);
/**
* @brief SendSetAppIcon allows to send SetAppIcon request.
@@ -549,19 +642,34 @@ class MessageHelper {
*
* @param icon_path path to the icon.
*/
- static void SendSetAppIcon(uint32_t app_id,
- const std::string& icon_path);
+ static void SendSetAppIcon(const uint32_t app_id, const std::string& icon_path);
+
+ /**
+ * @brief Sends DecryptCertificate request to HMI
+ * @param file_name path to file containing encrypted certificate
+ */
+ static void SendDecryptCertificateToHMI(const std::string& file_name);
+
private:
/**
+ * @brief Creates new request object and fill its header
+ * @return New request object
+ */
+ static smart_objects::SmartObjectSPtr CreateRequestObject();
+
+ /**
* @brief Allows to fill SO according to the current permissions.
* @param permissions application permissions.
* @param message which should be filled.
*/
- static void FillAppRevokedPermissions(const policy::AppPermissions& permissions,
- smart_objects::SmartObject& message);
+ static void FillAppRevokedPermissions(
+ const policy::AppPermissions& permissions,
+ smart_objects::SmartObject& message);
static smart_objects::SmartObjectSPtr CreateChangeRegistration(
- int32_t function_id, int32_t language, uint32_t app_id,
+ const int32_t function_id,
+ const int32_t language,
+ const uint32_t app_id,
const smart_objects::SmartObject* app_types = NULL);
MessageHelper();
diff --git a/src/components/application_manager/include/application_manager/mobile_command_factory.h b/src/components/application_manager/include/application_manager/mobile_command_factory.h
index b28e0abb34..997e973828 100644
--- a/src/components/application_manager/include/application_manager/mobile_command_factory.h
+++ b/src/components/application_manager/include/application_manager/mobile_command_factory.h
@@ -51,7 +51,7 @@ class MobileCommandFactory {
* @param smartObject SmartObject shared pointer.
* @return Pointer to created command object.
**/
- static commands::Command* CreateCommand(
+ static CommandSharedPtr CreateCommand(
const commands::MessageSharedPtr& message,
commands::Command::CommandOrigin origin);
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler.h b/src/components/application_manager/include/application_manager/policies/policy_handler.h
index 39ab4205dd..74843e0380 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -37,6 +37,7 @@
#include <map>
#include <set>
#include <vector>
+#include <cstdint>
#include "policy/policy_manager.h"
#include "application_manager/policies/policy_event_observer.h"
#include "application_manager/policies/delegates/statistics_delegate.h"
@@ -46,6 +47,7 @@
#include "utils/threads/thread_delegate.h"
#include "utils/conditional_variable.h"
#include "utils/rwlock.h"
+#include "utils/custom_string.h"
#include "usage_statistics/statistics_manager.h"
#include "application_manager/policies/policy_handler_observer.h"
#include "utils/threads/async_runner.h"
@@ -58,11 +60,13 @@ class Value;
namespace policy {
typedef std::vector<uint32_t> AppIds;
typedef std::vector<uint32_t> DeviceHandles;
+namespace custom_str = utils::custom_string;
-class PolicyHandler :
- public utils::Singleton<PolicyHandler, utils::deleters::Deleter<PolicyHandler> >,
- public PolicyListener,
- public threads::AsyncRunner {
+class PolicyHandler
+ : public utils::Singleton<PolicyHandler,
+ utils::deleters::Deleter<PolicyHandler> >,
+ public PolicyListener,
+ public threads::AsyncRunner {
public:
virtual ~PolicyHandler();
bool LoadPolicyLibrary();
@@ -81,34 +85,32 @@ class PolicyHandler :
virtual void OnPermissionsUpdated(const std::string& policy_app_id,
const Permissions& permissions);
- virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
- const std::vector<int>& retry_delay_seconds,
- int timeout_exchange);
+ void OnSnapshotCreated(const BinaryMessage& pt_string) OVERRIDE;
bool GetPriority(const std::string& policy_app_id, std::string* priority);
void CheckPermissions(const PTString& app_id,
- const PTString& hmi_level,
- const PTString& rpc,
- const RPCParams& rpc_params,
- CheckPermissionResult& result);
+ const PTString& hmi_level,
+ const PTString& rpc,
+ const RPCParams& rpc_params,
+ CheckPermissionResult& result);
uint32_t GetNotificationsNumber(const std::string& priority);
DeviceConsent GetUserConsentForDevice(const std::string& device_id);
bool GetDefaultHmi(const std::string& policy_app_id,
- std::string* default_hmi);
+ std::string* default_hmi);
bool GetInitialAppData(const std::string& application_id,
- StringArray* nicknames = NULL,
- StringArray* app_hmi_types = NULL);
+ StringArray* nicknames = NULL,
+ StringArray* app_hmi_types = NULL);
void GetServiceUrls(const std::string& service_type,
EndpointUrls& end_points);
std::string GetLockScreenIconUrl() const;
void ResetRetrySequence();
- int NextRetryTimeout();
+ uint32_t NextRetryTimeout();
int TimeoutExchange();
void OnExceededTimeout();
void OnSystemReady();
- void PTUpdatedAt(int kilometers, int days_after_epoch);
+ void PTUpdatedAt(Counters counter, int value);
void add_listener(PolicyHandlerObserver* listener);
void remove_listener(PolicyHandlerObserver* listener);
@@ -139,11 +141,11 @@ class PolicyHandler :
/**
* @brief Process user consent on mobile data connection access
- * @param Device id or 0, if concern to all SDL functionality
+ * @param Device id or empty string, if concern to all SDL functionality
* @param User consent from response
*/
void OnAllowSDLFunctionalityNotification(bool is_allowed,
- uint32_t device_id = 0);
+ const std::string& device_id);
/**
* @brief Increment counter for ignition cycles
@@ -159,6 +161,14 @@ class PolicyHandler :
void PTExchangeAtUserRequest(uint32_t correlation_id);
/**
+ * @brief Add's device to policy table
+ * @param device_id Device mac address
+ * @param connection_type Device connection type
+ */
+ void AddDevice(const std::string& device_id,
+ const std::string& connection_type);
+
+ /**
* @brief Save device info for specific device to policy table
* @param device_id Device mac address
* @param device_info Device params
@@ -172,7 +182,7 @@ class PolicyHandler :
* @param permissions User-changed group permissions consent
*/
void OnAppPermissionConsent(const uint32_t connection_key,
- const PermissionConsent &permissions);
+ const PermissionConsent& permissions);
/**
* @brief Get appropriate message parameters and send them with response
@@ -212,7 +222,7 @@ class PolicyHandler :
* application
* @param policy_app_id Application id
*/
- std::string OnCurrentDeviceIdUpdateRequired(const std::string& policy_app_id);
+ std::string OnCurrentDeviceIdUpdateRequired(const std::string& policy_app_id);
/**
* @brief Set parameters from OnSystemInfoChanged to policy table
@@ -233,7 +243,7 @@ class PolicyHandler :
/**
* @brief Send request to HMI to get update on system parameters
*/
- virtual void OnSystemInfoUpdateRequired();
+ void OnSystemInfoUpdateRequired() OVERRIDE;
/**
* @brief Sends GetVehicleData request in case when Vechicle info is ready.
@@ -270,20 +280,21 @@ class PolicyHandler :
*/
uint32_t GetAppIdForSending();
- std::string GetAppName(const std::string& policy_app_id);
+ custom_str::CustomString GetAppName(const std::string& policy_app_id);
- virtual void OnUpdateHMIAppType(std::map<std::string, StringArray> app_hmi_types);
+ void OnUpdateHMIAppType(
+ std::map<std::string, StringArray> app_hmi_types) OVERRIDE;
- virtual void OnCertificateUpdated(const std::string& certificate_data);
+ void OnCertificateUpdated(const std::string& certificate_data) OVERRIDE;
- virtual bool CanUpdate();
+ bool CanUpdate() OVERRIDE;
- virtual void OnDeviceConsentChanged(const std::string& device_id,
- bool is_allowed);
+ void OnDeviceConsentChanged(const std::string& device_id,
+ bool is_allowed) OVERRIDE;
virtual void OnPTExchangeNeeded();
- virtual void GetAvailableApps(std::queue<std::string>& apps);
+ void GetAvailableApps(std::queue<std::string>& apps) OVERRIDE;
/**
* @brief Allows to add new or update existed application during
@@ -307,10 +318,10 @@ class PolicyHandler :
/**
* Returns heart beat timeout
* @param app_id application id
- * @return if timeout was set then value in seconds greater zero
+ * @return if timeout was set then value in milliseconds greater zero
* otherwise heart beat for specific application isn't set
*/
- uint16_t HeartBeatTimeout(const std::string& app_id) const;
+ uint32_t HeartBeatTimeout(const std::string& app_id) const;
/**
* @brief Returns URL for querying list of remote apps
@@ -344,7 +355,22 @@ class PolicyHandler :
const std::vector<std::string> GetAppRequestTypes(
const std::string& policy_app_id) const;
-//TODO(AKutsan) REMOVE THIS UGLY HOTFIX
+ /**
+ * @brief Gets vehicle information
+ * @return Structure with vehicle information
+ */
+ const VehicleInfo GetVehicleInfo() const;
+
+ /**
+ * @brief OnAppRegisteredOnMobile alows to handle event when application were
+ * succesfully registered on mobile device.
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param application_id registered application.
+ */
+ void OnAppRegisteredOnMobile(const std::string& application_id);
+
+ // TODO(AKutsan) REMOVE THIS UGLY HOTFIX
virtual void Increment(usage_statistics::GlobalCounterId type);
virtual void Increment(const std::string& app_id,
usage_statistics::AppCounterId type);
@@ -355,20 +381,28 @@ class PolicyHandler :
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds);
-protected:
+#ifdef BUILD_TESTS
+ void SetPolicyManager(utils::SharedPtr<PolicyManager> pm) {
+ policy_manager_ = pm;
+ }
+#endif // BUILD_TESTS
+#ifdef ENABLE_SECURITY
+ std::string RetrieveCertificate() const;
+#endif // ENABLE_SECURITY
+ protected:
/**
* Starts next retry exchange policy table
*/
void StartNextRetry();
private:
-
/**
* Checks system action of application for permission of keep context
* @param system_action system action (see mobile api)
* @param policy_app_id unique application id
- * @return false if system_action is KEEP_CONTEXT and it isn't allowed by policy
+ * @return false if system_action is KEEP_CONTEXT and it isn't allowed by
+ * policy
* otherwise true
*/
bool CheckKeepContext(const std::string& policy_app_id);
@@ -377,7 +411,8 @@ protected:
* Checks system action of application for permission of steal focus
* @param system_action system action (see mobile api)
* @param policy_app_id unique application id
- * @return false if system_action is STEAL_FOCUS and it isn't allowed by policy
+ * @return false if system_action is STEAL_FOCUS and it isn't allowed by
+ * policy
* otherwise true
*/
bool CheckStealFocus(const std::string& policy_app_id);
@@ -391,40 +426,39 @@ protected:
*/
void OnAppPermissionConsentInternal(const uint32_t connection_key,
PermissionConsent& permissions);
-private:
- class StatisticManagerImpl: public usage_statistics::StatisticsManager {
- //TODO(AKutsan) REMOVE THIS UGLY HOTFIX
- virtual void Increment(usage_statistics::GlobalCounterId type) {
-
- PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(type));
- }
-
- virtual void Increment(const std::string& app_id,
- usage_statistics::AppCounterId type) {
-
- PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(app_id,
- type));
- }
-
- virtual void Set(const std::string& app_id,
- usage_statistics::AppInfoId type,
- const std::string& value) {
- PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(app_id,
- type,
- value));
- }
-
- virtual void Add(const std::string& app_id,
- usage_statistics::AppStopwatchId type,
- int32_t timespan_seconds) {
+ /**
+ * @brief Sets days after epoch on successful policy update
+ */
+ void SetDaysAfterEpoch();
- PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(
- app_id, type, timespan_seconds));
- }
+ private:
+ class StatisticManagerImpl : public usage_statistics::StatisticsManager {
+ // TODO(AKutsan) REMOVE THIS UGLY HOTFIX
+ virtual void Increment(usage_statistics::GlobalCounterId type) {
+ PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(type));
+ }
+
+ virtual void Increment(const std::string& app_id,
+ usage_statistics::AppCounterId type) {
+ PolicyHandler::instance()->AsyncRun(new StatisticsDelegate(app_id, type));
+ }
+
+ virtual void Set(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value) {
+ PolicyHandler::instance()->AsyncRun(
+ new StatisticsDelegate(app_id, type, value));
+ }
+
+ virtual void Add(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds) {
+ PolicyHandler::instance()->AsyncRun(
+ new StatisticsDelegate(app_id, type, timespan_seconds));
+ }
};
- //TODO(AKutsan) REMOVE THIS UGLY HOTFIX
-
+ // TODO(AKutsan) REMOVE THIS UGLY HOTFIX
PolicyHandler();
bool SaveSnapshot(const BinaryMessage& pt_string, std::string& snap_path);
@@ -444,7 +478,7 @@ private:
inline bool CreateManager();
- typedef std::list <PolicyHandlerObserver*> HandlersCollection;
+ typedef std::list<PolicyHandlerObserver*> HandlersCollection;
HandlersCollection listeners_;
sync_primitives::Lock listeners_lock_;
@@ -462,8 +496,8 @@ private:
friend class AppPermissionDelegate;
DISALLOW_COPY_AND_ASSIGN(PolicyHandler);
- FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER(PolicyHandler,
- utils::deleters::Deleter<PolicyHandler>);
+ FRIEND_BASE_SINGLETON_CLASS_WITH_DELETER(
+ PolicyHandler, utils::deleters::Deleter<PolicyHandler>);
FRIEND_DELETER_DESTRUCTOR(PolicyHandler);
};
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler_interface.h b/src/components/application_manager/include/application_manager/policies/policy_handler_interface.h
new file mode 100644
index 0000000000..503e8ec8ef
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler_interface.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_INTERFACE_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_INTERFACE_H_
+
+#include "policy/policy_types.h"
+
+namespace policy {
+
+// Current interface created just to be able make unit-testing
+// It should be refactored in task pointed below
+// TODO(AByzhynar) : APPLINK-16112 Create PolicyHandler interface
+
+class PolicyHandlerInterface {
+ public:
+ virtual ~PolicyHandlerInterface() {}
+ virtual void OnSystemReady() = 0;
+ virtual void PTUpdatedAt(Counters counter, int value) = 0;
+};
+
+} // namespace policy
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_INTERFACE_H_
+
diff --git a/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h b/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h
index c9b32b7e17..485fbea45c 100644
--- a/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h
+++ b/src/components/application_manager/include/application_manager/policies/policy_handler_observer.h
@@ -33,12 +33,16 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_OBSERVER_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_POLICY_HANDLER_OBSERVER_H_
+#include <vector>
+#include <string>
+#include <map>
+
namespace policy {
class PolicyHandlerObserver{
public:
- virtual void OnUpdateHMIAppType(std::map<std::string, std::vector<std::string> > app_hmi_types) = 0;
- virtual void OnCertificateUpdated(const std::string& certificate_data) {}
+ virtual void OnUpdateHMIAppType(std::map<std::string, std::vector<std::string> > app_hmi_types) {}
+ virtual bool OnCertificateUpdated(const std::string& certificate_data) { return false;}
virtual ~PolicyHandlerObserver() {}
};
} // namespace policy
diff --git a/src/components/application_manager/include/application_manager/request_controller.h b/src/components/application_manager/include/application_manager/request_controller.h
index cddcd72337..98022516be 100644
--- a/src/components/application_manager/include/application_manager/request_controller.h
+++ b/src/components/application_manager/include/application_manager/request_controller.h
@@ -42,12 +42,12 @@
#include "utils/threads/thread.h"
#include "utils/conditional_variable.h"
#include "utils/threads/thread_delegate.h"
+#include "utils/timer.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "application_manager/request_info.h"
-#include "utils/timer_thread.h"
namespace application_manager {
@@ -263,8 +263,8 @@ class RequestController {
uint32_t pool_size_;
sync_primitives::ConditionalVariable cond_var_;
- std::list<RequestInfoPtr> mobile_request_info_list_;
- sync_primitives::Lock mobile_request_info_list_lock_;
+ std::list<RequestPtr> mobile_request_list_;
+ sync_primitives::Lock mobile_request_list_lock_;
/*
* Requests, that are waiting for responses
@@ -281,8 +281,8 @@ class RequestController {
/*
* timer for checking requests timeout
*/
- timer::TimerThread<RequestController> timer_;
- static const uint32_t dafault_sleep_time_ = UINT_MAX;
+ timer::Timer timer_;
+ static const uint32_t default_sleep_time_ = UINT_MAX;
bool is_low_voltage_;
DISALLOW_COPY_AND_ASSIGN(RequestController);
diff --git a/src/components/application_manager/include/application_manager/request_info.h b/src/components/application_manager/include/application_manager/request_info.h
index 3b48d78d48..71ce7fb0ac 100644
--- a/src/components/application_manager/include/application_manager/request_info.h
+++ b/src/components/application_manager/include/application_manager/request_info.h
@@ -62,20 +62,20 @@ namespace request_controller {
RequestInfo(RequestPtr request,
const RequestType requst_type,
- const uint64_t timeout_sec)
+ const uint64_t timeout_msec)
: request_(request),
- timeout_sec_(timeout_sec) {
+ timeout_msec_(timeout_msec) {
start_time_ = date_time::DateTime::getCurrentTime();
updateEndTime();
requst_type_ = requst_type;
}
RequestInfo(RequestPtr request, const RequestType requst_type,
- const TimevalStruct& start_time, const uint64_t timeout_sec);
+ const TimevalStruct& start_time, const uint64_t timeout_msec);
void updateEndTime();
- void updateTimeOut(const uint64_t& timeout_sec);
+ void updateTimeOut(const uint64_t& timeout_msec);
bool isExpired();
@@ -87,12 +87,12 @@ namespace request_controller {
start_time_ = start_time;
}
- uint64_t timeout_sec() {
- return timeout_sec_;
+ uint64_t timeout_msec() {
+ return timeout_msec_;
}
- void set_timeout_sec(uint64_t timeout) {
- timeout_sec_ = timeout;
+ void set_timeout_msec(uint64_t timeout) {
+ timeout_msec_ = timeout;
}
TimevalStruct end_time() {
@@ -128,7 +128,7 @@ namespace request_controller {
protected:
RequestPtr request_;
TimevalStruct start_time_;
- uint64_t timeout_sec_;
+ uint64_t timeout_msec_;
TimevalStruct end_time_;
uint32_t app_id_;
mobile_apis::HMILevel::eType hmi_level_;
@@ -136,20 +136,20 @@ namespace request_controller {
uint32_t correlation_id_;
};
- typedef utils::SharedPtr<RequestInfo> RequestInfoPtr;
+ typedef utils::SharedPtr<RequestInfo> RequestInfoPtr;
struct MobileRequestInfo: public RequestInfo {
MobileRequestInfo(RequestPtr request,
- const uint64_t timeout_sec);
+ const uint64_t timeout_msec);
MobileRequestInfo(RequestPtr request,
const TimevalStruct& start_time,
- const uint64_t timeout_sec);
+ const uint64_t timeout_msec);
};
struct HMIRequestInfo: public RequestInfo {
- HMIRequestInfo(RequestPtr request, const uint64_t timeout_sec);
+ HMIRequestInfo(RequestPtr request, const uint64_t timeout_msec);
HMIRequestInfo(RequestPtr request, const TimevalStruct& start_time,
- const uint64_t timeout_sec);
+ const uint64_t timeout_msec);
};
// Request info, for searching in request info set by log_n time
@@ -316,10 +316,7 @@ namespace request_controller {
return false;
}
- if (date_time::DateTime::getmSecs(setEntry->start_time())
- < date_time::DateTime::getmSecs(start_) ||
- date_time::DateTime::getmSecs(setEntry->start_time())
- > date_time::DateTime::getmSecs(end_)) {
+ if ((setEntry->start_time() < start_) || (end_ < setEntry->start_time() )) {
return false;
}
diff --git a/src/components/application_manager/include/application_manager/resume_ctrl.h b/src/components/application_manager/include/application_manager/resume_ctrl.h
deleted file mode 100644
index 4d90316365..0000000000
--- a/src/components/application_manager/include/application_manager/resume_ctrl.h
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H
-
-#include <stdint.h>
-#include <vector>
-#include <map>
-#include <set>
-#include <list>
-
-#include "json/json.h"
-#include "interfaces/HMI_API.h"
-#include "interfaces/HMI_API_schema.h"
-#include "interfaces/MOBILE_API_schema.h"
-#include "connection_handler/connection_handler_observer.h"
-#include "connection_handler/device.h"
-#include "application_manager/event_engine/event_observer.h"
-#include "smart_objects/smart_object.h"
-#include "application_manager/application.h"
-#include "utils/timer_thread.h"
-
-namespace application_manager {
-
-namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
-
-class ApplicationManagerImpl;
-class Application;
-class ResumeCtrl: public event_engine::EventObserver {
-
- public:
-
- /**
- * @brief Constructor
- * @param app_mngr ApplicationManager pointer
- */
- explicit ResumeCtrl(ApplicationManagerImpl* app_mngr);
-
- /**
- * @brief Event, that raised if application get resumption response from HMI
- * @param event : event object, that contains smart_object with HMI message
- */
- virtual void on_event(const event_engine::Event& event);
-
- /**
- * @brief Save all applications info to the file system
- */
- void SaveAllApplications();
-
- /**
- * @brief Save application persistent info for future resuming
- * @param application is application witch need to be saved
- */
- void SaveApplication(ApplicationConstSharedPtr application);
-
- /**
- * @brief Set application HMI Level as saved
- * @param application is application witch HMI Level is need to restore
- * @return true if success, otherwise return false
- */
- bool RestoreAppHMIState(ApplicationSharedPtr application);
-
- /**
- * @brief Set application HMI Level as stored in policy
- * @param application is application witch HMI Level is need to setup
- * @return true if success, otherwise return false
- */
- bool SetupDefaultHMILevel(ApplicationSharedPtr application);
-
- /**
- * @brief Setup HmiLevel for application
- * Do routine of setting up hmi_level
- * @param application is application witch HMI Level is need to setup
- * @param hmi_level HMI Level is needed to setup
- * @param hmi_level AudioStreamingState is needed to setup
- * @param check_policy indicate if policy data consent must be verified
- * @return true if success, otherwise return false
- */
- bool SetAppHMIState(ApplicationSharedPtr application,
- const mobile_apis::HMILevel::eType hmi_level,
- bool check_policy = true);
-
- /**
- * @brief Set application HMI Level as saved
- * @param application is application witch HMI Level is need to restore
- * @return true if success, otherwise return false
- */
- bool RestoreApplicationData(ApplicationSharedPtr application);
-
- /**
- * @brief Check if Resume controller have saved instance of application
- * @param application is application witch need to be checked
- * @return true if exist, false otherwise
- */
- bool ApplicationIsSaved(ApplicationConstSharedPtr application);
-
- /**
- * @brief Remove application from list of saved applications
- * @param mobile_app_id application witch need to be removed
- * @return return true, if success, otherwise return false
- */
- bool RemoveApplicationFromSaved(const std::string& mobile_app_id);
-
- /**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- void Suspend();
-
- /**
- * @brief Increments ignition counter for all registered applications
- * and remember ign_off time stamp
- */
- void OnAwake();
-
- /**
- * @brief Method starts timer "RsmCtrlPercist" when SDL receives onAwakeSDL notification
- */
- void StartSavePersistentDataTimer();
-
- /**
- * @brief Method stops timer "RsmCtrlPercist" when SDL receives OnExitAllApplication notification
- * with reason "SUSPEND"
- */
- void StopSavePersistentDataTimer();
-
- /**
- * @brief Method stops restore_hmi_level_timer_ "RsmCtrlRstore" in Suspend()
- */
- void StopRestoreHmiLevelTimer();
-
- /**
- * @brief Start timer for resumption applications
- * Restore D1-D5 data
- * @param application that is need to be restored
- * @return true if it was saved, otherwise return false
- */
- bool StartResumption(ApplicationSharedPtr application, const std::string& hash);
-
- /**
- * @brief Start timer for resumption applications
- * Does not restore D1-D5 data
- * @param application that is need to be restored
- * @return true if it was saved, otherwise return false
- */
- bool StartResumptionOnlyHMILevel(ApplicationSharedPtr application);
-
- /**
- * @brief Check if there are all files need for resumption
- * @param application that is need to be restored
- * @return true if it all files exist, otherwise return false
- */
- bool CheckPersistenceFilesForResumption(ApplicationSharedPtr application);
-
- /**
- * @brief Check application hash
- * @param application that is need to be restored
- * @return true if it was saved, otherwise return false
- */
- bool CheckApplicationHash(ApplicationSharedPtr application, const std::string& hash);
-
- /**
- * @brief Check if Resume controller have saved application with hmi app id
- * @param hmi_app_id - hmi application id
- * @return true if exist, false otherwise
- */
- bool IsHMIApplicationIdExist(uint32_t hmi_app_id);
-
- /**
- * @brief Check if Resume controller have saved instance of application
- * @param mobile_app_id - mobile application id
- * @return true if exist, false otherwise
- */
- bool IsApplicationSaved(const std::string& mobile_app_id);
-
- /**
- * @brief Function is used for application resume. HMI app ID must be
- * the same(PASA VCA module use it for stored app info).
- * Retrieves HMI app ID for the given mobile app ID from stored information.
- *
- * @param mobile_app_id - mobile application id
- * @return HMI app ID
- */
- uint32_t GetHMIApplicationID(const std::string& mobile_app_id);
-
- /**
- * @brief SaveDataOnTimer :
- * Timer callback for persisting ResumptionData each N seconds
- * N gets from property
- */
- void SaveDataOnTimer();
-
- void ClearResumptionInfo();
-
- void ApplicationsDataUpdated() {
- is_data_saved = false;
- }
-
- /**
- * @brief Resume HMI Level and audio streaming state if needed
- * @param application - application to restore hmi level
- * and audio streaming state
- */
- void StartAppHmiStateResumption(ApplicationSharedPtr application);
- /**
- * @brief Update launch_time_ to current
- */
- void ResetLaunchTime();
-
- private:
-
-
- typedef std::pair<uint32_t, uint32_t> application_timestamp;
-
- std::set<ApplicationSharedPtr> retrieve_application();
-
- /**
- * @brief This struct need to map
- * timestamp and application from correlationID
- */
- struct ResumingApp {
- uint32_t old_session_key; // session key is the same as app_id
- ApplicationSharedPtr app;
- };
-
- struct TimeStampComparator {
- bool operator() (const application_timestamp& lhs,
- const application_timestamp& rhs) const{
- return lhs.second < rhs.second;
- }
- };
-
- /**
- * @brief geter for launch_time_
- * @return value of launch_time_
- */
- time_t launch_time() const;
-
- /**
- * @brief Check device MAC address
- *
- * @param application that is need to be restored
- * @param saved_device_mac Saved device MAC address
- *
- * @return TRUE on success, otherwise FALSE
- */
- bool IsDeviceMacAddressEqual(ApplicationSharedPtr application,
- const std::string& saved_device_mac);
- /**
- * @brief Get Resumption section of LastState
- * @return Resumption section of LastState in Json
- */
- Json::Value& GetResumptionData();
-
- /**
- * @brief Get applications for resumption of LastState
- * @return applications for resumption of LastState
- */
- Json::Value& GetSavedApplications();
-
- /**
- * @brief Get the last ignition off time from LastState
- * @return the last ignition off time from LastState
- */
- time_t GetIgnOffTime();
-
- /**
- * @brief Setup IgnOff time to LastState
- * @param ign_off_time - igition off time
- */
- void SetLastIgnOffTime(time_t ign_off_time);
-
- /**
- * @brief Set applications for resumption to LastState
- * @parems apps_json applications to write in LastState
- */
- void SetSavedApplication(Json::Value& apps_json);
-
- Json::Value GetApplicationCommands(
- ApplicationConstSharedPtr application);
- Json::Value GetApplicationSubMenus(
- ApplicationConstSharedPtr application);
- Json::Value GetApplicationInteractionChoiseSets(
- ApplicationConstSharedPtr application);
- Json::Value GetApplicationGlobalProperties(
- ApplicationConstSharedPtr application);
- Json::Value GetApplicationSubscriptions(
- ApplicationConstSharedPtr application);
- Json::Value GetApplicationFiles(
- ApplicationConstSharedPtr application);
- Json::Value GetApplicationShow(
- ApplicationConstSharedPtr application);
-
- Json::Value JsonFromSO(const smart_objects::SmartObject *so);
-
- uint32_t SendHMIRequest(const hmi_apis::FunctionID::eType& function_id,
- const smart_objects::SmartObject* msg_params = NULL,
- bool use_events = false);
-
- bool ProcessHMIRequest(
- smart_objects::SmartObjectSPtr request = NULL,
- bool use_events = false);
-
- void InsertToTimerQueue(uint32_t app_id, uint32_t time_stamp);
-
- /**
- * @brief AddFiles allows to add files for the application
- * which should be resumed
- *
- * @param application application which will be resumed
- *
- * @param saved_app application specific section from backup file
- */
- void AddFiles(ApplicationSharedPtr application, const Json::Value& saved_app);
-
- /**
- * @brief AddSubmenues allows to add sub menues for the application
- * which should be resumed
- *
- * @param application application which will be resumed
- *
- * @param saved_app application specific section from backup file
- */
- void AddSubmenues(ApplicationSharedPtr application, const Json::Value& saved_app);
-
- /**
- * @brief AddCommands allows to add commands for the application
- * which should be resumed
- *
- * @param application application which will be resumed
- *
- * @param saved_app application specific section from backup file
- */
- void AddCommands(ApplicationSharedPtr application, const Json::Value& saved_app);
-
- /**
- * @brief AddChoicesets allows to add choice sets for the application
- * which should be resumed
- *
- * @param application application which will be resumed
- *
- * @param saved_app application specific section from backup file
- */
- void AddChoicesets(ApplicationSharedPtr application, const Json::Value& saved_app);
-
- /**
- * @brief SetGlobalProperties allows to restore global properties.
- *
- * @param application application which will be resumed
- *
- * @param saved_app application specific section from backup file
- */
- void SetGlobalProperties(ApplicationSharedPtr application, const Json::Value& saved_app);
-
- /**
- * @brief AddSubscriptions allows to restore subscriptions
- *
- * @param application application which will be resumed
- *
- * @param saved_app application specific section from backup file
- */
- void AddSubscriptions(ApplicationSharedPtr application, const Json::Value& saved_app);
-
- /**
- * @brief ProcessHMIRequests allows to process obtained requests.
- *
- * @param requests request that should be processed.
- */
- void ProcessHMIRequests(const smart_objects::SmartObjectList& requests);
-
- /**
- * @brief CheckIcons allows to check application icons
- *
- * @param application application under resumtion application
- *
- * @param json_object
- *
- * @return true in case icons exists, false otherwise
- */
- bool CheckIcons(ApplicationSharedPtr application, const Json::Value& json_object);
-
- /**
- * @brief GetFromSavedOrAppend allows to get existed record about application
- * or adds the new one.
- *
- * @param mobile_app_id application id.
- *
- * @return the reference to the record in applications array.
- */
- Json::Value& GetFromSavedOrAppend(const std::string& mobile_app_id);
-
- /**
- * @brief CheckIgnCycleRestrictions checks if is needed to resume HMI state
- * by ign cycle restrictions
- * @param json_app - saved application
- * @return true if resumptions allowed, otherwise return false
- */
- bool CheckIgnCycleRestrictions(const Json::Value& json_app);
-
- /**
- * @brief DisconnectedInLastIgnCycle should check if was connected in prev ign cycle
- * @param json_app - saved applicationa
- * @return true if app connected in frep ign_cycle otherwise return false
- */
- bool DisconnectedInLastIgnCycle(const Json::Value& json_app);
-
- /**
- * @brief DisconnectedJustBeforeIgnOff should check if application
- * was dissconnected in N secconds delay before ign off.
- * N will be readed from profile
- * @param json_app - saved applicationa
- * @return was dissconnected in N secconds delay before ign off
- * otherwise return false
- */
- bool DisconnectedJustBeforeIgnOff(const Json::Value& json_app);
-
- /**
- * @brief CheckDelayAfterIgnOn should check if SDL was started less
- * then N secconds ago. N will be readed from profile.
- * @return true if SDL started N secconds ago, otherwise return false
- */
- bool CheckDelayAfterIgnOn();
-
- /**
- * @brief CheckAppRestrictions checks if is needed to resume HMI state
- * by application type and saved app_level
- * @param json_app - saved application
- * @return true if resumptions allowed, otherwise return false
- */
- bool CheckAppRestrictions(ApplicationSharedPtr application,
- const Json::Value& json_app);
- /**
- * @brief GetObjectIndex allows to obtain specified obbject index from
- * applications arrays.
- *
- * @param mobile_app_id application id that should be found.
- *
- * @return application's index of or -1 if it doesn't exists
- */
- int GetObjectIndex(const std::string& mobile_app_id);
-
- /**
- * @brief Timer callback for restoring HMI Level
- *
- */
- void ApplicationResumptiOnTimer();
-
- /*
- * @brief Loads data on start up
- */
- void LoadResumeData();
-
- /*
- * @brief Return true if application resumption data is valid,
- * otherwise false
- *
- * @param index application index in the resumption list
- */
- bool IsResumptionDataValid(uint32_t index);
-
- template<typename Iterator>
- Json::Value Append(Iterator first,
- Iterator last,
- const std::string& key,
- Json::Value& result) {
- while (first != last) {
- result[key].append(*first);
- ++first;
- }
- return result;
- }
-
- /**
- * @brief times of IGN_OFF that zombie application have to be saved.
- */
- static const uint32_t kApplicationLifes = 3;
-
- /**
- *@brief Mapping applications to time_stamps
- * wait for timer to resume HMI Level
- *
- */
- mutable sync_primitives::Lock queue_lock_;
- sync_primitives::Lock resumtion_lock_;
- ApplicationManagerImpl* app_mngr_;
- timer::TimerThread<ResumeCtrl> save_persistent_data_timer_;
- timer::TimerThread<ResumeCtrl> restore_hmi_level_timer_;
- std::vector<uint32_t> waiting_for_timer_;
- bool is_resumption_active_;
- bool is_data_saved;
- time_t launch_time_;
-};
-
-} // namespace application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H
diff --git a/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
new file mode 100644
index 0000000000..80928ae056
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resume_ctrl.h
@@ -0,0 +1,464 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H
+
+#include <stdint.h>
+#include <vector>
+#include <map>
+#include <set>
+#include <list>
+
+#include "interfaces/HMI_API.h"
+#include "interfaces/HMI_API_schema.h"
+#include "interfaces/MOBILE_API_schema.h"
+#include "application_manager/event_engine/event_observer.h"
+#include "smart_objects/smart_object.h"
+#include "application_manager/application.h"
+#include "resumption_data.h"
+#include "utils/timer.h"
+
+namespace application_manager {
+class Application;
+}
+
+namespace resumption {
+
+/**
+ * @brief Contains logic for storage/restore data of applications.
+ */
+
+class ResumeCtrl: public app_mngr::event_engine::EventObserver {
+
+ public:
+
+ /**
+ * @brief allows to create ResumeCtrl object
+ */
+ ResumeCtrl();
+
+ /**
+ * @brief allows to destroy ResumeCtrl object
+ */
+ ~ResumeCtrl();
+
+ /**
+ * @brief Event, that raised if application get resumption response from HMI
+ * @param event : event object, that contains smart_object with HMI message
+ */
+ virtual void on_event(const app_mngr::event_engine::Event& event);
+
+ /**
+ * @brief Save all applications info to the file system
+ */
+ void SaveAllApplications();
+
+ /**
+ * @brief Save application persistent info for future resuming
+ * @param application is application witch need to be saved
+ */
+ void SaveApplication(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Set application HMI Level and ausio_state as saved
+ * @param application is application witch HMI Level is need to restore
+ * @return true if success, otherwise return false
+ */
+ bool RestoreAppHMIState(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Set application HMI Level as stored in policy
+ * @param application is application witch HMI Level is need to setup
+ * @return true if success, otherwise return false
+ */
+ bool SetupDefaultHMILevel(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Setup HmiLevel for application
+ * Do routine of setting up hmi_level
+ * @param application is application witch HMI Level is need to setup
+ * @param hmi_level HMI Level is needed to setup
+ * @param hmi_level AudioStreamingState is needed to setup
+ * @param check_policy indicate if policy data consent must be verified
+ * @return true if success, otherwise return false
+ */
+ bool SetAppHMIState(app_mngr::ApplicationSharedPtr application,
+ const mobile_apis::HMILevel::eType hmi_level,
+ bool check_policy = true);
+
+ /**
+ * @brief Check if Resume controller have saved instance of application
+ * @param application is application witch need to be checked
+ * @return true if exist, false otherwise
+ */
+ bool ApplicationIsSaved(app_mngr::ApplicationConstSharedPtr application);
+
+ /**
+ * @brief Remove application from list of saved applications
+ * @param application is application which need to be removed
+ * @return return true, if success, otherwise return false
+ */
+ bool RemoveApplicationFromSaved(
+ app_mngr::ApplicationConstSharedPtr application);
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ void OnSuspend();
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ void OnAwake();
+
+ /**
+ * @brief Method starts timer "RsmCtrlPercist" when
+ * SDL receives onAwakeSDL notification
+ */
+ void StartSavePersistentDataTimer();
+
+ /**
+ * @brief Method stops timer "RsmCtrlPercist" when SDL
+ * receives OnExitAllApplication notification
+ * with reason "SUSPEND"
+ */
+ void StopSavePersistentDataTimer();
+
+ /**
+ * @brief Start timer for resumption applications
+ * Restore D1-D5 data
+ * @param application that is need to be restored
+ * @return true if it was saved, otherwise return false
+ */
+ bool StartResumption(app_mngr::ApplicationSharedPtr application,
+ const std::string& hash);
+
+ /**
+ * @brief Start timer for resumption applications
+ * Does not restore D1-D5 data
+ * @param application that is need to be restored
+ * @return true if it was saved, otherwise return false
+ */
+ bool StartResumptionOnlyHMILevel(
+ app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Check if there are all files need for resumption
+ * @param application that is need to be restored
+ * @return true if it all files exist, otherwise return false
+ */
+ bool CheckPersistenceFilesForResumption(
+ app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Check application hash
+ * @param application that is need to be restored
+ * @return true if it was saved, otherwise return false
+ */
+ bool CheckApplicationHash(app_mngr::ApplicationSharedPtr application,
+ const std::string& hash);
+
+ /**
+ * @brief Checks if Resume controller have saved application with hmi app id
+ * @param hmi_app_id - hmi application id
+ * @return true if exist, false otherwise
+ */
+ bool IsHMIApplicationIdExist(uint32_t hmi_app_id);
+
+ /**
+ * @brief Check if Resume controller have saved instance of application
+ * @param policy_app_id - mobile application id
+ * @param device_id - id of device where application is run
+ * @return true if exist, false otherwise
+ */
+ bool IsApplicationSaved(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Function is used for application resume. HMI app ID must be
+ * the same(PASA VCA module use it for stored app info).
+ * Retrieves HMI app ID for the given policy app ID from stored information.
+ * @param policy_app_id - mobile application id
+ * @param device_id - id of device where application is run
+ * @return HMI app ID
+ */
+ uint32_t GetHMIApplicationID(const std::string& policy_app_id,
+ const std::string& device_mac) const;
+ /**
+ * @brief SaveDataOnTimer :
+ * Timer callback for persisting ResumptionData each N seconds
+ * N gets from property
+ */
+ void SaveDataOnTimer();
+
+ /**
+ * @brief Updates flag for saving application data
+ */
+ void ApplicationsDataUpdated() {
+ is_data_saved_ = false;
+ }
+
+ /**
+ * @brief Resume HMI Level and audio streaming state if needed
+ * @param application - application to restore hmi level
+ * and audio streaming state
+ */
+ void StartAppHmiStateResumption(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Update launch_time_ to current
+ */
+ void ResetLaunchTime();
+
+ /**
+ * @brief Timer callback for restoring HMI Level
+ *
+ */
+ void ApplicationResumptiOnTimer();
+
+ /**
+ * @brief Removes activated application from resumption list
+ *
+ * @param application application witch need to be removed from resumption
+ */
+ void OnAppActivated(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Removes app from resumption list
+ *
+ * app_id Application to remove
+ */
+ void RemoveFromResumption(uint32_t app_id);
+
+ /**
+ * @brief Initialization data for Resume controller
+ * @return true if initialization is success otherwise
+ * returns false
+ */
+ bool Init();
+
+ /**
+ * @brief Notify resume controller about new application
+ * @param policy_app_id - mobile application id
+ * @param device_id - id of device where application is run
+ */
+ void OnAppRegistrationStart(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Notify resume controller about delete new application
+ */
+ void OnAppRegistrationEnd();
+
+ private:
+
+ /**
+ * @brief restores saved data of application
+ * @param application contains application for which restores data
+ * @return true if success, otherwise return false
+ */
+ bool RestoreApplicationData(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief AddFiles allows to add files for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddFiles(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddSubmenues allows to add sub menues for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddSubmenues(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddCommands allows to add commands for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddCommands(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddChoicesets allows to add choice sets for the application
+ * which should be resumed
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddChoicesets(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief SetGlobalProperties allows to restore global properties.
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void SetGlobalProperties(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief AddSubscriptions allows to restore subscriptions
+ * @param application application which will be resumed
+ * @param saved_app application specific section from backup file
+ */
+ void AddSubscriptions(app_mngr::ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+
+ bool CheckIgnCycleRestrictions(const smart_objects::SmartObject& saved_app);
+
+ bool DisconnectedJustBeforeIgnOff(const smart_objects::SmartObject& saved_app);
+
+ bool CheckAppRestrictions(app_mngr::ApplicationConstSharedPtr application,
+ const smart_objects::SmartObject& saved_app);
+
+ /**
+ * @brief CheckIcons allows to check application icons
+ * @param application application under resumtion application
+ * @param json_object
+ * @return true in case icons exists, false otherwise
+ */
+ bool CheckIcons(app_mngr::ApplicationSharedPtr application,
+ smart_objects::SmartObject& obj);
+
+ /**
+ * @brief CheckDelayAfterIgnOn should check if SDL was started less
+ * then N secconds ago. N will be readed from profile.
+ * @return true if SDL started N secconds ago, otherwise return false
+ */
+ bool CheckDelayAfterIgnOn();
+
+ typedef std::pair<uint32_t, uint32_t> application_timestamp;
+
+ // std::set<ApplicationSharedPtr> retrieve_application();
+
+ /**
+ * @brief This struct need to map
+ * timestamp and application from correlationID
+ */
+ struct ResumingApp {
+ uint32_t old_session_key; // session key is the same as app_id
+ app_mngr::ApplicationSharedPtr app;
+ };
+
+ struct TimeStampComparator {
+ bool operator() (const application_timestamp& lhs,
+ const application_timestamp& rhs) const{
+ return lhs.second < rhs.second;
+ }
+ };
+
+ /**
+ * @brief geter for launch_time_
+ * @return value of launch_time_
+ */
+ time_t launch_time() const;
+
+ /**
+ * @brief Check device MAC address
+ * @param application that is need to be restored
+ * @param saved_device_mac Saved device MAC address
+ * @return TRUE on success, otherwise FALSE
+ */
+ bool IsDeviceMacAddressEqual(app_mngr::ApplicationSharedPtr application,
+ const std::string& saved_device_mac);
+
+ /**
+ * @brief Get the last ignition off time from LastState
+ * @return the last ignition off time from LastState
+ */
+ time_t GetIgnOffTime();
+
+ /**
+ * @brief Setup IgnOff time to LastState
+ * @param ign_off_time - igition off time
+ */
+ void SetLastIgnOffTime(time_t ign_off_time);
+
+ /**
+ * @brief Process specified HMI request
+ * @param request Request to process
+ * @param use_events Process request events or not flag
+ * @return TRUE on success, otherwise FALSE
+ */
+ bool ProcessHMIRequest(
+ smart_objects::SmartObjectSPtr request = NULL,
+ bool use_events = false);
+
+ /**
+ * @brief Process list of HMI requests using ProcessHMIRequest method
+ * @param requests List of requests to process
+ */
+ void ProcessHMIRequests(const smart_objects::SmartObjectList& requests);
+
+ void InsertToTimerQueue(uint32_t app_id, uint32_t time_stamp);
+
+ void AddToResumptionTimerQueue(uint32_t app_id);
+
+ void LoadResumeData();
+
+ /**
+ * @brief Checks, if application data needs to be resumed
+ * @param application Application data from storage
+ * @return true, if data resumption must be skipped, otherwise - false
+ */
+ bool IsAppDataResumptionExpired(
+ const smart_objects::SmartObject& application) const;
+
+ /**
+ *@brief Mapping applications to time_stamps
+ * wait for timer to resume HMI Level
+ *
+ */
+ mutable sync_primitives::Lock queue_lock_;
+ timer::Timer restore_hmi_level_timer_;
+ timer::Timer save_persistent_data_timer_;
+ typedef std::list<uint32_t> WaitingForTimerList;
+ WaitingForTimerList waiting_for_timer_;
+ bool is_resumption_active_;
+ bool is_data_saved_;
+ time_t launch_time_;
+ utils::SharedPtr<ResumptionData> resumption_storage_;
+};
+
+} // namespace resumption
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_RESUME_CTRL_H
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
new file mode 100644
index 0000000000..c9dbe8dcab
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data.h
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_
+#include "smart_objects/smart_object.h"
+#include "application_manager/application.h"
+
+namespace resumption {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+namespace app_mngr = application_manager;
+
+/**
+ * @brief Abstract class which provides an interface for storage/restore
+ * application data. Contains methods for receiving application data
+ * from application.
+ */
+
+class ResumptionData {
+ public:
+ /**
+ * @brief Constructor of ResumptionData
+ */
+ ResumptionData();
+
+ /**
+ * @brief Destructor of ResumptionData
+ */
+ virtual ~ResumptionData() {}
+
+ /**
+ * @brief Save application persistent info for future resuming
+ * @param application is application witch need to be saved
+ */
+ virtual void SaveApplication(app_mngr::ApplicationSharedPtr application) = 0;
+
+ /**
+ * @brief Returns HMI level of application from saved data
+ * @param policy_app_id contains policy application id of application
+ * @param device_id contains id of device on which is running application
+ * @return HMI level, if saved data does not contain HMI level method
+ * returns -1
+ */
+ virtual int32_t GetStoredHMILevel(const std::string& policy_app_id,
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Checks if saved data of applications have hmi app id
+ * @param hmi_app_id - hmi application id
+ * @return true if exist, false otherwise
+ */
+ virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const = 0;
+
+ /**
+ * @brief Checks if saved data have application
+ * and removes this data if it is not valid
+ * @param policy_app_id - policy application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data exists and data is valid, false otherwise
+ */
+ virtual bool CheckSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id) = 0;
+
+ /**
+ * @brief Retrieves HMI app ID for the given mobile app ID
+ * and device ID from stored information.
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return HMI app ID
+ */
+ virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ virtual void OnSuspend() = 0;
+
+ /**
+ * @brief Retrieves hash ID for the given mobile app ID
+ * and device ID from stored information.
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hash_id - parameter which will contain HASH id from saved
+ * application
+ * @return TRUE if application will be found in saved data otherwise
+ * returns FALSE
+ */
+ virtual bool GetHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ 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
+ * @param device_id - contains id of device on which is running application
+ * @param saved_app - parameter which will contain data of saved application
+ * @return TRUE if application will be found in saved data otherwise
+ * returns FALSE
+ */
+ virtual bool GetSavedApplication(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const = 0;
+
+ /**
+ * @brief Remove application from list of saved applications
+ * @param policy_app_id application which need to be removed
+ * @param device_id - contains id of device on which is running application
+ * @return return true, if success, otherwise return false
+ */
+ virtual bool RemoveApplicationFromSaved(const std::string& policy_app_id,
+ const std::string& device_id) = 0;
+
+ /**
+ * @brief Get the last ignition off time from LastState
+ * @return the last ignition off time from LastState
+ */
+ virtual uint32_t GetIgnOffTime() const = 0;
+
+ /**
+ * @brief Checks if saved data have application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return index if data of application exists, otherwise returns -1
+ */
+ virtual ssize_t IsApplicationSaved(const std::string& policy_app_id,
+ const std::string& device_id) const = 0;
+
+ /**
+ * @brief Retrieves data from saved application
+ * @param saved_data - will be contain data for resume_ctrl
+ */
+ virtual void GetDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const = 0;
+
+ /**
+ * @brief Updates HMI level of saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hmi_level - contains hmi level for saved application
+ */
+ virtual void UpdateHmiLevel(const std::string& policy_app_id,
+ const std::string& device_id,
+ mobile_apis::HMILevel::eType hmi_level) = 0;
+
+ /**
+ * @brief Init storage
+ */
+ virtual bool Init();
+
+ /**
+ * @brief Drops data related to applicaton data resumption
+ * @param device_id Device ID
+ * @param app_id Application ID
+ * @return true, if dropped successfully, otherwise - false
+ */
+ virtual bool DropAppDataResumption(const std::string& device_id,
+ const std::string& app_id) = 0;
+
+ protected:
+ /**
+ * @brief Retrieves of commands from application
+ * @param application contains application of which selection commands
+ * @return list of commands
+ */
+ smart_objects::SmartObject GetApplicationCommands(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief Retrieves of submenues from application
+ * @param application contains application of which selection submenues
+ * @return list of submenues
+ */
+ smart_objects::SmartObject GetApplicationSubMenus(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief Retrieves of interactionChoiceSet from application
+ * @param application contains application of which selection
+ * interactionChoiceSet
+ * @return list of interaction choice set
+ */
+ smart_objects::SmartObject GetApplicationInteractionChoiseSets(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief Retrieves of global properties from application
+ * @param application contains application of which selection global
+ * properties
+ * @return global properties of application
+ */
+ smart_objects::SmartObject GetApplicationGlobalProperties(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief Retrieves of subscriptions from application
+ * @param application contains application of which selection subscriptions
+ * @return subscriptions of application
+ */
+ smart_objects::SmartObject GetApplicationSubscriptions(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief Retrieves of files from application
+ * @param application contains application of which selection files
+ * @return files of application
+ */
+ smart_objects::SmartObject GetApplicationFiles(
+ app_mngr::ApplicationConstSharedPtr application) const;
+
+ /**
+ * @brief checks pointer that it is not equal NULL
+ * @param ptr - contains pointer which need to check
+ * @return smartObject from pointer
+ */
+ smart_objects::SmartObject PointerToSmartObj(
+ const smart_objects::SmartObject* ptr) const;
+
+ /**
+ * @brief Creates smart array from received data
+ * @param first - iterator points to beginning of the data
+ * @param last - iterator points to ending of the data
+ * @param key - contains smart array's name
+ * @param result - will contain created array
+ */
+ template <typename Iterator>
+ void Append(Iterator first,
+ Iterator last,
+ const std::string& key,
+ smart_objects::SmartObject& result) const {
+ int i = 0;
+ result[key] = smart_objects::SmartObject(smart_objects::SmartType_Array);
+ while (first != last) {
+ result[key][i++] = *first;
+ ++first;
+ }
+ }
+
+ mutable sync_primitives::Lock resumption_lock_;
+};
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_H_
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
new file mode 100644
index 0000000000..f6de5eec86
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_db.h
@@ -0,0 +1,844 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_DB_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_DB_H_
+#include "application_manager/resumption/resumption_data.h"
+
+#include "sql_database.h"
+#include "sql_query.h"
+
+namespace resumption {
+
+/**
+ * @brief Points what structure contains vr commands
+ */
+enum AccessoryVRCommand { kVRCommandFromChoice = 0, kVRCommandFromCommand };
+
+struct ApplicationParams {
+ ApplicationParams(const smart_objects::SmartObject& application);
+ ApplicationParams(app_mngr::ApplicationSharedPtr application);
+
+ std::string m_hash;
+ int64_t m_grammar_id;
+ int64_t m_connection_key;
+ int64_t m_hmi_app_id;
+ mobile_apis::HMILevel::eType m_hmi_level;
+ bool m_is_media_application;
+ bool m_is_valid;
+};
+
+/**
+ * @brief class contains logic for representation application data in
+ * data base
+ */
+class ResumptionDataDB : public ResumptionData {
+ public:
+ /**
+ * @brief Constructor of ResumptionDataDB
+ */
+ ResumptionDataDB();
+
+ /**
+ * @brief allows to destroy ResumptionDataDB object
+ */
+ virtual ~ResumptionDataDB();
+
+ /**
+ * @brief Creates or opens DB and initialize it
+ * @return false if DB doesn't initialize
+ * otherwise returns true
+ */
+ virtual bool Init();
+
+ /**
+ * @brief Save application persistent info for future resuming to db
+ * @param application is application which need to be saved
+ */
+ virtual void SaveApplication(app_mngr::ApplicationSharedPtr application);
+ /**
+ * @brief Returns HMI level of application from saved data
+ * @param policy_app_id contains policy id of application
+ * @param device_id contains id of device on which is running application
+ * @return HMI level, if saved data does not contain HMI level method
+ * returns -1
+ */
+ virtual int32_t GetStoredHMILevel(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Checks if saved data of applications have hmi app id
+ * @param hmi_app_id - hmi application id
+ * @return true if exist, otherwise false
+ */
+ virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const;
+ /**
+ * @brief Checks if saved data have application
+ * @param policy_app_id - policy application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if application exists, false otherwise
+ */
+ virtual bool CheckSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Retrieves HMI app ID for the given mobile app ID
+ * and device ID from stored data.
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return HMI app ID
+ */
+ virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ virtual void OnSuspend();
+
+ /**
+ * @brief Retrieves hash ID for the given mobile app ID
+ * and device ID from stored information.
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hash_id - parameter which will contain HASH id from saved
+ * application
+ * @return TRUE if application will be found in saved data otherwise
+ * returns FALSE
+ */
+ virtual bool GetHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ 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
+ * @param device_id - contains id of device on which is running application
+ * @param saved_app - parameter which will contain data of saved application
+ * @return TRUE if application will be found in saved data otherwise
+ * returns FALSE
+ */
+ virtual bool GetSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Remove application from list of saved applications
+ * @param policy_app_id application witch need to be removed
+ * @param device_id - contains id of device on which is running application
+ * @return return true, if success, otherwise return false
+ */
+ virtual bool RemoveApplicationFromSaved(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Get the last ignition off time from LastState
+ * @return the last ignition off time from LastState
+ */
+ virtual uint32_t GetIgnOffTime() const;
+
+ /**
+ * @brief Checks if saved data have application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return 0 if saved data contains application otherwise returns -1
+ */
+ virtual ssize_t IsApplicationSaved(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Retrieves data from saved application
+ * @param will contain data for resume_ctrl
+ */
+ virtual void GetDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const;
+
+ /**
+ * @brief Updates HMI level of saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hmi_level - contains hmi level for saved application
+ */
+ virtual void UpdateHmiLevel(const std::string& policy_app_id,
+ const std::string& device_id,
+ mobile_apis::HMILevel::eType hmi_level);
+
+ /**
+ * @brief Re-creates and re-init DB
+ * @return true if success, otherwise - false
+ */
+ bool RefreshDB() const;
+
+ /**
+ * @brief Gets all the data from DB to memory
+ * @param data Object which holds resumption data
+ * @return true if success, otherwise - false
+ */
+ bool GetAllData(smart_objects::SmartObject& data) const;
+
+ /**
+ * @brief Saves all the data to DB
+ * @param data Object, which holds resumption data
+ * @return true if success, otherwise - false
+ */
+ bool SaveAllData(const smart_objects::SmartObject& data);
+
+ /**
+ * @brief Checks, if DB version is actual to current schema
+ * @return true if success, otherwise - false
+ */
+ bool IsDBVersionActual() const;
+
+ /**
+ * @brief Updates DB version accordingly to current schema
+ * @return true if success, otherwise - false
+ */
+ bool UpdateDBVersion() const;
+
+ bool DropAppDataResumption(const std::string& device_id,
+ const std::string& app_id) OVERRIDE;
+
+ private:
+ /**
+ * @brief Calculates DB version from current schema
+ * @return version
+ */
+ const int32_t GetDBVersion() const;
+
+ /**
+ * @brief Retrieves hmi level from db
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hmi_level - will contains hmi level for saved application
+ * @return true if application with mobile id and device id has hmi level
+ * otherwise returns false
+ */
+ bool SelectHMILevel(const std::string& policy_app_id,
+ const std::string& device_id,
+ int& hmi_level) const;
+ /**
+ * @brief Checks existence HMI id in DB
+ * @param hmi_app_id - HMI id
+ * return true if hmiID is same with saved hmiID otherwise returns false
+ */
+ bool CheckExistenceHMIId(uint32_t hmi_app_id) const;
+
+ /**
+ * @brief Select HMI id from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hmi_id - will contains hmi id from saved application
+ */
+ void SelectHMIId(const std::string& policy_app_id,
+ const std::string& device_id,
+ uint32_t& hmi_id) const;
+
+ /**
+ * @brief Select hash id from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hash_id - will contains hash id from saved application
+ */
+ bool SelectHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ std::string& hash_id) const;
+
+ /**
+ * @brief Select Ign off time
+ * @return Ign off time from saved data
+ */
+ uint32_t SelectIgnOffTime() const;
+
+ /**
+ * @brief Checks existence application in DB
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param application_exist will contain true if restored data contain
+ * application
+ * otherwise will contain false
+ * return if we have problem with access to DB returns FALSE otherwise
+ * returns TRUE
+ */
+ bool CheckExistenceApplication(const std::string& policy_app_id,
+ const std::string& device_id,
+ bool& application_exist) const;
+
+ /**
+ * @brief Retrieves data from saved application
+ * @param will contain data for resume_ctrl
+ */
+ void SelectDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const;
+
+ /**
+ * @brief Deletes saved application from db
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if application data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Deletes file from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedFiles(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Deletes submenu from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedSubMenu(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Deletes subscriptions from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedSubscriptions(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Deletes commands from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedCommands(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Deletes choice set from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedChoiceSet(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Deletes global properties from saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteSavedGlobalProperties(const std::string& policy_app_id,
+ const std::string& device_id);
+ /**
+ * @brief Deletes data from application table
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data was deleted otherwise returns
+ * false
+ */
+ bool DeleteDataFromApplicationTable(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Saves files data to DB
+ * @param files contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertFilesData(const smart_objects::SmartObject& files,
+ int64_t application_primary_key) const;
+
+ /**
+ * @brief Saves submenu data to DB
+ * @param submenus contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertSubMenuData(const smart_objects::SmartObject& submenus,
+ int64_t application_primary_key) const;
+
+ /**
+ * @brief Saves commands data to DB
+ * @param commands contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertCommandsData(const smart_objects::SmartObject& commands,
+ int64_t application_primary_key) const;
+
+ /**
+ * @brief Saves subscriptions data to DB
+ * @param subscriptions contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertSubscriptionsData(const smart_objects::SmartObject& subscriptions,
+ int64_t application_primary_key) const;
+
+ /**
+ * @brief Saves choice set data to DB
+ * @param choicesets contains data for saving
+ * @param application_primary_key - primary key from DB table application
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertChoiceSetData(const smart_objects::SmartObject& choicesets,
+ int64_t application_primary_key) const;
+
+ /**
+ * @brief Saves globalProperties data to DB
+ * @param global_properties contains data for saving
+ * @param global_properties_key - will contain primary key from global
+ * properties table
+ * @return true if data was saved successfully otherwise returns
+ * false
+ */
+ bool InsertGlobalPropertiesData(
+ const smart_objects::SmartObject& global_properties,
+ int64_t& global_properties_key) const;
+
+ /**
+ * @brief Saves application data to DB
+ * @param application contains data for saving
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if application data was saved successfully
+ * otherwise returns false
+ */
+ bool SaveApplicationToDB(app_mngr::ApplicationSharedPtr application,
+ const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ bool SaveApplicationToDB(const smart_objects::SmartObject& application,
+ const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Updates ignition of count on saved applications after onAwake
+ * notification
+ */
+ void UpdateDataOnAwake();
+
+ /**
+ * @brief Execute query for delete data of application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param text_query - contains text of query
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecQueryToDeleteData(const std::string& policy_app_id,
+ const std::string& device_id,
+ const std::string& text_query);
+
+ /**
+ * @brief Execute union query for delete data of application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param text_query - contains text of query
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecUnionQueryToDeleteData(const std::string& policy_app_id,
+ const std::string& device_id,
+ const std::string& text_query);
+
+ /**
+ * @brief Execute query in order to insert image to DB
+ * @param image_primary_key - will contain primary key from image table
+ * @param image contains data for saving to DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertImage(int64_t& image_primary_key,
+ const smart_objects::SmartObject& image) const;
+
+ /**
+ * @brief Execute query in order to insert choice to DB
+ * @param choice_set_key - contain primary key from
+ * applicationChoiceSet table
+ * @param choice_array contains data for saving to DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertChoice(int64_t choice_set_key,
+ const smart_objects::SmartObject& choice_array) const;
+
+ /**
+ * @brief Execute query in order to insert vr commands to DB
+ * @param primary_key - will contain primary key from command table or
+ * choice table
+ * @param vr_commands_array contains data for saving to DB
+ * @param value indicates which structure contains vrcommands
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertVrCommands(const int64_t primary_key,
+ const smart_objects::SmartObject& vr_commands_array,
+ AccessoryVRCommand value) const;
+
+ /**
+ * @brief Execute query in order to insert choice set data to DB
+ * @param choice_set_primary_key - will contain primary key from
+ * applicationChoiceSet table
+ * @param choiceset contains data for saving to DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertApplicationChoiceSet(
+ int64_t& choice_set_primary_key,
+ const smart_objects::SmartObject& choiceset) const;
+
+ /**
+ * @brief combines primary key from several table to new table
+ * @param first_primary_key - will contain primary key from first DB table
+ * @param second_primary_key - will contain primary key from second DB table
+ * @param text_query - contains text of query
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertDataToArray(int64_t first_primary_key,
+ int64_t second_primary_key,
+ const std::string& text_query) const;
+
+ /**
+ * @brief Execute query in order to insert characters array to DB
+ * @param global_properties_key contains primary key from globalproperties
+ * table
+ * @param characters_array contains data for saving to DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertLimitedCharacters(
+ int64_t global_properties_key,
+ const smart_objects::SmartObject& characters_array) const;
+
+ /**
+ * @brief Execute query in order to insert vr help item array to DB
+ * @param global_properties_key contains primary key from globalproperties
+ * table
+ * @param vrhelp_array contains data for saving to DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertVRHelpItem(
+ int64_t global_properties_key,
+ const smart_objects::SmartObject& vrhelp_array) const;
+
+ /**
+ * @brief Execute query in order to insert data to ttsChunk table
+ * @param tts_chunk contains data for saving to DB
+ * @param tts_chunk_key will contain primary key from ttsChunk table
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertTTSChunks(const smart_objects::SmartObject& tts_chunk,
+ int64_t& tts_chunk_key) const;
+
+ /**
+ * @brief Execute query in order to insert data to helpTimeoutPromptArray
+ * @param global_properties contains data for saving to DB
+ * @param global_properties_key contains primary key from globalproperties
+ * table
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool ExecInsertHelpTimeoutArray(
+ const smart_objects::SmartObject& global_properties,
+ int64_t global_properties_key) const;
+
+ /**
+ * @brief Execute query in order to insert or update data in application table
+ * @param application contains data for saving to DB
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param application_primary_key will contain primary key from application
+ * table
+ * @param global_properties_key contains primary key from globalproperties
+ * table
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool InsertApplicationData(const ApplicationParams& application,
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ int64_t* application_primary_key,
+ int64_t global_properties_key) const;
+
+ /**
+ * @brief Calls InsertApplicationData method
+ * @param application contains data for saving to DB
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @return true if InsertApplicationData works successfully, otherwise
+ * returns false;
+ */
+ bool InsertApplicationData(app_mngr::ApplicationSharedPtr application,
+ const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Delete application data where ign_off_count >= application_lifes
+ * @param application_lifes contains amount ign off
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool DeleteAppWithIgnCount(const int application_lifes);
+
+ /**
+ * @brief Selects data from file table
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain data from file table
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectFilesData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects data from subMenu table
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain data from subMenu table
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectSubmenuData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects data from commands table
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain commands
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectCommandData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects data from applicationSubscribtionsArray table
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain subscriptions
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectSubscriptionsData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects choice set data from DB
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain choiceSets
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectChoiceSetData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects global properties data from DB
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain global properties
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectGlobalPropertiesData(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects image data from DB
+ * @param image_key primary key from image table
+ * @param image will contain image data from DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectImageData(int64_t image_key,
+ smart_objects::SmartObject& image) const;
+
+ /**
+ * @brief Selects ttsChunk data from DB
+ * @param tts_chunk_key primary key from ttsChunk table
+ * @param tts_chunk will contain ttsChunk data from DB
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectTTSChunkData(int64_t tts_chunk_key,
+ smart_objects::SmartObject& tts_chunk) const;
+
+ /**
+ * @brief Selects VR help items data from DB
+ * @param global_properties_key primary key from global properties table
+ * @param global_properties will contain VR help items
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectVrHelpItemsData(
+ int64_t global_properties_key,
+ smart_objects::SmartObject& global_properties) const;
+
+ /**
+ * @brief Selects table limited character data from DB
+ * @param global_properties_key primary key from global properties table
+ * @param keyboard_properties will contain table limited character
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectCharactersData(
+ int64_t global_properties_key,
+ smart_objects::SmartObject& keyboard_properties) const;
+
+ /**
+ * @brief Selects data from application table of DB
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param saved_app will contain data from application table
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectDataFromAppTable(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Selects count from array table
+ * @param count_item will contain amount item in table
+ * @param text_query - contains text of query
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @return true if query was run successfully otherwise returns
+ * false
+ */
+ bool SelectCountFromArray(uint32_t& count_item,
+ const std::string& text_query,
+ const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Binds data from smart object with query
+ * @param key contains key from smart object
+ * @param so contains data which needs to bind with query
+ * @param query object of query for DB
+ * @param pos contains position for binding query
+ */
+ void CustomBind(const std::string& key,
+ const smart_objects::SmartObject& so,
+ utils::dbms::SQLQuery& query,
+ const int pos) const;
+
+ /**
+ * @brief prepare and bind the same type query
+ * @param query object of query for DB
+ * @param policy_app_id contains mobile application id of application
+ * @param device_id contains id of device on which is running application
+ * @param text_query - contains text of query
+ * @return true if query was binded successfully otherwise returns
+ * false
+ */
+ bool PrepareSelectQuery(utils::dbms::SQLQuery& query,
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ const std::string& text_query) const;
+
+ /**
+ * @brief Updates HMI level and time stamp in application table
+ * @param application contains data for saving
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if application data were updated successfully
+ * otherwise returns false
+ */
+ bool UpdateApplicationData(app_mngr::ApplicationConstSharedPtr application,
+ const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Writes data to DB after update
+ */
+ void WriteDb();
+
+ /**
+ * @brief returns pointer to data base
+ */
+ utils::dbms::SQLDatabase* db() const;
+
+ /**
+ * @brief Updates grammarID for application
+ * @param policy_app_id Application ID
+ * @param device_id Device ID
+ * @param grammar_id GrammarID
+ * @return true if succedeed, otherwise - false
+ */
+ bool UpdateGrammarID(const std::string& policy_app_id,
+ const std::string& device_id,
+ const uint32_t grammar_id);
+
+ DISALLOW_COPY_AND_ASSIGN(ResumptionDataDB);
+
+ utils::dbms::SQLDatabase* db_;
+};
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_DB_H_
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
new file mode 100644
index 0000000000..f5775ac004
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_data_json.h
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_JSON_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_JSON_H_
+
+#include "application_manager/resumption/resumption_data.h"
+#include "json/json.h"
+
+namespace resumption {
+
+/**
+ * @brief class contains logic for representation application data in
+ * json file
+ */
+class ResumptionDataJson : public ResumptionData {
+ public:
+ /**
+ * @brief Constructor of ResumptionDataJson
+ */
+ ResumptionDataJson();
+
+ /**
+ * @brief allows to destroy ResumptionDataJson object
+ */
+ virtual ~ResumptionDataJson();
+
+ /**
+ * @brief Save application persistent info for future resuming on json format
+ * @param application is application witch need to be saved
+ */
+ virtual void SaveApplication(app_mngr::ApplicationSharedPtr application);
+
+ /**
+ * @brief Returns HMI level of application from saved data
+ * @param policy_app_id contains policy application id of application
+ * @param device_id contains id of device on which is running application
+ * @return HMI level, if saved data does not contain HMI level method
+ * returns -1
+ */
+ virtual int32_t GetStoredHMILevel(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Checks if saved data of applications have hmi app id
+ * @param hmi_app_id - hmi application id
+ * @return true if exist, false otherwise
+ */
+ virtual bool IsHMIApplicationIdExist(uint32_t hmi_app_id) const;
+
+ /**
+ * @brief Checks if saved data have application
+ * and removes this data if it is not valid
+ * @param policy_app_id - policy application id
+ * @param device_id - contains id of device on which is running application
+ * @return true if data exists and data is valid, false otherwise
+ */
+ virtual bool CheckSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Retrieves HMI app ID for the given mobile app ID
+ * and device ID from stored information.
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return HMI app ID
+ */
+ virtual uint32_t GetHMIApplicationID(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ virtual void OnSuspend();
+
+ /**
+ * @brief Increments ignition counter for all registered applications
+ * and remember ign_off time stamp
+ */
+ virtual void OnAwake();
+
+ /**
+ * @brief Retrieves hash ID for the given mobile app ID
+ * and device ID from stored information.
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hash_id - parameter which will contain HASH id from saved
+ * application
+ * @return TRUE if application will be found in saved data otherwise
+ * returns FALSE
+ */
+ virtual bool GetHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ std::string& hash_id) const;
+
+ /**
+ * @brief Retrieves data of saved application for the given mobile app ID
+ * and device ID
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param saved_app - parameter which will contain data of saved application
+ * @return TRUE if application will be found in saved data otherwise
+ * returns FALSE
+ */
+ virtual bool GetSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const;
+
+ /**
+ * @brief Remove application from list of saved applications
+ * @param policy_app_id application witch need to be removed
+ * @param device_id - contains id of device on which is running application
+ * @return return true, if success, otherwise return false
+ */
+ virtual bool RemoveApplicationFromSaved(const std::string& policy_app_id,
+ const std::string& device_id);
+
+ /**
+ * @brief Get the last ignition off time from LastState
+ * @return the last ignition off time from LastState
+ */
+ virtual uint32_t GetIgnOffTime() const;
+
+ /**
+ * @brief Checks if saved data have application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @return index if data of application exists, otherwise returns -1
+ */
+ virtual ssize_t IsApplicationSaved(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Retrieves data from saved application
+ * @param will be contain data for resume_ctrl
+ */
+ virtual void GetDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const;
+
+ /**
+ * @brief Updates HMI level of saved application
+ * @param policy_app_id - mobile application id
+ * @param device_id - contains id of device on which is running application
+ * @param hmi_level - contains hmi level for saved application
+ */
+ virtual void UpdateHmiLevel(const std::string& policy_app_id,
+ const std::string& device_id,
+ mobile_apis::HMILevel::eType hmi_level);
+
+ virtual bool Init();
+
+ bool DropAppDataResumption(const std::string& device_id,
+ const std::string& app_id) OVERRIDE;
+
+ private:
+ /**
+ * @brief GetFromSavedOrAppend allows to get existed record about application
+ * or adds the new one.
+ * @param policy_app_id application id.
+ * @param device_id unique id of device.
+ * @return the reference to the record in applications array.
+ */
+ Json::Value& GetFromSavedOrAppend(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Get applications for resumption of LastState
+ * @return applications for resumption of LastState
+ */
+ Json::Value& GetSavedApplications() const;
+
+ /**
+ * @brief Get Resumption section of LastState
+ * @return Resumption section of LastState in Json
+ */
+ Json::Value& GetResumptionData() const;
+
+ /**
+ * @brief GetObjectIndex allows to obtain specified object index from
+ * applications arrays.
+ * @param policy_app_id application id that should be found.
+ * @param device_id unique id of device.
+ * @return application's index of or -1 if it doesn't exists
+ */
+ ssize_t GetObjectIndex(const std::string& policy_app_id,
+ const std::string& device_id) const;
+
+ /**
+ * @brief Set applications for resumption to LastState
+ * @parems apps_json applications to write in LastState
+ */
+ void SetSavedApplication(Json::Value& apps_json);
+
+ /**
+ * @brief Setup IgnOff time to LastState
+ * @param ign_off_time - igition off time
+ */
+ void SetLastIgnOffTime(time_t ign_off_time);
+
+ /*
+ * @brief Return true if application resumption data is valid,
+ * otherwise false
+ * @param index application index in the resumption list
+ */
+ bool IsResumptionDataValid(uint32_t index) const;
+
+ DISALLOW_COPY_AND_ASSIGN(ResumptionDataJson);
+};
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_DATA_JSON_H_
diff --git a/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
new file mode 100644
index 0000000000..c3a17d868c
--- /dev/null
+++ b/src/components/application_manager/include/application_manager/resumption/resumption_sql_queries.h
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2013, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_SQL_QUERY_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_SQL_QUERY_H_
+
+#include <string>
+
+namespace resumption {
+
+extern const std::string kCreateSchema;
+extern const std::string kDropSchema;
+extern const std::string kInsertInitData;
+extern const std::string kChecksResumptionData;
+extern const std::string kSelectCountHMILevel;
+extern const std::string kSelectHMILevel;
+extern const std::string kCheckHMIId;
+extern const std::string kSelectHMIId;
+extern const std::string kSelectCountHMIId;
+extern const std::string kCountHashId;
+extern const std::string kSelectHashId;
+extern const std::string kSelectIgnOffTime;
+extern const std::string kCheckApplication;
+extern const std::string kCountApplications;
+extern const std::string kSelectDataForLoadResumeData;
+extern const std::string kUpdateHMILevel;
+extern const std::string kUpdateIgnOffCount;
+extern const std::string kCountApplicationsIgnOff;
+extern const std::string kSelectApplicationsIgnOffCount;
+extern const std::string kUpdateSuspendData;
+extern const std::string KUpdateLastIgnOffTime;
+extern const std::string kDeleteFile;
+extern const std::string kDeleteApplicationFilesArray;
+extern const std::string kDeleteSubMenu;
+extern const std::string kDeleteApplicationSubMenuArray;
+extern const std::string kDeleteApplicationSubscribtionsArray;
+extern const std::string kDeleteImageFromCommands;
+extern const std::string kDeleteVrCommands;
+extern const std::string kDeleteCommands;
+extern const std::string kDeleteApplicationCommandsArray;
+extern const std::string kDeleteImageFromChoiceSet;
+extern const std::string kDeleteVrCommandsFromChoiceSet;
+extern const std::string kDeleteChoice;
+extern const std::string kDeleteChoiceArray;
+extern const std::string kDeleteApplicationChoiceSet;
+extern const std::string kDeleteApplicationChoiceSetArray;
+extern const std::string kDeleteImageFromGlobalProperties;
+extern const std::string kDeletevrHelpItem;
+extern const std::string kDeletevrHelpItemArray;
+extern const std::string kDeleteTableLimitedCharacterList;
+extern const std::string kDeleteCharacterArray;
+extern const std::string kDeleteTTSChunk;
+extern const std::string kDeleteFromApplicationTable;
+extern const std::string kDeleteHelpTimeoutPromptArray;
+extern const std::string kDeleteGlobalProperties;
+extern const std::string kSelectCountImage;
+extern const std::string kSelectPrimaryKeyImage;
+extern const std::string kInsertImage;
+extern const std::string kInsertToFile;
+extern const std::string kInsertToApplicationFilesArray;
+extern const std::string kInsertToSubMenu;
+extern const std::string kInsertToApplicationSubMenuArray;
+extern const std::string kInsertToVrCommandsArray;
+extern const std::string kInsertToCommand;
+extern const std::string kInsertApplicationCommandArray;
+extern const std::string kInsertVrCommand;
+extern const std::string kInsertSubscriptions;
+extern const std::string kInsertChoice;
+extern const std::string kInsertApplicationChoiceSet;
+extern const std::string kInsertChoiceArray;
+extern const std::string kInsertApplicationChoiceSetArray;
+extern const std::string kInsertGlobalProperties;
+extern const std::string kInsertTableLimitedCharacter;
+extern const std::string kInsertCharacterArray;
+extern const std::string kInsertVRHelpItem;
+extern const std::string kInsertVRHelpItemArray;
+extern const std::string kInsertHelpTimeoutPromptArray;
+extern const std::string kInsertTTSChunk;
+extern const std::string kInsertApplication;
+extern const std::string kSelectCountFiles;
+extern const std::string kSelectFiles;
+extern const std::string kSelectCountSubMenu;
+extern const std::string kSelectSubMenu;
+extern const std::string kSelectCountCommands;
+extern const std::string kSelectCommands;
+extern const std::string kSelectCountSubscriptions;
+extern const std::string kSelectSubscriptions;
+extern const std::string kSelectCountChoiceSet;
+extern const std::string kSelectChoiceSets;
+extern const std::string kSelectImage;
+extern const std::string kSelectCountGlobalProperties;
+extern const std::string kSelectGlobalProperties;
+extern const std::string kChecksVrHelpItem;
+extern const std::string kSelectVrHelpItem;
+extern const std::string kChecksCharacter;
+extern const std::string kSelectCharacter;
+extern const std::string kSelectTTSChunk;
+extern const std::string kSelectAppTable;
+extern const std::string kSelectAllApps;
+extern const std::string kUpdateApplicationData;
+extern const std::string kSelectDBVersion;
+extern const std::string kUpdateDBVersion;
+extern const std::string kUpdateGrammarID;
+} // namespace resumption
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_RESUMPTION_RESUMPTION_SQL_QUERY_H_
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 c76886daca..a6685534fa 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
@@ -52,7 +52,7 @@ const char method_name[] = "methodName";
const char info[] = "info";
const char app_id[] = "appID";
const char hmi_app_id[] = "hmiAppID";
-const char device_mac[] = "deviceMAC";
+const char device_id[] = "deviceID";
const char url[] = "url";
const char urlScheme[] = "urlScheme";
const char packageName[] = "packageName";
@@ -201,6 +201,7 @@ const char os[] = "os";
const char os_version[] = "osVersion";
const char carrier[] = "carrier";
const char slider_header[] = "sliderHeader";
+const char key_press_mode[] = "keypressMode";
// duplicate names from hmi_request
const char limited_character_list[] = "limitedCharacterList";
@@ -252,7 +253,7 @@ const char priority[] = "priority";
//resuming
const char application_commands[] = "applicationCommands";
const char application_submenus[] = "applicationSubMenus";
-const char application_choise_sets[] = "applicationChoiceSets";
+const char application_choice_sets[] = "applicationChoiceSets";
const char application_global_properties[] = "globalProperties";
const char application_vehicle_info[] = "vehicleInfo";
const char application_buttons[] = "buttons";
@@ -280,6 +281,7 @@ const char location_name[] = "locationName";
const char location_description[] = "locationDescription";
const char address_lines[] = "addressLines";
const char phone_number[] = "phoneNumber";
+const char number[] = "number";
const char location_image[] = "locationImage";
const char is_suscribed[] = "isSubscribed";
const char message_data[] = "messageData";
@@ -411,6 +413,8 @@ const char statistic_type[] = "statisticType";
const char error[] = "error";
const char policyfile[] = "policyfile";
const char is_active[] = "isActive";
+const char is_deactivated[] = "isDeactivated";
+const char event_name[] = "eventName";
} // namespace hmi_notification
diff --git a/src/components/application_manager/include/application_manager/state_context.h b/src/components/application_manager/include/application_manager/state_context.h
index 94962c23b4..4654eb38b6 100644
--- a/src/components/application_manager/include/application_manager/state_context.h
+++ b/src/components/application_manager/include/application_manager/state_context.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTEXT_H_
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTEXT_H_
-#include <inttypes.h>
+#include <cstdint>
namespace application_manager {
/**
diff --git a/src/components/application_manager/include/application_manager/state_controller.h b/src/components/application_manager/include/application_manager/state_controller.h
index fc10597a6a..a6cd06247d 100644
--- a/src/components/application_manager/include/application_manager/state_controller.h
+++ b/src/components/application_manager/include/application_manager/state_controller.h
@@ -36,373 +36,549 @@
#include "application_manager/hmi_state.h"
#include "application_manager/application.h"
+#include "application_manager/application_manager.h"
#include "event_engine/event_observer.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
-#include "application_manager/state_context.h"
#include "utils/lock.h"
+#include "utils/helpers.h"
namespace application_manager {
-class ApplicationManagerImpl;
+
class StateController : public event_engine::EventObserver {
- public:
-
- StateController();
-
- /**
- * @brief SetRegularState setup regular hmi state, tha will appear if no
- * specific events are active
- * @param app appication to setup regular State
- * @param state state of new regular state
- */
- template <bool SendActivateApp>
- void SetRegularState(ApplicationSharedPtr app,
- HmiStatePtr state) {
- if (!app) {
- return;
- }
- DCHECK_OR_RETURN_VOID(state);
- DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
+ public:
+ explicit StateController(ApplicationManager* app_mngr);
+
+ /**
+ * @brief SetRegularState setup regular hmi state, that will appear if
+ * no specific events are active
+ * @param app appication to setup regular State
+ * @param state state of new regular state
+ */
+ template <bool SendActivateApp>
+ void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "StateController");
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app) {
+ return;
+ }
+ DCHECK_OR_RETURN_VOID(state);
+ DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
+
+ if (state->hmi_level() == mobile_apis::HMILevel::INVALID_ENUM ||
+ state->audio_streaming_state() ==
+ mobile_apis::AudioStreamingState::INVALID_ENUM ||
+ state->system_context() == mobile_apis::SystemContext::INVALID_ENUM) {
+ LOG4CXX_ERROR(logger_, "Get invalid state");
+ return;
+ }
- if (SendActivateApp) {
- uint32_t corr_id = MessageHelper::SendActivateAppToHMI(app->app_id());
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
- corr_id);
- waiting_for_activate[app->app_id()] = state;
- } else {
- ApplyRegularState(app, state);
- }
+ if (app->is_resuming() && !IsResumptionAllowed(app, state)) {
+ return;
}
- /**
- * @brief SetRegularState Change regular audio state
- * @param app appication to setup regular State
- * @param audio_state of new regular state
- */
- void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::AudioStreamingState::eType audio_state);
-
- /**
- * @brief SetRegularState Change regular hmi level and audio state
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
- template <bool SendActivateApp>
- void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const mobile_apis::AudioStreamingState::eType audio_state) {
- if (!app) {
- return;
- }
- HmiStatePtr prev_regular = app->RegularHmiState();
- DCHECK_OR_RETURN_VOID(prev_regular);
- HmiStatePtr hmi_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(hmi_state);
- hmi_state->set_hmi_level(hmi_level);
- hmi_state->set_audio_streaming_state(audio_state);
- hmi_state->set_system_context(prev_regular->system_context());
- SetRegularState<SendActivateApp>(app, hmi_state);
+ HmiStatePtr resolved_state = ResolveHmiState(app, state);
+ if (!resolved_state) {
+ state->set_state_id(HmiState::STATE_ID_POSTPONED);
+ app->SetPostponedState(state);
+ return;
}
+ hmi_apis::Common_HMILevel::eType hmi_level =
+ static_cast<hmi_apis::Common_HMILevel::eType>(
+ resolved_state->hmi_level());
+ const bool is_full_allowed = hmi_apis::Common_HMILevel::FULL == hmi_level;
- /**
- * @brief SetRegularState Change regular hmi level
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
- template <bool SendActivateApp>
- void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level) {
- if (!app) {
+ if (SendActivateApp && is_full_allowed) {
+ int64_t corr_id = SendBCActivateApp(app, hmi_level, true);
+ if (-1 != corr_id) {
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_ActivateApp,
+ corr_id);
+ waiting_for_activate[app->app_id()] = resolved_state;
return;
}
- HmiStatePtr prev_regular = app->RegularHmiState();
- DCHECK_OR_RETURN_VOID(prev_regular);
- HmiStatePtr hmi_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(hmi_state);
- hmi_state->set_hmi_level(hmi_level);
- hmi_state->set_audio_streaming_state(prev_regular->audio_streaming_state());
- hmi_state->set_system_context(prev_regular->system_context());
- SetRegularState<SendActivateApp>(app, hmi_state);
+ LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateApp");
+ return;
}
-
- /**
- * @brief SetRegularState Change regular hmi level, audio state and system context
- * @param app appication to setup regular State
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param system_context of new regular state
- * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
- template <bool SendActivateApp>
- void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const mobile_apis::AudioStreamingState::eType audio_state,
- const mobile_apis::SystemContext::eType system_context) {
- if (!app) {
- return;
- }
-
- HmiStatePtr hmi_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(hmi_state);
- hmi_state->set_hmi_level(hmi_level);
- hmi_state->set_audio_streaming_state(audio_state);
- hmi_state->set_system_context(system_context);
- SetRegularState<SendActivateApp>(app, hmi_state);
+ ApplyRegularState(app, resolved_state);
+ }
+
+ /**
+ * @brief SetRegularState Change regular hmi level and audio state
+ * @param app appication to setup regular State
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ template <bool SendActivateApp>
+ void SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state) {
+ if (!app) {
+ return;
}
-
- /**
- * @brief SetRegularState Change regular system context
- * @param app appication to setup regular State
- * @param system_context of new regular state
- */
- void SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::SystemContext::eType system_context) {
- if (!app) {
- return;
- }
- HmiStatePtr prev_regular = app->RegularHmiState();
- DCHECK_OR_RETURN_VOID(prev_regular);
- HmiStatePtr hmi_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(hmi_state);
- hmi_state->set_hmi_level(prev_regular->hmi_level());
- hmi_state->set_audio_streaming_state(prev_regular->audio_streaming_state());
- hmi_state->set_system_context(system_context);
- SetRegularState<false>(app, hmi_state);
+ HmiStatePtr prev_regular = app->RegularHmiState();
+ DCHECK_OR_RETURN_VOID(prev_regular);
+ HmiStatePtr hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(hmi_state);
+ hmi_state->set_hmi_level(hmi_level);
+ hmi_state->set_audio_streaming_state(audio_state);
+ hmi_state->set_system_context(prev_regular->system_context());
+ SetRegularState<SendActivateApp>(app, hmi_state);
+ }
+
+ /**
+ * @brief SetRegularState Change regular hmi level
+ * @param app appication to setup regular State
+ * @param hmi_level of new regular state
+ * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI
+ */
+ template <bool SendActivateApp>
+ void SetRegularState(ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level) {
+ using namespace mobile_apis;
+ using namespace helpers;
+ if (!app) {
+ return;
}
-
- // EventObserver interface
- void on_event(const event_engine::Event& event);
-
- /**
- * @brief OnStateChanged send HMIStatusNotification if neded
- * @param app application
- * @param old_state state before change
- * @param new_state state after change
- */
- void OnStateChanged(ApplicationSharedPtr app, HmiStatePtr old_state,
- HmiStatePtr new_state);
- /**
- * @brief state_context getter for state_context
- * @return
- */
- const StateContext& state_context() const {
- return state_context_;
+ const HmiStatePtr hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+
+ DCHECK_OR_RETURN_VOID(hmi_state);
+ hmi_state->set_hmi_level(hmi_level);
+ hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level));
+ hmi_state->set_system_context(SystemContext::SYSCTXT_MAIN);
+ SetRegularState<SendActivateApp>(app, hmi_state);
+ }
+
+ /**
+ * @brief SetRegularState Change regular hmi level, audio state and system
+ * context
+ * @param app appication to setup regular State
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param system_context of new regular state
+ * @param SendActivateApp: if true, ActivateAppRequest will be sent on HMI */
+ template <bool SendActivateApp>
+ void SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::SystemContext::eType system_context) {
+ if (!app) {
+ return;
}
- /**
- * @brief ApplyStatesForApp apply active HMI states for new App without s
- * ending any OnHMIStatus
- * @param app application to apply states
- */
- void ApplyStatesForApp(ApplicationSharedPtr app);
-
- /**
- * @brief OnNaviStreamingStarted process Navi streaming started
- */
- void OnNaviStreamingStarted();
-
- /**
- * @brief OnNaviStreamingStopped process Navi streaming stopped
- */
- void OnNaviStreamingStopped();
-
- private:
- /**
- * Execute Unary punction for each application
- */
- template < typename UnaryFunction,
- typename ContextAcessor = ApplicationManagerImpl >
- void ForEachApplication(UnaryFunction func) {
- using namespace utils;
- typename ContextAcessor::ApplicationListAccessor accessor;
- typedef typename ContextAcessor::ApplictionSetConstIt Iter;
- for (Iter it = accessor.begin(); it != accessor.end(); ++it) {
- if (it->valid()) {
- ApplicationConstSharedPtr const_app = *it;
- func(ContextAcessor::instance()->application(const_app->app_id()));
- }
- }
+ HmiStatePtr hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(hmi_state);
+ hmi_state->set_hmi_level(hmi_level);
+ hmi_state->set_audio_streaming_state(audio_state);
+ hmi_state->set_system_context(system_context);
+ SetRegularState<SendActivateApp>(app, hmi_state);
+ }
+
+ /**
+ * @brief SetRegularState Sets regular state with new hmi level
+ * to application
+ * @param app appication to setup regular state
+ * @param hmi_level new hmi level for application
+ */
+ void SetRegularState(ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level) {
+ if (!app) {
+ return;
}
-
- /**
- * @brief The HmiLevelConflictResolver struct
- * Move other application to HmiStates if applied moved to FULL or LIMITED
- */
- struct HmiLevelConflictResolver {
- ApplicationSharedPtr applied_;
- HmiStatePtr state_;
- StateController* state_ctrl_;
- HmiLevelConflictResolver(ApplicationSharedPtr app,
- HmiStatePtr state,
- StateController* state_ctrl):
- applied_(app), state_(state) {}
- void operator()(ApplicationSharedPtr to_resolve);
- };
-
- /**
- * Function to add new temporary HmiState for application
- */
- template <HmiState::StateID ID>
- void HMIStateStarted(ApplicationSharedPtr app) {
- DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr old_hmi_state = app->CurrentHmiState();
- HmiStatePtr new_hmi_state = CreateHmiState(app->app_id(), ID);
- DCHECK_OR_RETURN_VOID(new_hmi_state);
- DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() != HmiState::STATE_ID_REGULAR);
- new_hmi_state->set_parent(old_hmi_state);
- app->AddHMIState(new_hmi_state);
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ HmiStatePtr prev_state = app->RegularHmiState();
+ HmiStatePtr hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(hmi_state);
+ hmi_state->set_hmi_level(hmi_level);
+ hmi_state->set_audio_streaming_state(CalcAudioState(app, hmi_level));
+ hmi_state->set_system_context(
+ prev_state ? prev_state->system_context()
+ : mobile_apis::SystemContext::SYSCTXT_MAIN);
+ SetRegularState(app, hmi_state);
+ }
+
+ /**
+ * @brief SetRegularState Change regular audio state
+ * @param app appication to setup regular State
+ * @param audio_state of new regular state
+ */
+ void SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::AudioStreamingState::eType audio_state) {
+ if (!app) {
+ return;
}
-
- /**
- * @brief TempStateStarted add HMI State ID in StateController collection
- * @param ID state identifier
- */
- void TempStateStarted(HmiState::StateID ID);
-
- /**
- * @brief TempStateStopped remove HMI State ID from StateController collection
- * @param ID state identifier
- */
- void TempStateStopped(HmiState::StateID ID);
-
-
- /**
- * Function to remove temporary HmiState for application
- */
- template <HmiState::StateID ID>
- void HMIStateStopped(ApplicationSharedPtr app) {
- DCHECK_OR_RETURN_VOID(app);
- HmiStatePtr cur = app->CurrentHmiState();
- HmiStatePtr old_hmi_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(old_hmi_state);
- old_hmi_state->set_hmi_level(cur->hmi_level());
- old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
- old_hmi_state->set_system_context(cur->system_context());
- app->RemoveHMIState(ID);
- HmiStatePtr new_hmi_state = app->CurrentHmiState();
- OnStateChanged(app, old_hmi_state, new_hmi_state);
+ HmiStatePtr prev_state = app->RegularHmiState();
+ DCHECK_OR_RETURN_VOID(prev_state);
+ HmiStatePtr hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(hmi_state);
+ hmi_state->set_hmi_level(prev_state->hmi_level());
+ hmi_state->set_audio_streaming_state(audio_state);
+ hmi_state->set_system_context(prev_state->system_context());
+ SetRegularState<false>(app, hmi_state);
+ }
+
+ /**
+ * @brief SetRegularState Change regular system context
+ * @param app appication to setup regular State
+ * @param system_context of new regular state
+ */
+ virtual void SetRegularState(
+ ApplicationSharedPtr app,
+ const mobile_apis::SystemContext::eType system_context) {
+ if (!app) {
+ return;
}
-
- /**
- * @brief ApplyRegularState setup regular hmi state, that will appear if no
- * specific events are active, without sending ActivateApp
- * @param app appication to setup default State
- * @param state state of new defailt state
- */
- void ApplyRegularState(ApplicationSharedPtr app,
- HmiStatePtr state);
-
- /**
- * @brief SetupRegularHmiState set regular HMI State without
- * resolwing conflicts and ActivateApp request
- * @param app application
- * @param state hmi_state to setup
- */
- void SetupRegularHmiState(ApplicationSharedPtr app,
- HmiStatePtr state);
-
- /**
- * @brief IsSameAppType checkis if apps has same types
- * @param app1
- * @param app2
- * @return true if aps have same types, otherwise return false
- */
- bool IsSameAppType(ApplicationConstSharedPtr app1,
- ApplicationConstSharedPtr app2);
-
- /**
- * @brief SetupRegularHmiState set regular HMI State without
- * resolwing conflicts and ActivateApp request
- * @param app application
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- * @param system_context of new regular state
- */
- void SetupRegularHmiState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const mobile_apis::AudioStreamingState::eType audio_state,
- const mobile_apis::SystemContext::eType system_context);
-
- /**
- * @brief SetupRegularHmiState set regular HMI State without
- * resolwing conflicts and ActivateApp request
- * @param app application
- * @param hmi_level of new regular state
- * @param audio_state of new regular state
- */
- void SetupRegularHmiState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const mobile_apis::AudioStreamingState::eType audio_state);
-
- /**
- * @brief OnActivateAppResponse calback for activate app response
- * @param message Smart Object
- */
- void OnActivateAppResponse(const smart_objects::SmartObject& message);
-
- /**
- * @brief OnPhoneCallStarted process Phone Call Started event
- */
- void OnPhoneCallStarted();
-
- /**
- * @brief OnPhoneCallEnded process Phone Call Ended event
- */
- void OnPhoneCallEnded();
-
-
- /**
- * @brief OnSafetyModeEnabled process Safety Mode Enable event
- */
- void OnSafetyModeEnabled();
-
- /**
- * @brief OnSafetyModeDisabled process Safety Mode Disable event
- */
- void OnSafetyModeDisabled();
-
- /**
- * @brief OnVRStarted process VR session started
- */
- void OnVRStarted();
-
- /**
- * @brief OnVREnded process VR session ended
- */
- void OnVREnded();
- /**
- * @brief OnTTSStarted process TTS session started
- */
- void OnTTSStarted();
-
- /**
- * @brief OnTTSEnded process TTS session ended
- */
- void OnTTSStopped();
-
- /**
- * @brief CreateHmiState creates Hmi state according to state_id
- * @param app_id application ID
- * @param state_id state id
- * @return
- */
- HmiStatePtr CreateHmiState(uint32_t app_id, HmiState::StateID state_id);
-
- typedef std::list<HmiState::StateID> StateIDList;
- StateIDList active_states_;
- sync_primitives::Lock active_states_lock_;
- std::map<uint32_t, HmiStatePtr> waiting_for_activate;
- StateContext state_context_;
+ HmiStatePtr prev_regular = app->RegularHmiState();
+ DCHECK_OR_RETURN_VOID(prev_regular);
+ HmiStatePtr hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(hmi_state);
+ hmi_state->set_hmi_level(prev_regular->hmi_level());
+ hmi_state->set_audio_streaming_state(
+ CalcAudioState(app, prev_regular->hmi_level()));
+ hmi_state->set_system_context(system_context);
+ SetRegularState<false>(app, hmi_state);
+ }
+
+ /**
+ * @brief SetRegularState Sets new regular state to application
+ * @param app appication to setup regular state
+ * @param state new hmi state for application
+ */
+ void SetRegularState(ApplicationSharedPtr app, HmiStatePtr state) {
+ if (!app) {
+ return;
+ }
+ DCHECK_OR_RETURN_VOID(state);
+ if (mobile_apis::HMILevel::HMI_FULL == state->hmi_level()) {
+ SetRegularState<true>(app, state);
+ } else {
+ SetRegularState<false>(app, state);
+ }
+ }
+
+ // EventObserver interface
+ void on_event(const event_engine::Event& event);
+
+ /**
+ * @brief Sets default application state and apply currently active HMI states
+ * on application registration
+ * @param app application to apply states
+ * @param default_level default HMI level
+ */
+ virtual void OnApplicationRegistered(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType default_level);
+
+ /**
+ * @brief OnNaviStreamingStarted process Navi streaming started
+ */
+ virtual void OnNaviStreamingStarted();
+
+ /**
+ * @brief OnNaviStreamingStopped process Navi streaming stopped
+ */
+ virtual void OnNaviStreamingStopped();
+
+ /**
+ * @brief OnStateChanged send HMIStatusNotification if neded
+ * @param app application
+ * @param old_state state before change
+ * @param new_state state after change
+ */
+ void OnStateChanged(ApplicationSharedPtr app,
+ HmiStatePtr old_state,
+ HmiStatePtr new_state);
+
+ /**
+ * @brief Checks activity of Deactivate HMI state.
+ * @return Returns TRUE if deactivate HMI state is active, otherwise returns
+ * FALSE.
+ */
+ bool IsDeactivateHMIStateActive() const;
+
+ bool IsStateActive(HmiState::StateID state_id) const;
+
+ private:
+ int64_t SendBCActivateApp(ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority);
+ /**
+ * @brief The HmiLevelConflictResolver struct
+ * Move other application to HmiStates if applied moved to FULL or LIMITED
+ */
+ struct HmiLevelConflictResolver {
+ ApplicationSharedPtr applied_;
+ HmiStatePtr state_;
+ StateController* state_ctrl_;
+ HmiLevelConflictResolver(ApplicationSharedPtr app,
+ HmiStatePtr state,
+ StateController* state_ctrl)
+ : applied_(app), state_(state), state_ctrl_(state_ctrl) {}
+ void operator()(ApplicationSharedPtr to_resolve);
+ };
+
+ template <typename UnaryFunction>
+ void ForEachApplication(UnaryFunction func) const {
+ DataAccessor<ApplicationSet> accessor = app_mngr_->applications();
+ ApplicationSet::iterator it = accessor.GetData().begin();
+ for (; it != accessor.GetData().end(); ++it) {
+ ApplicationConstSharedPtr const_app = *it;
+ if (const_app) {
+ func(app_mngr_->application(const_app->app_id()));
+ }
+ }
+ }
+
+ /**
+ * @brief ResolveHmiState Checks if requested hmi state is
+ * allowed by current states context and correct it if it possible
+ *
+ * @param app application to apply state
+ *
+ * @param state state to be checked
+ *
+ * @return Resolved hmi state or empty pointer in case requested
+ * hmi state is not allowed
+ */
+ HmiStatePtr ResolveHmiState(ApplicationSharedPtr app,
+ HmiStatePtr state) const;
+
+ /**
+ * @brief IsResumptionAllowed checks, if app is allowed to be resumed in
+ * current state
+ * @param app Application
+ * @param state State to be checked
+ * @return true, if app is allowed to be resumed, otherwise - false
+ */
+ bool IsResumptionAllowed(ApplicationSharedPtr app, HmiStatePtr state) const;
+
+ /**
+ * @brief GetAvailableHmiLevel Returns closest to requested
+ * available hmi level for application
+ *
+ * @param app application to apply state
+ *
+ * @param hmi_level requested hmi level
+ *
+ * @return Resolved hmi state or empty pointer in case requested
+ * hmi state is not allowed
+ */
+ mobile_apis::HMILevel::eType GetAvailableHmiLevel(
+ ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const;
+
+ /**
+ * @brief IsStateAvailable Checks if hmi state is available
+ * to apply for specified application
+ *
+ * @param app application to apply state
+ *
+ * @param state state to be checked
+ *
+ * @return true if state is available, false otherwise
+ */
+ bool IsStateAvailable(ApplicationSharedPtr app, HmiStatePtr state) const;
+
+ /**
+ * @brief IsStateAvailableForResumption Checks if hmi state is available
+ * to apply for specified application during resumption
+ *
+ * @param app application to apply state
+ *
+ * @param state state to be checked
+ *
+ * @return true if state is available, false otherwise
+ */
+ bool IsStateAvailableForResumption(ApplicationSharedPtr app,
+ HmiStatePtr state) const;
+
+ /**
+ * @brief ApplyPostponedStateForApp tries to apply postponed state
+ * to application if it's allowed by current active states
+ */
+ void ApplyPostponedStateForApp(ApplicationSharedPtr app);
+
+ /**
+ * @brief IsTempStateActive Checks if specified temp state
+ * is currently active
+ *
+ * @return true if state is active, false otherwise
+ */
+ bool IsTempStateActive(HmiState::StateID ID) const;
+
+ /**
+ * Function to add new temporary HmiState for application
+ */
+ template <HmiState::StateID ID>
+ void HMIStateStarted(ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN_VOID(app);
+ HmiStatePtr old_hmi_state = app->CurrentHmiState();
+ HmiStatePtr new_hmi_state = CreateHmiState(app->app_id(), ID);
+ DCHECK_OR_RETURN_VOID(new_hmi_state);
+ DCHECK_OR_RETURN_VOID(new_hmi_state->state_id() !=
+ HmiState::STATE_ID_REGULAR);
+ new_hmi_state->set_parent(old_hmi_state);
+ app->AddHMIState(new_hmi_state);
+ OnStateChanged(app, old_hmi_state, new_hmi_state);
+ }
+
+ /**
+ * @brief TempStateStarted add HMI State ID in StateController collection
+ * @param ID state identifier
+ */
+ void TempStateStarted(HmiState::StateID ID);
+
+ /**
+ * @brief TempStateStopped remove HMI State ID from StateController collection
+ * @param ID state identifier
+ */
+ void TempStateStopped(HmiState::StateID ID);
+
+ /**
+ * @brief Sets BACKGROUND or LIMITED hmi level to application
+ * depends on application type
+ * @param app Application to deactivate
+ */
+ void DeactivateApp(ApplicationSharedPtr app);
+
+ /**
+ * Function to remove temporary HmiState for application
+ */
+ template <HmiState::StateID ID>
+ void HMIStateStopped(ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN_VOID(app);
+ HmiStatePtr cur = app->CurrentHmiState();
+ HmiStatePtr old_hmi_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(old_hmi_state);
+ old_hmi_state->set_hmi_level(cur->hmi_level());
+ old_hmi_state->set_audio_streaming_state(cur->audio_streaming_state());
+ old_hmi_state->set_system_context(cur->system_context());
+ app->RemoveHMIState(ID);
+ HmiStatePtr new_hmi_state = app->CurrentHmiState();
+ OnStateChanged(app, old_hmi_state, new_hmi_state);
+ }
+
+ /**
+ * @brief ApplyRegularState setup regular hmi state, that will appear if no
+ * specific events are active, without sending ActivateApp
+ * @param app appication to setup default State
+ * @param state state of new defailt state
+ */
+ void ApplyRegularState(ApplicationSharedPtr app, HmiStatePtr state);
+
+ /**
+ * @brief SetupRegularHmiState set regular HMI State without
+ * resolving conflicts and ActivateApp request
+ * @param app application
+ * @param state hmi_state to setup
+ */
+ void SetupRegularHmiState(ApplicationSharedPtr app, HmiStatePtr state);
+
+ /**
+ * @brief IsSameAppType checks if apps has same types
+ * @param app1
+ * @param app2
+ * @return true if aps have same types, otherwise return false
+ */
+ bool IsSameAppType(ApplicationConstSharedPtr app1,
+ ApplicationConstSharedPtr app2);
+
+ /**
+ * @brief SetupRegularHmiState set regular HMI State without
+ * resolving conflicts and ActivateApp request
+ * @param app application
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ * @param system_context of new regular state
+ */
+ void SetupRegularHmiState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state,
+ const mobile_apis::SystemContext::eType system_context);
+
+ /**
+ * @brief SetupRegularHmiState set regular HMI State without
+ * resolving conflicts and ActivateApp request
+ * @param app application
+ * @param hmi_level of new regular state
+ * @param audio_state of new regular state
+ */
+ void SetupRegularHmiState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state);
+
+ /**
+ * @brief OnActivateAppResponse calback for activate app response
+ * @param message Smart Object
+ */
+ void OnActivateAppResponse(const smart_objects::SmartObject& message);
+
+ /**
+ * @brief OnAppDeactivated callback for OnAppDeactivated notification
+ * @param message Smart Object
+ */
+ void OnAppDeactivated(const smart_objects::SmartObject& message);
+
+ /**
+ * @brief OnAppActivated callback for OnAppActivated notification
+ * @param message Smart Object
+ */
+ void OnAppActivated(const smart_objects::SmartObject& message);
+
+ /**
+ * @brief Apply temporary state
+ */
+ template <HmiState::StateID ID>
+ void ApplyTempState() {
+ ForEachApplication(std::bind1st(
+ std::mem_fun(&StateController::HMIStateStarted<ID>), this));
+ TempStateStarted(ID);
+ }
+
+ /**
+ * @brief Cancel temporary state
+ */
+ template <HmiState::StateID ID>
+ void CancelTempState() {
+ ForEachApplication(std::bind1st(
+ std::mem_fun(&StateController::HMIStateStopped<ID>), this));
+ TempStateStopped(ID);
+ }
+
+ /**
+ * @brief SetAplicationManager setter got app_mngr
+ * @param app_mngr
+ */
+ void SetAplicationManager(ApplicationManager* app_mngr);
+
+ /**
+ * @brief CreateHmiState creates Hmi state according to state_id
+ * @param app_id application ID
+ * @param state_id state id
+ * @return
+ */
+ HmiStatePtr CreateHmiState(uint32_t app_id, HmiState::StateID state_id) const;
+
+ mobile_apis::AudioStreamingState::eType CalcAudioState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level) const;
+
+ typedef std::list<HmiState::StateID> StateIDList;
+ StateIDList active_states_;
+ mutable sync_primitives::Lock active_states_lock_;
+ std::map<uint32_t, HmiStatePtr> waiting_for_activate;
+ ApplicationManager* app_mngr_;
};
-
}
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
-
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_STATE_CONTROLLER_H_
diff --git a/src/components/application_manager/include/application_manager/time_metric_observer.h b/src/components/application_manager/include/application_manager/telemetry_observer.h
index de3deb8372..052e9c9fee 100644
--- a/src/components/application_manager/include/application_manager/time_metric_observer.h
+++ b/src/components/application_manager/include/application_manager/telemetry_observer.h
@@ -43,7 +43,7 @@
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
namespace application_manager {
-class AMMetricObserver {
+class AMTelemetryObserver {
public:
struct MessageMetric {
TimevalStruct begin;
@@ -53,7 +53,7 @@ class AMMetricObserver {
typedef utils::SharedPtr<MessageMetric> MessageMetricSharedPtr;
virtual void OnMessage(MessageMetricSharedPtr) = 0;
- virtual ~AMMetricObserver(){}
+ virtual ~AMTelemetryObserver(){}
};
} // application_manager
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_USAGE_STATISTICS_H_
diff --git a/src/components/application_manager/include/application_manager/usage_statistics.h b/src/components/application_manager/include/application_manager/usage_statistics.h
index d6ff1f2c49..970c815607 100644
--- a/src/components/application_manager/include/application_manager/usage_statistics.h
+++ b/src/components/application_manager/include/application_manager/usage_statistics.h
@@ -34,16 +34,24 @@
#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_USAGE_STATISTICS_H_
#include <string>
+#include <memory>
#include "usage_statistics/counter.h"
+#include "usage_statistics/app_stopwatch.h"
+#include "utils/macro.h"
+#include "utils/shared_ptr.h"
#include "interfaces/MOBILE_API.h"
namespace application_manager {
class UsageStatistics {
public:
- UsageStatistics(const std::string& app_id,
- utils::SharedPtr<usage_statistics::StatisticsManager>
- statistics_manager);
+ UsageStatistics(
+ const std::string& app_id,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager);
+ UsageStatistics(
+ const std::string& app_id,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ usage_statistics::AppStopwatch* time_in_hmi_state_ptr);
void RecordHmiStateChanged(mobile_apis::HMILevel::eType new_hmi_level);
void RecordAppRegistrationGuiLanguage(
mobile_apis::Language::eType gui_language);
@@ -54,9 +62,10 @@ class UsageStatistics {
void RecordAppUserSelection();
void RecordRunAttemptsWhileRevoked();
void RecordRemovalsForBadBehavior();
+ void RecordTLSError();
private:
- usage_statistics::AppStopwatch time_in_hmi_state_;
+ std::auto_ptr<usage_statistics::AppStopwatch> time_in_hmi_state_sptr_;
usage_statistics::AppInfo app_registration_language_gui_;
usage_statistics::AppInfo app_registration_language_vui_;
usage_statistics::AppCounter count_of_rejected_rpc_calls_;
@@ -64,6 +73,8 @@ class UsageStatistics {
usage_statistics::AppCounter count_of_user_selections_;
usage_statistics::AppCounter count_of_run_attempts_while_revoked_;
usage_statistics::AppCounter count_of_removals_for_bad_behavior_;
+ usage_statistics::AppCounter count_of_tls_error_;
+ DISALLOW_COPY_AND_ASSIGN(UsageStatistics);
};
} // namespace application_manager
diff --git a/src/components/application_manager/src/application_data_impl.cc b/src/components/application_manager/src/application_data_impl.cc
index bfdbadfc8f..e83f49223d 100644
--- a/src/components/application_manager/src/application_data_impl.cc
+++ b/src/components/application_manager/src/application_data_impl.cc
@@ -37,7 +37,7 @@
#include "utils/logger.h"
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationDataImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
InitialApplicationDataImpl::InitialApplicationDataImpl()
: app_types_(NULL),
@@ -153,6 +153,14 @@ void InitialApplicationDataImpl::set_ui_language(
ui_language_ = ui_language;
}
+void InitialApplicationDataImpl::set_perform_interaction_layout(mobile_apis::LayoutMode::eType layout) {
+ perform_interaction_layout_ = layout;
+}
+
+mobile_apis::LayoutMode::eType InitialApplicationDataImpl::perform_interaction_layout() const {
+ return perform_interaction_layout_;
+}
+
DynamicApplicationDataImpl::DynamicApplicationDataImpl()
: help_prompt_(NULL),
timeout_prompt_(NULL),
diff --git a/src/components/application_manager/src/application_impl.cc b/src/components/application_manager/src/application_impl.cc
index 59b3830447..0ef7385314 100644
--- a/src/components/application_manager/src/application_impl.cc
+++ b/src/components/application_manager/src/application_impl.cc
@@ -30,9 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/application_impl.h"
#include <string>
#include <strings.h>
-#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "application_manager/application_manager_impl.h"
#include "protocol_handler/protocol_handler.h"
@@ -41,6 +41,8 @@
#include "utils/file_system.h"
#include "utils/logger.h"
#include "utils/gen_hash.h"
+#include "utils/make_shared.h"
+#include "utils/timer_task_impl.h"
namespace {
@@ -55,14 +57,10 @@ mobile_apis::FileType::eType StringToFileType(const char* str) {
return mobile_apis::FileType::GRAPHIC_PNG;
} else if (0 == strcasecmp(str, "wave")) {
return mobile_apis::FileType::AUDIO_WAVE;
- } else if ((0 == strcasecmp(str, "m4a")) ||
- (0 == strcasecmp(str, "m4b")) ||
- (0 == strcasecmp(str, "m4p")) ||
- (0 == strcasecmp(str, "m4v")) ||
- (0 == strcasecmp(str, "m4r")) ||
- (0 == strcasecmp(str, "3gp")) ||
- (0 == strcasecmp(str, "mp4")) ||
- (0 == strcasecmp(str, "aac"))) {
+ } else if ((0 == strcasecmp(str, "m4a")) || (0 == strcasecmp(str, "m4b")) ||
+ (0 == strcasecmp(str, "m4p")) || (0 == strcasecmp(str, "m4v")) ||
+ (0 == strcasecmp(str, "m4r")) || (0 == strcasecmp(str, "3gp")) ||
+ (0 == strcasecmp(str, "mp4")) || (0 == strcasecmp(str, "aac"))) {
return mobile_apis::FileType::AUDIO_AAC;
} else if (0 == strcasecmp(str, "mp3")) {
return mobile_apis::FileType::AUDIO_MP3;
@@ -72,44 +70,56 @@ mobile_apis::FileType::eType StringToFileType(const char* str) {
}
}
-namespace application_manager {
-
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
-
-ApplicationImpl::ApplicationImpl(uint32_t application_id,
- const std::string& mobile_app_id,
- const std::string& app_name,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager)
- : grammar_id_(0),
- hmi_app_id_(0),
- app_id_(application_id),
- active_message_(NULL),
- is_media_(false),
- is_navi_(false),
- video_streaming_approved_(false),
- audio_streaming_approved_(false),
- video_streaming_allowed_(false),
- audio_streaming_allowed_(false),
- video_streaming_suspended_(true),
- audio_streaming_suspended_(true),
- is_app_allowed_(true),
- has_been_activated_(false),
- tts_properties_in_none_(false),
- tts_properties_in_full_(false),
- put_file_in_none_count_(0),
- delete_file_in_none_count_(0),
- list_files_in_none_count_(0),
- device_(0),
- usage_report_(mobile_app_id, statistics_manager),
- protocol_version_(ProtocolVersion::kV3),
- is_voice_communication_application_(false),
- video_stream_retry_number_(0),
- audio_stream_retry_number_(0) {
-
- cmd_number_to_time_limits_[mobile_apis::FunctionID::ReadDIDID] =
- {date_time::DateTime::getCurrentTime(), 0};
- cmd_number_to_time_limits_[mobile_apis::FunctionID::GetVehicleDataID] =
- {date_time::DateTime::getCurrentTime(), 0};
+namespace application_manager {
+ApplicationImpl::ApplicationImpl(
+ uint32_t application_id,
+ const std::string& mobile_app_id,
+ const std::string& mac_address,
+ const custom_str::CustomString& app_name,
+ utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager)
+ : grammar_id_(0)
+ , hmi_app_id_(0)
+ , app_id_(application_id)
+ , active_message_(NULL)
+ , is_media_(false)
+ , is_navi_(false)
+ , video_streaming_approved_(false)
+ , audio_streaming_approved_(false)
+ , video_streaming_allowed_(false)
+ , audio_streaming_allowed_(false)
+ , video_streaming_suspended_(true)
+ , audio_streaming_suspended_(true)
+ , is_app_allowed_(true)
+ , has_been_activated_(false)
+ , tts_properties_in_none_(false)
+ , tts_properties_in_full_(false)
+ , is_application_data_changed_(false)
+ , put_file_in_none_count_(0)
+ , delete_file_in_none_count_(0)
+ , list_files_in_none_count_(0)
+ , device_(0)
+ , mac_address_(mac_address)
+ , usage_report_(mobile_app_id, statistics_manager)
+ , protocol_version_(ProtocolVersion::kV3)
+ , is_voice_communication_application_(false)
+ , is_resuming_(false)
+ , video_stream_retry_number_(0)
+ , audio_stream_retry_number_(0)
+ , video_stream_suspend_timer_(
+ "VideoStreamSuspend",
+ new ::timer::TimerTaskImpl<ApplicationImpl>(
+ this,
+ &ApplicationImpl::OnVideoStreamSuspend))
+ , audio_stream_suspend_timer_(
+ "AudioStreamSuspend",
+ new ::timer::TimerTaskImpl<ApplicationImpl>(
+ this,
+ &ApplicationImpl::OnAudioStreamSuspend)) {
+ cmd_number_to_time_limits_[mobile_apis::FunctionID::ReadDIDID] = {
+ date_time::DateTime::getCurrentTime(), 0};
+ cmd_number_to_time_limits_[mobile_apis::FunctionID::GetVehicleDataID] = {
+ date_time::DateTime::getCurrentTime(), 0};
set_mobile_app_id(mobile_app_id);
set_name(app_name);
@@ -121,25 +131,17 @@ ApplicationImpl::ApplicationImpl(uint32_t application_id,
// load persistent files
LoadPersistentFiles();
HmiStatePtr initial_state =
- ApplicationManagerImpl::instance()->CreateRegularState(app_id(),
- mobile_apis::HMILevel::INVALID_ENUM,
- mobile_apis::AudioStreamingState::INVALID_ENUM,
- mobile_api::SystemContext::SYSCTXT_MAIN);
- hmi_states_.push_back(initial_state);
+ ApplicationManagerImpl::instance()->CreateRegularState(
+ app_id(),
+ mobile_apis::HMILevel::INVALID_ENUM,
+ mobile_apis::AudioStreamingState::INVALID_ENUM,
+ mobile_api::SystemContext::SYSCTXT_MAIN);
+ state_.InitState(initial_state);
video_stream_suspend_timeout_ =
- profile::Profile::instance()->video_data_stopped_timeout() / 1000;
+ profile::Profile::instance()->video_data_stopped_timeout();
audio_stream_suspend_timeout_ =
- profile::Profile::instance()->audio_data_stopped_timeout() / 1000;
-
- video_stream_suspend_timer_ = ApplicationTimerPtr(
- new timer::TimerThread<ApplicationImpl>(
- "VideoStreamSuspend", this,
- &ApplicationImpl::OnVideoStreamSuspend, true));
- audio_stream_suspend_timer_ = ApplicationTimerPtr(
- new timer::TimerThread<ApplicationImpl>(
- "AudioStreamSuspend", this,
- &ApplicationImpl::OnAudioStreamSuspend, true));
+ profile::Profile::instance()->audio_data_stopped_timeout();
}
ApplicationImpl::~ApplicationImpl() {
@@ -187,7 +189,6 @@ void ApplicationImpl::ChangeSupportingAppHMIType() {
}
}
-
void ApplicationImpl::set_is_navi(bool allow) {
is_navi_ = allow;
}
@@ -202,74 +203,52 @@ void ApplicationImpl::set_voice_communication_supported(
}
bool ApplicationImpl::IsAudioApplication() const {
- return is_media_ ||
- is_voice_communication_application_ ||
- is_navi_;
+ return is_media_ || is_voice_communication_application_ || is_navi_;
}
void ApplicationImpl::SetRegularState(HmiStatePtr state) {
- DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
- hmi_states_.erase(hmi_states_.begin());
- if (hmi_states_.begin() != hmi_states_.end()) {
- HmiStatePtr first_temp = hmi_states_.front();
- DCHECK_OR_RETURN_VOID(first_temp);
- first_temp->set_parent(state);
- }
- hmi_states_.push_front(state);
+ LOG4CXX_AUTO_TRACE(logger_);
+ state_.AddState(state);
}
-void ApplicationImpl::AddHMIState(HmiStatePtr state) {
- DCHECK_OR_RETURN_VOID(state);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- hmi_states_.push_back(state);
+void ApplicationImpl::RemovePostponedState() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ state_.RemoveState(HmiState::STATE_ID_POSTPONED);
}
-struct StateIdFindPredicate {
- HmiState::StateID state_id_;
- StateIdFindPredicate(HmiState::StateID state_id):
- state_id_(state_id) {}
- bool operator ()(const HmiStatePtr cur) {
- return cur->state_id() == state_id_;
- }
+void ApplicationImpl::SetPostponedState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ state_.AddState(state);
+}
+
+struct StateIDComparator {
+ HmiState::StateID state_id_;
+ StateIDComparator(HmiState::StateID state_id) : state_id_(state_id) {}
+ bool operator()(const HmiStatePtr cur) {
+ return cur->state_id() == state_id_;
+ }
};
+void ApplicationImpl::AddHMIState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ state_.AddState(state);
+}
+
void ApplicationImpl::RemoveHMIState(HmiState::StateID state_id) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- HmiStateList::iterator it =
- std::find_if(hmi_states_.begin(), hmi_states_.end(),
- StateIdFindPredicate(state_id));
- if (it != hmi_states_.end()) {
- // unable to remove regular state
- DCHECK_OR_RETURN_VOID(it != hmi_states_.begin());
- HmiStateList::iterator next = it;
- HmiStateList::iterator prev = it;
- next++;
- prev--;
- if (next != hmi_states_.end()) {
- HmiStatePtr next_state = *next;
- HmiStatePtr prev_state = *prev;
- next_state->set_parent(prev_state);
- }
- hmi_states_.erase(it);
- } else {
- LOG4CXX_ERROR(logger_, "Unsuccesfull remove HmiState: " << state_id);
- }
+ state_.RemoveState(state_id);
}
const HmiStatePtr ApplicationImpl::CurrentHmiState() const {
- sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- //TODO(APPLINK-11448) Need implement
- return hmi_states_.back();
+ return state_.GetState(HmiState::STATE_ID_CURRENT);
+}
+
+const HmiStatePtr ApplicationImpl::RegularHmiState() const {
+ return state_.GetState(HmiState::STATE_ID_REGULAR);
}
-const HmiStatePtr ApplicationImpl::RegularHmiState() const{
- //sync_primitives::AutoLock auto_lock(hmi_states_lock_);
- DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
- return hmi_states_.front();
+const HmiStatePtr ApplicationImpl::PostponedHmiState() const {
+ return state_.GetState(HmiState::STATE_ID_POSTPONED);
}
const smart_objects::SmartObject* ApplicationImpl::active_message() const {
@@ -284,12 +263,17 @@ void ApplicationImpl::set_hmi_application_id(uint32_t hmi_app_id) {
hmi_app_id_ = hmi_app_id;
}
-const std::string& ApplicationImpl::name() const {
+const custom_str::CustomString& ApplicationImpl::name() const {
return app_name_;
}
+void application_manager::ApplicationImpl::set_folder_name(
+ const std::string& folder_name) {
+ folder_name_ = folder_name;
+}
+
const std::string ApplicationImpl::folder_name() const {
- return name() + mobile_app_id();
+ return folder_name_;
}
bool ApplicationImpl::is_media_application() const {
@@ -322,12 +306,11 @@ const uint32_t ApplicationImpl::list_files_in_none_count() const {
return list_files_in_none_count_;
}
-const mobile_api::SystemContext::eType
-ApplicationImpl::system_context() const {
+const mobile_api::SystemContext::eType ApplicationImpl::system_context() const {
using namespace mobile_apis;
const HmiStatePtr hmi_state = CurrentHmiState();
- return hmi_state ? hmi_state->system_context() :
- SystemContext::INVALID_ENUM;;
+ return hmi_state ? hmi_state->system_context() : SystemContext::INVALID_ENUM;
+ ;
}
const std::string& ApplicationImpl::app_icon_path() const {
@@ -338,11 +321,15 @@ connection_handler::DeviceHandle ApplicationImpl::device() const {
return device_;
}
+const std::string& ApplicationImpl::mac_address() const{
+ return mac_address_;
+}
+
void ApplicationImpl::set_version(const Version& ver) {
version_ = ver;
}
-void ApplicationImpl::set_name(const std::string& name) {
+void ApplicationImpl::set_name(const custom_str::CustomString& name) {
app_name_ = name;
}
@@ -351,18 +338,10 @@ void ApplicationImpl::set_is_media_application(bool is_media) {
}
bool IsTTSState(const HmiStatePtr state) {
- return state->state_id() == HmiState::STATE_ID_TTS_SESSION ;
+ return state->state_id() == HmiState::STATE_ID_TTS_SESSION;
}
-bool ApplicationImpl::tts_speak_state() {
- sync_primitives::AutoLock autolock(hmi_states_lock_);
- HmiStateList::const_iterator it =
- std::find_if(hmi_states_.begin(), hmi_states_.end(), IsTTSState);
- return it != hmi_states_.end();
-}
-
-void ApplicationImpl::set_tts_properties_in_none(
- bool active) {
+void ApplicationImpl::set_tts_properties_in_none(bool active) {
tts_properties_in_none_ = active;
}
@@ -370,8 +349,7 @@ bool ApplicationImpl::tts_properties_in_none() {
return tts_properties_in_none_;
}
-void ApplicationImpl::set_tts_properties_in_full(
- bool active) {
+void ApplicationImpl::set_tts_properties_in_full(bool active) {
tts_properties_in_full_ = active;
}
@@ -417,18 +395,36 @@ void ApplicationImpl::StartStreaming(
LOG4CXX_AUTO_TRACE(logger_);
if (ServiceType::kMobileNav == service_type) {
+ LOG4CXX_TRACE(logger_, "ServiceType = Video");
if (!video_streaming_approved()) {
+ LOG4CXX_TRACE(logger_, "Video streaming not approved");
MessageHelper::SendNaviStartStream(app_id());
set_video_stream_retry_number(0);
}
} else if (ServiceType::kAudio == service_type) {
+ LOG4CXX_TRACE(logger_, "ServiceType = Audio");
if (!audio_streaming_approved()) {
+ LOG4CXX_TRACE(logger_, "Audio streaming not approved");
MessageHelper::SendAudioStartStream(app_id());
- set_video_stream_retry_number(0);
+ set_audio_stream_retry_number(0);
}
}
}
+void ApplicationImpl::StopStreamingForce(
+ protocol_handler::ServiceType service_type) {
+ using namespace protocol_handler;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ SuspendStreaming(service_type);
+
+ if (service_type == ServiceType::kMobileNav) {
+ StopNaviStreaming();
+ } else if (service_type == ServiceType::kAudio) {
+ StopAudioStreaming();
+ }
+}
+
void ApplicationImpl::StopStreaming(
protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
@@ -436,34 +432,44 @@ void ApplicationImpl::StopStreaming(
SuspendStreaming(service_type);
- if (ServiceType::kMobileNav == service_type) {
- if (video_streaming_approved()) {
- video_stream_suspend_timer_->stop();
- MessageHelper::SendNaviStopStream(app_id());
- set_video_streaming_approved(false);
- }
- } else if (ServiceType::kAudio == service_type) {
- if (audio_streaming_approved()) {
- audio_stream_suspend_timer_->stop();
- MessageHelper::SendAudioStopStream(app_id());
- set_audio_streaming_approved(false);
- }
+ if (service_type == ServiceType::kMobileNav &&
+ video_streaming_approved()) {
+ StopNaviStreaming();
+ } else if (service_type == ServiceType::kAudio &&
+ audio_streaming_approved()) {
+ StopAudioStreaming();
}
}
+void ApplicationImpl::StopNaviStreaming() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ video_stream_suspend_timer_.Stop();
+ MessageHelper::SendNaviStopStream(app_id());
+ set_video_streaming_approved(false);
+ set_video_stream_retry_number(0);
+}
+
+void ApplicationImpl::StopAudioStreaming() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ audio_stream_suspend_timer_.Stop();
+ MessageHelper::SendAudioStopStream(app_id());
+ set_audio_streaming_approved(false);
+ set_audio_stream_retry_number(0);
+}
+
void ApplicationImpl::SuspendStreaming(
protocol_handler::ServiceType service_type) {
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
if (ServiceType::kMobileNav == service_type) {
- video_stream_suspend_timer_->suspend();
+ video_stream_suspend_timer_.Stop();
ApplicationManagerImpl::instance()->OnAppStreaming(
app_id(), service_type, false);
sync_primitives::AutoLock lock(video_streaming_suspended_lock_);
video_streaming_suspended_ = true;
} else if (ServiceType::kAudio == service_type) {
- audio_stream_suspend_timer_->suspend();
+ audio_stream_suspend_timer_.Stop();
ApplicationManagerImpl::instance()->OnAppStreaming(
app_id(), service_type, false);
sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
@@ -485,7 +491,7 @@ void ApplicationImpl::WakeUpStreaming(
MessageHelper::SendOnDataStreaming(ServiceType::kMobileNav, true);
video_streaming_suspended_ = false;
}
- video_stream_suspend_timer_->start(video_stream_suspend_timeout_);
+ video_stream_suspend_timer_.Start(video_stream_suspend_timeout_, true);
} else if (ServiceType::kAudio == service_type) {
sync_primitives::AutoLock lock(audio_streaming_suspended_lock_);
if (audio_streaming_suspended_) {
@@ -494,7 +500,7 @@ void ApplicationImpl::WakeUpStreaming(
MessageHelper::SendOnDataStreaming(ServiceType::kAudio, true);
audio_streaming_suspended_ = false;
}
- audio_stream_suspend_timer_->start(audio_stream_suspend_timeout_);
+ audio_stream_suspend_timer_.Start(audio_stream_suspend_timeout_, true);
}
}
@@ -567,9 +573,9 @@ void ApplicationImpl::set_grammar_id(uint32_t value) {
}
void ApplicationImpl::ResetDataInNone() {
- put_file_in_none_count_ = 0;
- delete_file_in_none_count_ = 0;
- list_files_in_none_count_ = 0;
+ put_file_in_none_count_ = 0;
+ delete_file_in_none_count_ = 0;
+ list_files_in_none_count_ = 0;
}
bool ApplicationImpl::has_been_activated() const {
@@ -590,20 +596,30 @@ ProtocolVersion ApplicationImpl::protocol_version() const {
return protocol_version_;
}
-bool ApplicationImpl::AddFile(AppFile& file) {
+void ApplicationImpl::set_is_resuming(bool is_resuming) {
+ is_resuming_ = is_resuming;
+}
+
+bool ApplicationImpl::is_resuming() const {
+ return is_resuming_;
+}
+
+bool ApplicationImpl::AddFile(const AppFile& file) {
if (app_files_.count(file.file_name) == 0) {
- LOG4CXX_INFO(logger_, "AddFile file " << file.file_name
- << " File type is " << file.file_type);
+ LOG4CXX_INFO(logger_,
+ "AddFile file " << file.file_name << " File type is "
+ << file.file_type);
app_files_[file.file_name] = file;
return true;
}
return false;
}
-bool ApplicationImpl::UpdateFile(AppFile& file) {
+bool ApplicationImpl::UpdateFile(const AppFile& file) {
if (app_files_.count(file.file_name) != 0) {
- LOG4CXX_INFO(logger_, "UpdateFile file " << file.file_name
- << " File type is " << file.file_type);
+ LOG4CXX_INFO(logger_,
+ "UpdateFile file " << file.file_name << " File type is "
+ << file.file_type);
app_files_[file.file_name] = file;
return true;
}
@@ -613,8 +629,9 @@ bool ApplicationImpl::UpdateFile(AppFile& file) {
bool ApplicationImpl::DeleteFile(const std::string& file_name) {
AppFilesMap::iterator it = app_files_.find(file_name);
if (it != app_files_.end()) {
- LOG4CXX_INFO(logger_, "DeleteFile file " << it->second.file_name
- << " File type is " << it->second.file_type);
+ LOG4CXX_INFO(logger_,
+ "DeleteFile file " << it->second.file_name << " File type is "
+ << it->second.file_type);
app_files_.erase(it);
return true;
}
@@ -626,45 +643,47 @@ const AppFilesMap& ApplicationImpl::getAppFiles() const {
}
const AppFile* ApplicationImpl::GetFile(const std::string& file_name) {
- if (app_files_.find(file_name) != app_files_.end()) {
- return &(app_files_[file_name]);
- }
- return NULL;
+ if (app_files_.find(file_name) != app_files_.end()) {
+ return &(app_files_[file_name]);
+ }
+ return NULL;
}
-bool ApplicationImpl::SubscribeToButton(mobile_apis::ButtonName::eType btn_name) {
- size_t old_size = subscribed_buttons_.size();
- subscribed_buttons_.insert(btn_name);
- return (subscribed_buttons_.size() == old_size + 1);
+bool ApplicationImpl::SubscribeToButton(
+ mobile_apis::ButtonName::eType btn_name) {
+ sync_primitives::AutoLock lock(button_lock_);
+ return subscribed_buttons_.insert(btn_name).second;
}
-bool ApplicationImpl::IsSubscribedToButton(mobile_apis::ButtonName::eType btn_name) {
- std::set<mobile_apis::ButtonName::eType>::iterator it = subscribed_buttons_.find(btn_name);
+bool ApplicationImpl::IsSubscribedToButton(
+ mobile_apis::ButtonName::eType btn_name) {
+ sync_primitives::AutoLock lock(button_lock_);
+ std::set<mobile_apis::ButtonName::eType>::iterator it =
+ subscribed_buttons_.find(btn_name);
return (subscribed_buttons_.end() != it);
}
-bool ApplicationImpl::UnsubscribeFromButton(mobile_apis::ButtonName::eType btn_name) {
- size_t old_size = subscribed_buttons_.size();
- subscribed_buttons_.erase(btn_name);
- return (subscribed_buttons_.size() == old_size - 1);
+bool ApplicationImpl::UnsubscribeFromButton(
+ mobile_apis::ButtonName::eType btn_name) {
+ sync_primitives::AutoLock lock(button_lock_);
+ return subscribed_buttons_.erase(btn_name);
}
-bool ApplicationImpl::SubscribeToIVI(uint32_t vehicle_info_type_) {
- size_t old_size = subscribed_vehicle_info_.size();
- subscribed_vehicle_info_.insert(vehicle_info_type_);
- return (subscribed_vehicle_info_.size() == old_size + 1);
+bool ApplicationImpl::SubscribeToIVI(uint32_t vehicle_info_type) {
+ sync_primitives::AutoLock lock(vi_lock_);
+ return subscribed_vehicle_info_.insert(vehicle_info_type).second;
}
-bool ApplicationImpl::IsSubscribedToIVI(uint32_t vehicle_info_type_) {
- std::set<uint32_t>::iterator it = subscribed_vehicle_info_.find(
- vehicle_info_type_);
+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);
return (subscribed_vehicle_info_.end() != it);
}
-bool ApplicationImpl::UnsubscribeFromIVI(uint32_t vehicle_info_type_) {
- size_t old_size = subscribed_vehicle_info_.size();
- subscribed_vehicle_info_.erase(vehicle_info_type_);
- return (subscribed_vehicle_info_.size() == old_size - 1);
+bool ApplicationImpl::UnsubscribeFromIVI(uint32_t vehicle_info_type) {
+ sync_primitives::AutoLock lock(vi_lock_);
+ return subscribed_vehicle_info_.erase(vehicle_info_type);
}
UsageStatistics& ApplicationImpl::usage_report() {
@@ -672,116 +691,137 @@ UsageStatistics& ApplicationImpl::usage_report() {
}
bool ApplicationImpl::IsCommandLimitsExceeded(
- mobile_apis::FunctionID::eType cmd_id,
- TLimitSource source) {
+ mobile_apis::FunctionID::eType cmd_id, TLimitSource source) {
TimevalStruct current = date_time::DateTime::getCurrentTime();
switch (source) {
- // In case of config file values there is COMMON limitations for number of
- // commands per certain time in seconds, i.e. 5 requests per 10 seconds with
- // any interval between them
- case CONFIG_FILE: {
- CommandNumberTimeLimit::iterator it =
- cmd_number_to_time_limits_.find(cmd_id);
- if (cmd_number_to_time_limits_.end() == it) {
- LOG4CXX_WARN(logger_, "Limits for command id " << cmd_id
- << "had not been set.");
- return true;
- }
+ // In case of config file values there is COMMON limitations for number of
+ // commands per certain time in seconds, i.e. 5 requests per 10 seconds with
+ // any interval between them
+ case CONFIG_FILE: {
+ CommandNumberTimeLimit::iterator it =
+ cmd_number_to_time_limits_.find(cmd_id);
+ if (cmd_number_to_time_limits_.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "Limits for command id " << cmd_id << "had not been set.");
+ return true;
+ }
- TimeToNumberLimit& limit = it->second;
+ TimeToNumberLimit& limit = it->second;
- std::pair<uint32_t, int32_t> frequency_restrictions;
+ std::pair<uint32_t, int32_t> frequency_restrictions;
- if (mobile_apis::FunctionID::ReadDIDID == cmd_id) {
- frequency_restrictions =
- profile::Profile::instance()->read_did_frequency();
+ if (mobile_apis::FunctionID::ReadDIDID == cmd_id) {
+ frequency_restrictions =
+ profile::Profile::instance()->read_did_frequency();
- } else if (mobile_apis::FunctionID::GetVehicleDataID == cmd_id) {
- frequency_restrictions =
- profile::Profile::instance()->get_vehicle_data_frequency();
- } else {
- LOG4CXX_INFO(logger_, "No restrictions for request");
- return false;
- }
-
- LOG4CXX_INFO(logger_, "Time Info: " <<
- "\n Current: " << current.tv_sec <<
- "\n Limit: (" << limit.first.tv_sec << "," << limit.second << ")"
- "\n frequency_restrictions: (" << frequency_restrictions.first << "," << frequency_restrictions.second << ")"
- );
- if (current.tv_sec < limit.first.tv_sec + frequency_restrictions.second) {
- if (limit.second < frequency_restrictions.first) {
- ++limit.second;
+ } else if (mobile_apis::FunctionID::GetVehicleDataID == cmd_id) {
+ frequency_restrictions =
+ profile::Profile::instance()->get_vehicle_data_frequency();
+ } else {
+ LOG4CXX_INFO(logger_, "No restrictions for request");
return false;
}
- return true;
- }
- limit.first = current;
- limit.second = 1;
+ LOG4CXX_INFO(logger_,
+ "Time Info: "
+ << "\n Current: "
+ << current.tv_sec
+ << "\n Limit: ("
+ << limit.first.tv_sec
+ << ","
+ << limit.second
+ << ")"
+ "\n frequency_restrictions: ("
+ << frequency_restrictions.first
+ << ","
+ << frequency_restrictions.second
+ << ")");
+ if (current.tv_sec < limit.first.tv_sec + frequency_restrictions.second) {
+ if (limit.second < frequency_restrictions.first) {
+ ++limit.second;
+ return false;
+ }
+ return true;
+ }
- return false;
+ limit.first = current;
+ limit.second = 1;
- break;
- }
- // In case of policy table values, there is EVEN limitation for number of
- // commands per minute, e.g. 10 command per minute i.e. 1 command per 6 sec
- case POLICY_TABLE: {
- uint32_t cmd_limit = application_manager::MessageHelper::GetAppCommandLimit(
- mobile_app_id_);
+ return false;
- if (0 == cmd_limit) {
- return true;
+ break;
}
+ // In case of policy table values, there is EVEN limitation for number of
+ // commands per minute, e.g. 10 command per minute i.e. 1 command per 6 sec
+ case POLICY_TABLE: {
+ uint32_t cmd_limit =
+ application_manager::MessageHelper::GetAppCommandLimit(
+ mobile_app_id_);
+
+ if (0 == cmd_limit) {
+ return true;
+ }
- const uint32_t dummy_limit = 1;
- CommandNumberTimeLimit::iterator it =
- cmd_number_to_time_limits_.find(cmd_id);
- // If no command with cmd_id had been executed yet, just add to limits
- if (cmd_number_to_time_limits_.end() == it) {
- cmd_number_to_time_limits_[cmd_id] = {current, dummy_limit};
- return false;
- }
+ const uint32_t dummy_limit = 1;
+ CommandNumberTimeLimit::iterator it =
+ cmd_number_to_time_limits_.find(cmd_id);
+ // If no command with cmd_id had been executed yet, just add to limits
+ if (cmd_number_to_time_limits_.end() == it) {
+ cmd_number_to_time_limits_[cmd_id] = {current, dummy_limit};
+ return false;
+ }
- const uint32_t minute = 60;
+ const uint32_t minute = 60;
- TimeToNumberLimit& limit = it->second;
+ TimeToNumberLimit& limit = it->second;
- // Checking even limitation for command
- if (static_cast<uint32_t>(current.tv_sec - limit.first.tv_sec) <
- minute/cmd_limit) {
- return true;
- }
+ // Checking even limitation for command
+ if (static_cast<uint32_t>(current.tv_sec - limit.first.tv_sec) <
+ minute / cmd_limit) {
+ return true;
+ }
- cmd_number_to_time_limits_[cmd_id] = {current, dummy_limit};
+ cmd_number_to_time_limits_[cmd_id] = {current, dummy_limit};
- return false;
- break;
- }
- default: {
- LOG4CXX_WARN(logger_, "Limit source is not implemented.");
- break;
- }
+ return false;
+ break;
+ }
+ default: {
+ LOG4CXX_WARN(logger_, "Limit source is not implemented.");
+ break;
+ }
}
return true;
}
-const std::set<mobile_apis::ButtonName::eType>& ApplicationImpl::SubscribedButtons() const {
- return subscribed_buttons_;
+DataAccessor<ButtonSubscriptions> ApplicationImpl::SubscribedButtons() const {
+ return DataAccessor<ButtonSubscriptions>(subscribed_buttons_, button_lock_);
}
-const std::set<uint32_t>& ApplicationImpl::SubscribesIVI() const {
- return subscribed_vehicle_info_;
+DataAccessor<VehicleInfoSubscriptions> ApplicationImpl::SubscribedIVI() const {
+ return DataAccessor<VehicleInfoSubscriptions>(subscribed_vehicle_info_,
+ vi_lock_);
}
const std::string& ApplicationImpl::curHash() const {
return hash_val_;
}
+bool ApplicationImpl::is_application_data_changed() const {
+ return is_application_data_changed_;
+}
+
+void ApplicationImpl::set_is_application_data_changed(
+ bool state_application_data) {
+ is_application_data_changed_ = state_application_data;
+}
+
void ApplicationImpl::UpdateHash() {
LOG4CXX_AUTO_TRACE(logger_);
hash_val_ = utils::gen_hash(profile::Profile::instance()->hash_string_size());
+ set_is_application_data_changed(true);
+
MessageHelper::SendHashUpdateNotification(app_id());
}
@@ -791,8 +831,7 @@ void ApplicationImpl::CleanupFiles() {
directory_name += "/" + folder_name();
if (file_system::DirectoryExists(directory_name)) {
- std::vector<std::string> files = file_system::ListFiles(
- directory_name);
+ std::vector<std::string> files = file_system::ListFiles(directory_name);
AppFilesMap::const_iterator app_files_it;
std::vector<std::string>::const_iterator it = files.begin();
@@ -804,7 +843,7 @@ void ApplicationImpl::CleanupFiles() {
if ((app_files_it == app_files_.end()) ||
(!app_files_it->second.is_persistent)) {
LOG4CXX_INFO(logger_, "DeleteFile file " << file_name);
- file_system::DeleteFile(file_name);
+ file_system::DeleteFile(file_name);
}
}
@@ -853,17 +892,20 @@ void ApplicationImpl::LoadPersistentFiles() {
file.file_type = StringToFileType(file_type.c_str());
}
- LOG4CXX_INFO(logger_, "Loaded persistent file " << file.file_name
- << " File type is " << file.file_type);
+ LOG4CXX_INFO(logger_,
+ "Loaded persistent file " << file.file_name
+ << " File type is "
+ << file.file_type);
AddFile(file);
}
}
}
-void ApplicationImpl::SubscribeToSoftButtons(int32_t cmd_id,
- const SoftButtonID& softbuttons_id) {
+void ApplicationImpl::SubscribeToSoftButtons(
+ int32_t cmd_id, const SoftButtonID& softbuttons_id) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
- if (static_cast<int32_t>(mobile_apis::FunctionID::ScrollableMessageID) == cmd_id) {
+ if (static_cast<int32_t>(mobile_apis::FunctionID::ScrollableMessageID) ==
+ cmd_id) {
CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
if (cmd_softbuttonid_.end() == it) {
cmd_softbuttonid_[cmd_id] = softbuttons_id;
@@ -877,7 +919,7 @@ bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.begin();
for (; it != cmd_softbuttonid_.end(); ++it) {
- if((it->second).find(softbutton_id) != (it->second).end()) {
+ if ((it->second).find(softbutton_id) != (it->second).end()) {
return true;
}
}
@@ -887,7 +929,7 @@ bool ApplicationImpl::IsSubscribedToSoftButton(const uint32_t softbutton_id) {
void ApplicationImpl::UnsubscribeFromSoftButtons(int32_t cmd_id) {
sync_primitives::AutoLock lock(cmd_softbuttonid_lock_);
CommandSoftButtonID::iterator it = cmd_softbuttonid_.find(cmd_id);
- if(it != cmd_softbuttonid_.end()) {
+ if (it != cmd_softbuttonid_.end()) {
cmd_softbuttonid_.erase(it);
}
}
diff --git a/src/components/application_manager/src/application_manager_impl.cc b/src/components/application_manager/src/application_manager_impl.cc
index d5f9f49e71..66e462a96d 100644
--- a/src/components/application_manager/src/application_manager_impl.cc
+++ b/src/components/application_manager/src/application_manager_impl.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -48,12 +48,14 @@
#include "hmi_message_handler/hmi_message_handler.h"
#include "connection_handler/connection_handler_impl.h"
#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.hpp"
-#include "formatters/CFormatterJsonSDLRPCv1.hpp"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/CFormatterJsonSDLRPCv1.h"
#include "config_profile/profile.h"
#include "utils/threads/thread.h"
#include "utils/file_system.h"
#include "utils/helpers.h"
+#include "utils/make_shared.h"
+#include "utils/timer_task_impl.h"
#include "smart_objects/enum_schema_item.h"
#include "interfaces/HMI_API_schema.h"
#include "application_manager/application_impl.h"
@@ -61,14 +63,24 @@
#include <time.h>
namespace {
- int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) {
- return std::rand() % to + from;
- }
+int get_rand_from_range(uint32_t from = 0, int to = RAND_MAX) {
+ return std::rand() % to + from;
+}
}
namespace application_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+namespace {
+DeviceTypes devicesType = {
+ std::make_pair(std::string("USB_AOA"),
+ hmi_apis::Common_TransportType::USB_AOA),
+ std::make_pair(std::string("USB_IOS"),
+ hmi_apis::Common_TransportType::USB_IOS),
+ std::make_pair(std::string("BLUETOOTH"),
+ hmi_apis::Common_TransportType::BLUETOOTH),
+ std::make_pair(std::string("WIFI"), hmi_apis::Common_TransportType::WIFI)};
+}
+
uint32_t ApplicationManagerImpl::corelation_id_ = 0;
const uint32_t ApplicationManagerImpl::max_corelation_id_ = UINT_MAX;
@@ -79,76 +91,88 @@ namespace jhs = NsSmartDeviceLink::NsJSONHandler::strings;
using namespace NsSmartDeviceLink::NsSmartObjects;
ApplicationManagerImpl::ApplicationManagerImpl()
- : applications_list_lock_(true),
- audio_pass_thru_active_(false),
- is_distracting_driver_(false),
- is_vr_session_strated_(false),
- hmi_cooperating_(false),
- is_all_apps_allowed_(true),
- media_manager_(NULL),
- hmi_handler_(NULL),
- connection_handler_(NULL),
- protocol_handler_(NULL),
- request_ctrl_(),
- hmi_so_factory_(NULL),
- mobile_so_factory_(NULL),
- messages_from_mobile_("AM FromMobile", this),
- messages_to_mobile_("AM ToMobile", this),
- messages_from_hmi_("AM FromHMI", this),
- messages_to_hmi_("AM ToHMI", this),
- audio_pass_thru_messages_("AudioPassThru", this),
- hmi_capabilities_(this),
- unregister_reason_(mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM),
- resume_ctrl_(this),
- navi_close_app_timeout_(profile::Profile::instance()->stop_streaming_timeout()),
- navi_end_stream_timeout_(profile::Profile::instance()->stop_streaming_timeout()),
- stopping_flag_lock_(true),
-#ifdef TIME_TESTER
- metric_observer_(NULL),
-#endif // TIME_TESTER
- application_list_update_timer_(new ApplicationListUpdateTimer(this)),
- tts_global_properties_timer_("TTSGLPRTimer",
- this,
- &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties,
- true),
- is_low_voltage_(false),
- is_stopping_(false) {
-
- std::srand(std::time(0));
- AddPolicyObserver(this);
-
- dir_type_to_string_map_ = {
- {TYPE_STORAGE, "Storage"},
- {TYPE_SYSTEM, "System"},
- {TYPE_ICONS, "Icons"}
- };
+ : applications_list_lock_(true)
+ , audio_pass_thru_active_(false)
+ , is_distracting_driver_(false)
+ , is_vr_session_strated_(false)
+ , hmi_cooperating_(false)
+ , is_all_apps_allowed_(true)
+ , media_manager_(NULL)
+ , hmi_handler_(NULL)
+ , connection_handler_(NULL)
+ , protocol_handler_(NULL)
+ , request_ctrl_()
+ , hmi_so_factory_(NULL)
+ , mobile_so_factory_(NULL)
+ , messages_from_mobile_("AM FromMobile", this)
+ , messages_to_mobile_("AM ToMobile", this)
+ , messages_from_hmi_("AM FromHMI", this)
+ , messages_to_hmi_("AM ToHMI", this)
+ , audio_pass_thru_messages_("AudioPassThru", this)
+ , hmi_capabilities_(this)
+ , unregister_reason_(
+ mobile_api::AppInterfaceUnregisteredReason::INVALID_ENUM)
+ , navi_close_app_timeout_(
+ profile::Profile::instance()->stop_streaming_timeout())
+ , navi_end_stream_timeout_(
+ profile::Profile::instance()->stop_streaming_timeout())
+ , stopping_flag_lock_(true)
+ , state_ctrl_(this)
+ ,
+#ifdef TELEMETRY_MONITOR
+ metric_observer_(NULL)
+ ,
+#endif // TELEMETRY_MONITOR
+ application_list_update_timer_(
+ "AM ListUpdater",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this,
+ &ApplicationManagerImpl::OnApplicationListUpdateTimer))
+ , tts_global_properties_timer_(
+ "AM TTSGLPRTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this,
+ &ApplicationManagerImpl::OnTimerSendTTSGlobalProperties))
+ , is_low_voltage_(false)
+ , is_stopping_(false) {
+
+ std::srand(std::time(0));
+ AddPolicyObserver(this);
+
+ dir_type_to_string_map_ = {{TYPE_STORAGE, "Storage"},
+ {TYPE_SYSTEM, "System"},
+ {TYPE_ICONS, "Icons"}};
- sync_primitives::AutoLock lock(timer_pool_lock_);
- ApplicationManagerTimerPtr clearTimerPoolTimer(new TimerThread<ApplicationManagerImpl>(
- "ClearTimerPoolTimer", this, &ApplicationManagerImpl::ClearTimerPool, true));
- clearTimerPoolTimer->start(10);
- timer_pool_.push_back(clearTimerPoolTimer);
+ sync_primitives::AutoLock lock(timer_pool_lock_);
+ TimerSPtr clearing_timer(utils::MakeShared<timer::Timer>(
+ "ClearTimerPoolTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this,
+ &ApplicationManagerImpl::ClearTimerPool)));
+ const uint32_t timeout_ms = 10000u;
+ clearing_timer->Start(timeout_ms, true);
+ timer_pool_.push_back(clearing_timer);
}
ApplicationManagerImpl::~ApplicationManagerImpl() {
- LOG4CXX_INFO(logger_, "Destructing ApplicationManager.");
+ LOG4CXX_AUTO_TRACE(logger_);
is_stopping_ = true;
SendOnSDLClose();
media_manager_ = NULL;
hmi_handler_ = NULL;
connection_handler_ = NULL;
- if(hmi_so_factory_) {
+ if (hmi_so_factory_) {
delete hmi_so_factory_;
hmi_so_factory_ = NULL;
}
- if(mobile_so_factory_) {
+ if (mobile_so_factory_) {
delete mobile_so_factory_;
mobile_so_factory_ = NULL;
}
protocol_handler_ = NULL;
media_manager_ = NULL;
- LOG4CXX_INFO(logger_, "Destroying Policy Handler");
+ LOG4CXX_DEBUG(logger_, "Destroying Policy Handler");
RemovePolicyObserver(this);
policy::PolicyHandler::destroy();
@@ -159,12 +183,17 @@ ApplicationManagerImpl::~ApplicationManagerImpl() {
navi_app_to_end_stream_.clear();
}
+DataAccessor<ApplicationSet> ApplicationManagerImpl::applications() const {
+ ApplicationListAccessor accessor;
+ return accessor;
+}
+
bool ApplicationManagerImpl::Stop() {
- LOG4CXX_INFO(logger_, "Stop ApplicationManager.");
+ LOG4CXX_AUTO_TRACE(logger_);
stopping_flag_lock_.Acquire();
is_stopping_ = true;
stopping_flag_lock_.Release();
- application_list_update_timer_->stop();
+ application_list_update_timer_.Stop();
try {
UnregisterAllApplications();
} catch (...) {
@@ -173,15 +202,15 @@ bool ApplicationManagerImpl::Stop() {
}
request_ctrl_.DestroyThreadpool();
-
// for PASA customer policy backup should happen :AllApp(SUSPEND)
- LOG4CXX_INFO(logger_, "Unloading policy library.");
+ LOG4CXX_DEBUG(logger_, "Unloading policy library.");
policy::PolicyHandler::instance()->UnloadPolicyLibrary();
return true;
}
-ApplicationSharedPtr ApplicationManagerImpl::application(uint32_t app_id) const {
+ApplicationSharedPtr ApplicationManagerImpl::application(
+ uint32_t app_id) const {
AppIdPredicate finder(app_id);
ApplicationListAccessor accessor;
ApplicationSharedPtr app = accessor.Find(finder);
@@ -190,7 +219,7 @@ ApplicationSharedPtr ApplicationManagerImpl::application(uint32_t app_id) const
}
ApplicationSharedPtr ApplicationManagerImpl::application_by_hmi_app(
- uint32_t hmi_app_id) const {
+ uint32_t hmi_app_id) const {
HmiAppIdPredicate finder(hmi_app_id);
ApplicationListAccessor accessor;
ApplicationSharedPtr app = accessor.Find(finder);
@@ -198,16 +227,22 @@ ApplicationSharedPtr ApplicationManagerImpl::application_by_hmi_app(
return app;
}
+connection_handler::ConnectionHandler&
+ApplicationManagerImpl::connection_handler() const {
+ return *connection_handler_;
+}
+
ApplicationSharedPtr ApplicationManagerImpl::application_by_policy_id(
- const std::string& policy_app_id) const {
+ const std::string& policy_app_id) const {
MobileAppIdPredicate finder(policy_app_id);
ApplicationListAccessor accessor;
ApplicationSharedPtr app = accessor.Find(finder);
- LOG4CXX_DEBUG(logger_, " policy_app_id << " << policy_app_id << "Found = " << app);
+ LOG4CXX_DEBUG(logger_,
+ " policy_app_id << " << policy_app_id << "Found = " << app);
return app;
}
-bool ActiveAppPredicate (const ApplicationSharedPtr app) {
+bool ActiveAppPredicate(const ApplicationSharedPtr app) {
return app ? app->IsFullscreen() : false;
}
@@ -219,61 +254,61 @@ ApplicationSharedPtr ApplicationManagerImpl::active_application() const {
return app;
}
-bool LimitedAppPredicate (const ApplicationSharedPtr app) {
- return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED :
- false;
+bool LimitedAppPredicate(const ApplicationSharedPtr app) {
+ return app ? app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED : false;
}
-ApplicationSharedPtr
-ApplicationManagerImpl::get_limited_media_application() const {
+ApplicationSharedPtr ApplicationManagerImpl::get_limited_media_application()
+ const {
ApplicationListAccessor accessor;
ApplicationSharedPtr app = accessor.Find(LimitedAppPredicate);
LOG4CXX_DEBUG(logger_, " Found = " << app);
return app;
}
-bool LimitedNaviAppPredicate (const ApplicationSharedPtr app) {
+bool LimitedNaviAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_navi() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) :
- false;
+ app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ : false;
}
-ApplicationSharedPtr
-ApplicationManagerImpl::get_limited_navi_application() const {
+ApplicationSharedPtr ApplicationManagerImpl::get_limited_navi_application()
+ const {
ApplicationListAccessor accessor;
ApplicationSharedPtr app = accessor.Find(LimitedNaviAppPredicate);
LOG4CXX_DEBUG(logger_, " Found = " << app);
return app;
}
-bool LimitedVoiceAppPredicate (const ApplicationSharedPtr app) {
+bool LimitedVoiceAppPredicate(const ApplicationSharedPtr app) {
return app ? (app->is_voice_communication_supported() &&
- app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED) :
- false;
+ app->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)
+ : false;
}
-ApplicationSharedPtr
-ApplicationManagerImpl::get_limited_voice_application() const {
+ApplicationSharedPtr ApplicationManagerImpl::get_limited_voice_application()
+ const {
ApplicationListAccessor accessor;
ApplicationSharedPtr app = accessor.Find(LimitedVoiceAppPredicate);
LOG4CXX_DEBUG(logger_, " Found = " << app);
return app;
}
-bool NaviAppPredicate (const ApplicationSharedPtr app) {
+bool NaviAppPredicate(const ApplicationSharedPtr app) {
return app ? app->is_navi() : false;
}
-std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_with_navi() {
+std::vector<ApplicationSharedPtr>
+ApplicationManagerImpl::applications_with_navi() {
ApplicationListAccessor accessor;
std::vector<ApplicationSharedPtr> apps = accessor.FindAll(NaviAppPredicate);
LOG4CXX_DEBUG(logger_, " Found count: " << apps.size());
return apps;
}
-std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button(
- uint32_t button) {
+std::vector<ApplicationSharedPtr>
+ApplicationManagerImpl::applications_by_button(uint32_t button) {
SubscribedToButtonPredicate finder(
- static_cast<mobile_apis::ButtonName::eType>(button));
+ static_cast<mobile_apis::ButtonName::eType>(button));
ApplicationListAccessor accessor;
std::vector<ApplicationSharedPtr> apps = accessor.FindAll(finder);
LOG4CXX_DEBUG(logger_, " Found count: " << apps.size());
@@ -281,8 +316,7 @@ std::vector<ApplicationSharedPtr> ApplicationManagerImpl::applications_by_button
}
std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated(
- VehicleDataType vehicle_info, int value) {
-
+ VehicleDataType vehicle_info, int value) {
// Notify Policy Manager if available about info it's interested in,
// i.e. odometer etc
switch (vehicle_info) {
@@ -293,16 +327,37 @@ std::vector<ApplicationSharedPtr> ApplicationManagerImpl::IviInfoUpdated(
break;
}
- SubscribedToIVIPredicate finder(
- static_cast<int32_t>(vehicle_info));
+ SubscribedToIVIPredicate finder(static_cast<int32_t>(vehicle_info));
ApplicationListAccessor accessor;
std::vector<ApplicationSharedPtr> apps = accessor.FindAll(finder);
LOG4CXX_DEBUG(logger_, " vehicle_info << " << vehicle_info << "Found count: " << apps.size());
return apps;
}
+void ApplicationManagerImpl::OnApplicationRegistered(ApplicationSharedPtr app) {
+ DCHECK_OR_RETURN_VOID(app);
+ sync_primitives::AutoLock lock(applications_list_lock_);
+ const mobile_apis::HMILevel::eType default_level = GetDefaultHmiLevel(app);
+ state_ctrl_.OnApplicationRegistered(app, default_level);
+
+ // TODO(AOleynik): Is neccessary to be able to know that registration process
+ // has been completed and default HMI level is set, otherwise policy will
+ // block all the requests/notifications to mobile
+ // APPLINK-20764 - introduce usage of internal events or re-implement
+ event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
+
+ smart_objects::SmartObject msg;
+ msg[strings::params][strings::message_type] =
+ hmi_apis::messageType::notification;
+ msg[strings::params][strings::app_id] = app->app_id();
+
+ event.set_smart_object(msg);
+ event.raise();
+}
+
bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
- ApplicationSharedPtr app) const {
+ ApplicationConstSharedPtr app) const {
bool voice_state = app->is_voice_communication_supported();
bool media_state = app->is_media_application();
bool navi_state = app->is_navi();
@@ -310,7 +365,8 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
// Check app in FULL level
if (active_app.valid()) {
// If checking app hmi level FULL, we return false
- // because we couldn't have two applications with same HMIType in FULL and LIMITED HMI level
+ // because we couldn't have two applications with same HMIType in FULL and
+ // LIMITED HMI level
if (active_app->app_id() == app->app_id()) {
return false;
}
@@ -349,115 +405,127 @@ bool ApplicationManagerImpl::IsAppTypeExistsInFullOrLimited(
return true;
}
}
-
return false;
}
-
ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
- const utils::SharedPtr<smart_objects::SmartObject>&
- request_for_registration) {
-
- LOG4CXX_DEBUG(logger_, "Restarting application list update timer");
- policy::PolicyHandler::instance()->OnAppsSearchStarted();
- uint32_t timeout = profile::Profile::instance()->application_list_update_timeout();
- application_list_update_timer_->start(timeout);
+ const utils::SharedPtr<smart_objects::SmartObject>&
+ request_for_registration) {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& message = *request_for_registration;
uint32_t connection_key =
- message[strings::params][strings::connection_key].asInt();
-
- if (false == is_all_apps_allowed_) {
- LOG4CXX_INFO(logger_,
- "RegisterApplication: access to app's disabled by user");
- utils::SharedPtr<smart_objects::SmartObject> response(
- MessageHelper::CreateNegativeResponse(
- connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
- message[strings::params][strings::correlation_id].asUInt(),
- mobile_apis::Result::DISALLOWED));
- ManageMobileCommand(response);
- return ApplicationSharedPtr();
- }
+ message[strings::params][strings::connection_key].asInt();
// app_id is SDL "internal" ID
- // original app_id can be gotten via ApplicationImpl::mobile_app_id()
+ // original app_id can be gotten via ApplicationImpl::policy_app_id()
uint32_t app_id = 0;
std::list<int32_t> sessions_list;
uint32_t device_id = 0;
- if (connection_handler_) {
- connection_handler::ConnectionHandlerImpl* con_handler_impl =
- static_cast<connection_handler::ConnectionHandlerImpl*>(
- connection_handler_);
-
- if (con_handler_impl->GetDataOnSessionKey(connection_key, &app_id,
- &sessions_list, &device_id)
- == -1) {
- LOG4CXX_ERROR(logger_,
- "Failed to create application: no connection info.");
- utils::SharedPtr<smart_objects::SmartObject> response(
+ DCHECK_OR_RETURN(connection_handler_, ApplicationSharedPtr());
+ if (connection_handler().GetDataOnSessionKey(
+ connection_key, &app_id, &sessions_list, &device_id) == -1) {
+ LOG4CXX_ERROR(logger_, "Failed to create application: no connection info.");
+ utils::SharedPtr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
- connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
- message[strings::params][strings::correlation_id].asUInt(),
- mobile_apis::Result::GENERIC_ERROR));
- ManageMobileCommand(response);
- return ApplicationSharedPtr();
- }
+ connection_key,
+ mobile_apis::FunctionID::RegisterAppInterfaceID,
+ message[strings::params][strings::correlation_id].asUInt(),
+ mobile_apis::Result::GENERIC_ERROR));
+ ManageMobileCommand(response);
+ return ApplicationSharedPtr();
}
- smart_objects::SmartObject& params = message[strings::msg_params];
-
- const std::string& mobile_app_id = params[strings::app_id].asString();
- const std::string& app_name =
- message[strings::msg_params][strings::app_name].asString();
+ LOG4CXX_DEBUG(logger_, "Restarting application list update timer");
+ policy::PolicyHandler::instance()->OnAppsSearchStarted();
+ uint32_t timeout =
+ profile::Profile::instance()->application_list_update_timeout();
+ application_list_update_timer_.Start(timeout, false);
- LOG4CXX_DEBUG(logger_, "App with connection key: " << connection_key
- << " registered from handle: " << device_id);
+ if (!is_all_apps_allowed_) {
+ LOG4CXX_WARN(logger_,
+ "RegisterApplication: access to app's disabled by user");
+ utils::SharedPtr<smart_objects::SmartObject> response(
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ mobile_apis::FunctionID::RegisterAppInterfaceID,
+ message[strings::params][strings::correlation_id].asUInt(),
+ mobile_apis::Result::DISALLOWED));
+ ManageMobileCommand(response);
+ return ApplicationSharedPtr();
+ }
- ApplicationSharedPtr application(
- new ApplicationImpl(app_id,
- mobile_app_id, app_name,
- policy::PolicyHandler::instance()->GetStatisticManager()));
+ smart_objects::SmartObject& params = message[strings::msg_params];
+ const std::string& policy_app_id = params[strings::app_id].asString();
+ const custom_str::CustomString& app_name =
+ message[strings::msg_params][strings::app_name].asCustomString();
+
+ std::string device_mac = "";
+ if (connection_handler().get_session_observer().GetDataOnDeviceID(
+ device_id, NULL, NULL, &device_mac, NULL) == -1) {
+ LOG4CXX_ERROR(logger_, "Failed to extract device mac for id " << device_id);
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "Device mac for id" << device_id << " is " << device_mac);
+ }
+ LOG4CXX_DEBUG(logger_,
+ "App with connection key: " << connection_key
+ << " registered from handle: "
+ << device_id);
+ ApplicationSharedPtr application(new ApplicationImpl(
+ app_id,
+ policy_app_id,
+ device_mac,
+ app_name,
+ policy::PolicyHandler::instance()->GetStatisticManager()));
if (!application) {
usage_statistics::AppCounter count_of_rejections_sync_out_of_memory(
- policy::PolicyHandler::instance()->GetStatisticManager(), mobile_app_id,
- usage_statistics::REJECTIONS_SYNC_OUT_OF_MEMORY);
+ policy::PolicyHandler::instance()->GetStatisticManager(),
+ policy_app_id,
+ usage_statistics::REJECTIONS_SYNC_OUT_OF_MEMORY);
++count_of_rejections_sync_out_of_memory;
utils::SharedPtr<smart_objects::SmartObject> response(
- MessageHelper::CreateNegativeResponse(
- connection_key, mobile_apis::FunctionID::RegisterAppInterfaceID,
- message[strings::params][strings::correlation_id].asUInt(),
- mobile_apis::Result::OUT_OF_MEMORY));
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ mobile_apis::FunctionID::RegisterAppInterfaceID,
+ message[strings::params][strings::correlation_id].asUInt(),
+ mobile_apis::Result::OUT_OF_MEMORY));
ManageMobileCommand(response);
return ApplicationSharedPtr();
}
+ application->set_folder_name(policy_app_id + "_" + device_mac);
+ // To load persistent files, app folder name must be known first, which is now
+ // depends on device_id and mobile_app_id
+ application->LoadPersistentFiles();
application->set_device(device_id);
+
application->set_grammar_id(GenerateGrammarID());
mobile_api::Language::eType launguage_desired =
- static_cast<mobile_api::Language::eType>(params[strings::language_desired]
- .asInt());
+ static_cast<mobile_api::Language::eType>(
+ params[strings::language_desired].asInt());
application->set_language(launguage_desired);
application->usage_report().RecordAppRegistrationVuiLanguage(
- launguage_desired);
+ launguage_desired);
mobile_api::Language::eType hmi_display_language_desired =
- static_cast<mobile_api::Language::eType>(params[strings::hmi_display_language_desired]
- .asInt());
+ static_cast<mobile_api::Language::eType>(
+ params[strings::hmi_display_language_desired].asInt());
application->set_ui_language(hmi_display_language_desired);
application->usage_report().RecordAppRegistrationGuiLanguage(
- hmi_display_language_desired);
+ hmi_display_language_desired);
Version version;
- int32_t min_version =
- message[strings::msg_params][strings::sync_msg_version]
- [strings::minor_version].asInt();
+ int32_t min_version = message[strings::msg_params][strings::sync_msg_version]
+ [strings::minor_version]
+ .asInt();
version.min_supported_api_version = static_cast<APIVersion>(min_version);
- int32_t max_version =
- message[strings::msg_params][strings::sync_msg_version]
- [strings::major_version].asInt();
+ int32_t max_version = message[strings::msg_params][strings::sync_msg_version]
+ [strings::major_version]
+ .asInt();
version.max_supported_api_version = static_cast<APIVersion>(max_version);
application->set_version(version);
@@ -465,15 +533,13 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
message[strings::params][strings::protocol_version].asInt());
application->set_protocol_version(protocol_version);
- if (connection_handler_) {
- if (ProtocolVersion::kUnknownProtocol != protocol_version) {
- connection_handler_->BindProtocolVersionWithSession(
- connection_key, static_cast<uint8_t>(protocol_version));
- }
- if (protocol_version >= ProtocolVersion::kV3 &&
- profile::Profile::instance()->heart_beat_timeout() > 0) {
- connection_handler_->StartSessionHeartBeat(connection_key);
- }
+ if (ProtocolVersion::kUnknownProtocol != protocol_version) {
+ connection_handler().BindProtocolVersionWithSession(
+ connection_key, static_cast<uint8_t>(protocol_version));
+ }
+ if (protocol_version >= ProtocolVersion::kV3 &&
+ profile::Profile::instance()->heart_beat_timeout() > 0) {
+ connection_handler().StartSessionHeartBeat(connection_key);
}
// Keep HMI add id in case app is present in "waiting for registration" list
@@ -486,18 +552,28 @@ ApplicationSharedPtr ApplicationManagerImpl::RegisterApplication(
apps_to_register_list_lock_.Release();
if (!application->hmi_app_id()) {
- const bool is_saved = resume_ctrl_.IsApplicationSaved(mobile_app_id);
- application->set_hmi_application_id(is_saved ?
- resume_ctrl_.GetHMIApplicationID(mobile_app_id) : GenerateNewHMIAppID());
- }
-
- ApplicationListAccessor app_list_accesor;
+ const bool is_saved =
+ resume_ctrl_.IsApplicationSaved(policy_app_id, device_mac);
+ application->set_hmi_application_id(
+ is_saved ? resume_ctrl_.GetHMIApplicationID(policy_app_id, device_mac)
+ : GenerateNewHMIAppID());
+ }
+
+ // Stops timer of saving data to resumption in order to
+ // doesn't erase data from resumption storage.
+ // Timer will be started after hmi level resumption.
+ resume_ctrl_.OnAppRegistrationStart(policy_app_id, device_mac);
+
+ // Add application to registered app list and set appropriate mark.
+ // Lock has to be released before adding app to policy DB to avoid possible
+ // deadlock with simultaneous PTU processing
+ applications_list_lock_.Acquire();
application->MarkRegistered();
- state_ctrl_.ApplyStatesForApp(application);
- app_list_accesor.Insert(application);
+ applications_.insert(application);
+ applications_list_lock_.Release();
policy::PolicyHandler::instance()->AddApplication(
- application->mobile_app_id());
+ application->mobile_app_id());
return application;
}
@@ -515,18 +591,18 @@ bool ApplicationManagerImpl::ActivateApplication(ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN(app, false);
-
+ // remove from resumption if app was activated by user
+ resume_controller().OnAppActivated(app);
HMILevel::eType hmi_level = HMILevel::HMI_FULL;
AudioStreamingState::eType audio_state;
- app->IsAudioApplication() ? audio_state = AudioStreamingState::AUDIBLE :
- audio_state = AudioStreamingState::NOT_AUDIBLE;
- state_ctrl_.ApplyStatesForApp(app);
+ app->IsAudioApplication() ? audio_state = AudioStreamingState::AUDIBLE
+ : audio_state = AudioStreamingState::NOT_AUDIBLE;
state_ctrl_.SetRegularState<false>(app, hmi_level, audio_state);
return true;
}
mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
- ApplicationSharedPtr app) {
+ ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
if (!app) {
LOG4CXX_ERROR(logger_, "Application pointer invalid");
@@ -546,10 +622,14 @@ mobile_api::HMILevel::eType ApplicationManagerImpl::IsHmiLevelFullAllowed(
} else if (is_active_app_exist && (!is_audio_app)) {
result = GetDefaultHmiLevel(app);
}
- LOG4CXX_ERROR(logger_, "is_audio_app : " << is_audio_app
- << "; does_audio_app_with_same_type_exist : " << does_audio_app_with_same_type_exist
- << "; is_active_app_exist : " << is_active_app_exist
- << "; result : " << result);
+ LOG4CXX_ERROR(logger_,
+ "is_audio_app : " << is_audio_app
+ << "; does_audio_app_with_same_type_exist : "
+ << does_audio_app_with_same_type_exist
+ << "; is_active_app_exist : "
+ << is_active_app_exist
+ << "; result : "
+ << result);
return result;
}
@@ -561,18 +641,18 @@ void ApplicationManagerImpl::ConnectToDevice(const std::string& device_mac) {
}
connection_handler::DeviceHandle handle;
- if (!connection_handler_->GetDeviceID(device_mac, &handle) ) {
- LOG4CXX_ERROR(logger_, "Attempt to connect to invalid device with mac:"
- << device_mac );
+ if (!connection_handler().GetDeviceID(device_mac, &handle)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Attempt to connect to invalid device with mac:" << device_mac);
return;
}
- connection_handler_->ConnectToDevice(handle);
+ connection_handler().ConnectToDevice(handle);
}
void ApplicationManagerImpl::OnHMIStartedCooperation() {
+ LOG4CXX_AUTO_TRACE(logger_);
hmi_cooperating_ = true;
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::OnHMIStartedCooperation()");
-
MessageHelper::SendGetSystemInfoRequest();
utils::SharedPtr<smart_objects::SmartObject> is_vr_ready(
@@ -652,36 +732,47 @@ void ApplicationManagerImpl::set_all_apps_allowed(const bool& allowed) {
is_all_apps_allowed_ = allowed;
}
-HmiStatePtr ApplicationManagerImpl::CreateRegularState(uint32_t app_id,
- mobile_apis::HMILevel::eType hmi_level,
- mobile_apis::AudioStreamingState::eType audio_state,
- mobile_apis::SystemContext::eType system_context) const{
- HmiStatePtr state(new HmiState(app_id, state_ctrl_.state_context()));
+HmiStatePtr ApplicationManagerImpl::CreateRegularState(
+ uint32_t app_id,
+ mobile_apis::HMILevel::eType hmi_level,
+ mobile_apis::AudioStreamingState::eType audio_state,
+ mobile_apis::SystemContext::eType system_context) const {
+ HmiStatePtr state(new HmiState(app_id, ApplicationManagerImpl::instance()));
state->set_hmi_level(hmi_level);
state->set_audio_streaming_state(audio_state);
state->set_system_context(system_context);
return state;
}
+bool ApplicationManagerImpl::IsStateActive(HmiState::StateID state_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Checking for active state id " << state_id);
+ return state_ctrl_.IsStateActive(state_id);
+}
+
void ApplicationManagerImpl::StartAudioPassThruThread(int32_t session_key,
- int32_t correlation_id, int32_t max_duration, int32_t sampling_rate,
- int32_t bits_per_sample, int32_t audio_type) {
+ int32_t correlation_id,
+ int32_t max_duration,
+ int32_t sampling_rate,
+ int32_t bits_per_sample,
+ int32_t audio_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_INFO(logger_, "START MICROPHONE RECORDER");
if (NULL != media_manager_) {
media_manager_->StartMicrophoneRecording(
- session_key,
- profile::Profile::instance()->recording_file_name(),
- max_duration);
+ session_key,
+ profile::Profile::instance()->recording_file_name(),
+ max_duration);
}
}
void ApplicationManagerImpl::SendAudioPassThroughNotification(
- uint32_t session_key,
- std::vector<uint8_t>& binary_data) {
+ uint32_t session_key, std::vector<uint8_t>& binary_data) {
LOG4CXX_AUTO_TRACE(logger_);
if (!audio_pass_thru_active_) {
- LOG4CXX_ERROR(logger_, "Trying to send PassThroughNotification"
+ LOG4CXX_ERROR(logger_,
+ "Trying to send PassThroughNotification"
" when PassThrough is not active");
return;
}
@@ -701,34 +792,28 @@ void ApplicationManagerImpl::StopAudioPassThru(int32_t application_key) {
}
std::string ApplicationManagerImpl::GetDeviceName(
- connection_handler::DeviceHandle handle) {
- DCHECK(connection_handler_ != 0);
-
+ connection_handler::DeviceHandle handle) {
+ DCHECK(connection_handler_);
std::string device_name = "";
- connection_handler::ConnectionHandlerImpl* con_handler_impl =
- static_cast<connection_handler::ConnectionHandlerImpl*>(
- connection_handler_);
- if (con_handler_impl->GetDataOnDeviceID(handle, &device_name,
- NULL) == -1) {
+ if (connection_handler().get_session_observer().GetDataOnDeviceID(
+ handle, &device_name, NULL, NULL, NULL) == -1) {
LOG4CXX_ERROR(logger_, "Failed to extract device name for id " << handle);
} else {
- LOG4CXX_INFO(logger_, "\t\t\t\t\tDevice name is " << device_name);
+ LOG4CXX_DEBUG(logger_, "\t\t\t\t\tDevice name is " << device_name);
}
return device_name;
}
-hmi_apis::Common_TransportType::eType ApplicationManagerImpl::GetDeviceTransportType(
+hmi_apis::Common_TransportType::eType
+ApplicationManagerImpl::GetDeviceTransportType(
const std::string& transport_type) {
hmi_apis::Common_TransportType::eType result =
hmi_apis::Common_TransportType::INVALID_ENUM;
- if ("BLUETOOTH" == transport_type) {
- result = hmi_apis::Common_TransportType::BLUETOOTH;
- } else if ("WIFI" == transport_type) {
- result = hmi_apis::Common_TransportType::WIFI;
- } else if ("USB" == transport_type) {
- result = hmi_apis::Common_TransportType::USB;
+ DeviceTypes::const_iterator it = devicesType.find(transport_type);
+ if (it != devicesType.end()) {
+ return devicesType[transport_type];
} else {
LOG4CXX_ERROR(logger_, "Unknown transport type " << transport_type);
}
@@ -737,7 +822,7 @@ hmi_apis::Common_TransportType::eType ApplicationManagerImpl::GetDeviceTransport
}
void ApplicationManagerImpl::OnMessageReceived(
- const ::protocol_handler::RawMessagePtr message) {
+ const ::protocol_handler::RawMessagePtr message) {
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
@@ -750,17 +835,17 @@ void ApplicationManagerImpl::OnMessageReceived(
if (outgoing_message) {
messages_from_mobile_.PostMessage(
- impl::MessageFromMobile(outgoing_message));
+ impl::MessageFromMobile(outgoing_message));
}
}
void ApplicationManagerImpl::OnMobileMessageSent(
- const ::protocol_handler::RawMessagePtr message) {
+ const ::protocol_handler::RawMessagePtr message) {
LOG4CXX_AUTO_TRACE(logger_);
}
void ApplicationManagerImpl::OnMessageReceived(
- hmi_message_handler::MessageSharedPointer message) {
+ hmi_message_handler::MessageSharedPointer message) {
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
@@ -772,7 +857,6 @@ void ApplicationManagerImpl::OnMessageReceived(
messages_from_hmi_.PostMessage(impl::MessageFromHmi(message));
}
-
ApplicationConstSharedPtr ApplicationManagerImpl::waiting_app(
const uint32_t hmi_id) const {
AppsWaitRegistrationSet app_list = apps_waiting_for_registration().GetData();
@@ -781,7 +865,7 @@ ApplicationConstSharedPtr ApplicationManagerImpl::waiting_app(
HmiAppIdPredicate finder(hmi_id);
ApplicationSharedPtr result;
- ApplictionSetConstIt it_app = std::find_if(app_list.begin(), it_end, finder);
+ ApplicationSetConstIt it_app = std::find_if(app_list.begin(), it_end, finder);
if (it_app != it_end) {
result = *it_app;
}
@@ -791,8 +875,8 @@ ApplicationConstSharedPtr ApplicationManagerImpl::waiting_app(
DataAccessor<ApplicationManagerImpl::AppsWaitRegistrationSet>
ApplicationManagerImpl::apps_waiting_for_registration() const {
return DataAccessor<AppsWaitRegistrationSet>(
- ApplicationManagerImpl::instance()->apps_to_register_,
- ApplicationManagerImpl::instance()->apps_to_register_list_lock_);
+ ApplicationManagerImpl::instance()->apps_to_register_,
+ ApplicationManagerImpl::instance()->apps_to_register_list_lock_);
}
bool ApplicationManagerImpl::IsAppsQueriedFrom(
@@ -809,8 +893,7 @@ bool ApplicationManagerImpl::IsAppsQueriedFrom(
}
void application_manager::ApplicationManagerImpl::MarkAppsGreyOut(
- const connection_handler::DeviceHandle handle,
- bool is_greyed_out) {
+ const connection_handler::DeviceHandle handle, bool is_greyed_out) {
sync_primitives::AutoLock lock(apps_to_register_list_lock_);
AppsWaitRegistrationSet::iterator it = apps_to_register_.begin();
AppsWaitRegistrationSet::const_iterator it_end = apps_to_register_.end();
@@ -820,18 +903,35 @@ void application_manager::ApplicationManagerImpl::MarkAppsGreyOut(
}
}
}
-
-
void ApplicationManagerImpl::OnErrorSending(
- hmi_message_handler::MessageSharedPointer message) {
+ hmi_message_handler::MessageSharedPointer message) {
return;
}
void ApplicationManagerImpl::OnDeviceListUpdated(
const connection_handler::DeviceMap& device_list) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr msg_params = MessageHelper::CreateDeviceListSO(
- device_list);
+
+ // add device to policy DB
+ connection_handler::DeviceMap::const_iterator it = device_list.begin();
+ for (; device_list.end() != it; ++it) {
+ policy::DeviceParams dev_params;
+ connection_handler().get_session_observer().GetDataOnDeviceID(
+ it->second.device_handle(),
+ &dev_params.device_name,
+ NULL,
+ &dev_params.device_mac_address,
+ &dev_params.device_connection_type);
+
+ policy::DeviceInfo device_info;
+ device_info.AdoptDeviceType(dev_params.device_connection_type);
+
+ policy::PolicyHandler::instance()->AddDevice(dev_params.device_mac_address,
+ device_info.connection_type);
+ }
+
+ smart_objects::SmartObjectSPtr msg_params =
+ MessageHelper::CreateDeviceListSO(device_list);
if (!msg_params) {
LOG4CXX_WARN(logger_, "Failed to create sub-smart object.");
return;
@@ -840,9 +940,9 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
smart_objects::SmartObjectSPtr update_list = new smart_objects::SmartObject;
smart_objects::SmartObject& so_to_send = *update_list;
so_to_send[jhs::S_PARAMS][jhs::S_FUNCTION_ID] =
- hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
+ hmi_apis::FunctionID::BasicCommunication_UpdateDeviceList;
so_to_send[jhs::S_PARAMS][jhs::S_MESSAGE_TYPE] =
- hmi_apis::messageType::request;
+ hmi_apis::messageType::request;
so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_VERSION] = 3;
so_to_send[jhs::S_PARAMS][jhs::S_PROTOCOL_TYPE] = 1;
so_to_send[jhs::S_PARAMS][jhs::S_CORRELATION_ID] = GetNextHMICorrelationID();
@@ -851,10 +951,11 @@ void ApplicationManagerImpl::OnDeviceListUpdated(
}
void ApplicationManagerImpl::OnFindNewApplicationsRequest() {
- connection_handler_->ConnectToAllDevices();
+ connection_handler().ConnectToAllDevices();
LOG4CXX_DEBUG(logger_, "Starting application list update timer");
- uint32_t timeout = profile::Profile::instance()->application_list_update_timeout();
- application_list_update_timer_->start(timeout);
+ uint32_t timeout =
+ profile::Profile::instance()->application_list_update_timeout();
+ application_list_update_timer_.Start(timeout, false);
policy::PolicyHandler::instance()->OnAppsSearchStarted();
}
@@ -865,11 +966,13 @@ void ApplicationManagerImpl::SendUpdateAppList() {
using namespace hmi_apis;
SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
- FunctionID::BasicCommunication_UpdateAppList);
+ FunctionID::BasicCommunication_UpdateAppList);
- (*request)[strings::msg_params][strings::applications] = SmartObject(SmartType_Array);
+ (*request)[strings::msg_params][strings::applications] =
+ SmartObject(SmartType_Array);
- SmartObject& applications = (*request)[strings::msg_params][strings::applications];
+ SmartObject& applications =
+ (*request)[strings::msg_params][strings::applications];
PrepareApplicationListSO(applications_, applications);
PrepareApplicationListSO(apps_to_register_, applications);
@@ -879,11 +982,11 @@ void ApplicationManagerImpl::SendUpdateAppList() {
void ApplicationManagerImpl::RemoveDevice(
const connection_handler::DeviceHandle& device_handle) {
- LOG4CXX_INFO(logger_, "device_handle " << device_handle);
+ LOG4CXX_DEBUG(logger_, "device_handle " << device_handle);
}
mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
- ApplicationSharedPtr application) const {
+ ApplicationConstSharedPtr application) const {
using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
HMILevel::eType default_hmi = HMILevel::HMI_NONE;
@@ -891,8 +994,8 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
if (policy::PolicyHandler::instance()->PolicyEnabled()) {
const std::string policy_app_id = application->mobile_app_id();
std::string default_hmi_string = "";
- if (policy::PolicyHandler::instance()->GetDefaultHmi(
- policy_app_id, &default_hmi_string)) {
+ if (policy::PolicyHandler::instance()->GetDefaultHmi(policy_app_id,
+ &default_hmi_string)) {
if ("BACKGROUND" == default_hmi_string) {
default_hmi = HMILevel::HMI_BACKGROUND;
} else if ("FULL" == default_hmi_string) {
@@ -902,11 +1005,13 @@ mobile_apis::HMILevel::eType ApplicationManagerImpl::GetDefaultHmiLevel(
} else if ("NONE" == default_hmi_string) {
default_hmi = HMILevel::HMI_NONE;
} else {
- LOG4CXX_ERROR(logger_, "Unable to convert " + default_hmi_string + " to HMILevel");
+ LOG4CXX_ERROR(
+ logger_,
+ "Unable to convert " + default_hmi_string + " to HMILevel");
}
} else {
- LOG4CXX_ERROR(logger_, "Unable to get default hmi_level for "
- << policy_app_id);
+ LOG4CXX_ERROR(logger_,
+ "Unable to get default hmi_level for " << policy_app_id);
}
}
return default_hmi;
@@ -937,10 +1042,13 @@ void ApplicationManagerImpl::ReplaceMobileByHMIAppId(
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(
- message[strings::app_id].asUInt());
+ message[strings::app_id].asUInt());
if (application.valid()) {
- LOG4CXX_INFO(logger_, "ReplaceMobileByHMIAppId from " << message[strings::app_id].asInt()
- << " to " << application->hmi_app_id());
+ LOG4CXX_DEBUG(logger_,
+ "ReplaceMobileByHMIAppId from "
+ << message[strings::app_id].asInt()
+ << " to "
+ << application->hmi_app_id());
message[strings::app_id] = application->hmi_app_id();
}
} else {
@@ -948,7 +1056,7 @@ void ApplicationManagerImpl::ReplaceMobileByHMIAppId(
case smart_objects::SmartType::SmartType_Array: {
smart_objects::SmartArray* message_array = message.asArray();
smart_objects::SmartArray::iterator it = message_array->begin();
- for(; it != message_array->end(); ++it) {
+ for (; it != message_array->end(); ++it) {
ReplaceMobileByHMIAppId(*it);
}
break;
@@ -962,23 +1070,24 @@ void ApplicationManagerImpl::ReplaceMobileByHMIAppId(
}
break;
}
- default: {
- break;
- }
+ default: { break; }
}
}
}
void ApplicationManagerImpl::ReplaceHMIByMobileAppId(
- smart_objects::SmartObject& message) {
+ smart_objects::SmartObject& message) {
if (message.keyExists(strings::app_id)) {
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application_by_hmi_app(
- message[strings::app_id].asUInt());
+ ApplicationManagerImpl::instance()->application_by_hmi_app(
+ message[strings::app_id].asUInt());
if (application.valid()) {
- LOG4CXX_INFO(logger_, "ReplaceHMIByMobileAppId from " << message[strings::app_id].asInt()
- << " to " << application->app_id());
+ LOG4CXX_DEBUG(logger_,
+ "ReplaceHMIByMobileAppId from "
+ << message[strings::app_id].asInt()
+ << " to "
+ << application->app_id());
message[strings::app_id] = application->app_id();
}
} else {
@@ -986,7 +1095,7 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId(
case smart_objects::SmartType::SmartType_Array: {
smart_objects::SmartArray* message_array = message.asArray();
smart_objects::SmartArray::iterator it = message_array->begin();
- for(; it != message_array->end(); ++it) {
+ for (; it != message_array->end(); ++it) {
ReplaceHMIByMobileAppId(*it);
}
break;
@@ -999,9 +1108,7 @@ void ApplicationManagerImpl::ReplaceHMIByMobileAppId(
}
break;
}
- default: {
- break;
- }
+ default: { break; }
}
}
}
@@ -1012,13 +1119,14 @@ bool ApplicationManagerImpl::StartNaviService(
LOG4CXX_AUTO_TRACE(logger_);
if (HMILevelAllowsStreaming(app_id, service_type)) {
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
std::pair<NaviServiceStatusMap::iterator, bool> res =
- navi_service_status_.insert(std::pair<uint32_t, std::pair<bool, bool> >(
- app_id, std::make_pair(false, false)));
+ navi_service_status_.insert(
+ std::pair<uint32_t, std::pair<bool, bool>>(
+ app_id, std::make_pair(false, false)));
if (!res.second) {
+ LOG4CXX_WARN(logger_, "Navi service refused");
return false;
}
it = res.first;
@@ -1026,11 +1134,13 @@ bool ApplicationManagerImpl::StartNaviService(
// Fill NaviServices map. Set true to first value of pair if
// we've started video service or to second value if we've
// started audio service
- service_type == ServiceType::kMobileNav ? it->second.first =
- true : it->second.second = true;
+ service_type == ServiceType::kMobileNav ? it->second.first = true
+ : it->second.second = true;
application(app_id)->StartStreaming(service_type);
return true;
+ } else {
+ LOG4CXX_WARN(logger_, "Refused navi service by HMI level");
}
return false;
}
@@ -1040,17 +1150,15 @@ void ApplicationManagerImpl::StopNaviService(
using namespace protocol_handler;
LOG4CXX_AUTO_TRACE(logger_);
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
- LOG4CXX_WARN(logger_, "No Information about navi service "
- << service_type);
+ LOG4CXX_WARN(logger_, "No Information about navi service " << service_type);
} else {
// Fill NaviServices map. Set false to first value of pair if
// we've stopped video service or to second value if we've
// stopped audio service
- service_type == ServiceType::kMobileNav ? it->second.first =
- false : it->second.second = false;
+ service_type == ServiceType::kMobileNav ? it->second.first = false
+ : it->second.second = false;
}
ApplicationSharedPtr app = application(app_id);
@@ -1062,31 +1170,37 @@ void ApplicationManagerImpl::StopNaviService(
}
bool ApplicationManagerImpl::OnServiceStartedCallback(
- const connection_handler::DeviceHandle& device_handle,
- const int32_t& session_key,
- const protocol_handler::ServiceType& type) {
+ const connection_handler::DeviceHandle& device_handle,
+ const int32_t& session_key,
+ const protocol_handler::ServiceType& type) {
using namespace helpers;
using namespace protocol_handler;
-
+ LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
- "OnServiceStartedCallback " << type
- << " in session 0x" << std::hex << session_key);
+ "ServiceType = " << type << ". Session = " << std::hex
+ << session_key);
+
if (type == kRpc) {
- LOG4CXX_INFO(logger_, "RPC service is about to be started.");
+ LOG4CXX_DEBUG(logger_, "RPC service is about to be started.");
return true;
}
ApplicationSharedPtr app = application(session_key);
if (!app) {
- LOG4CXX_DEBUG(logger_, "The application with id:" << session_key <<
- " doesn't exists.");
+ LOG4CXX_DEBUG(logger_,
+ "The application with id:" << session_key
+ << " doesn't exists.");
return false;
}
- if (Compare<ServiceType, EQ, ONE>(type,
- ServiceType::kMobileNav, ServiceType::kAudio)) {
+ if (Compare<ServiceType, EQ, ONE>(
+ type, ServiceType::kMobileNav, ServiceType::kAudio)) {
if (app->is_navi()) {
return StartNaviService(session_key, type);
+ } else {
+ LOG4CXX_WARN(logger_, "Refuse not navi application");
}
+ } else {
+ LOG4CXX_WARN(logger_, "Refuse unknows service");
}
return false;
}
@@ -1101,9 +1215,12 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
using namespace connection_handler;
using namespace mobile_apis;
- LOG4CXX_DEBUG(logger_, "OnServiceEndedCallback for service "
- << type << " with reason " << close_reason
- << " in session 0x" << std::hex << session_key);
+ LOG4CXX_DEBUG(logger_,
+ "OnServiceEndedCallback for service " << type << " with reason "
+ << close_reason
+ << " in session 0x"
+ << std::hex
+ << session_key);
if (type == kRpc) {
LOG4CXX_INFO(logger_, "Remove application.");
@@ -1151,34 +1268,68 @@ void ApplicationManagerImpl::OnServiceEndedCallback(
return;
}
- if (Compare<ServiceType, EQ, ONE>(type,
- ServiceType::kMobileNav, ServiceType::kAudio)) {
+ if (Compare<ServiceType, EQ, ONE>(
+ type, ServiceType::kMobileNav, ServiceType::kAudio)) {
StopNaviService(session_key, type);
}
}
+#ifdef ENABLE_SECURITY
+bool ApplicationManagerImpl::OnHandshakeDone(
+ uint32_t connection_key,
+ security_manager::SSLContext::HandshakeResult result) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ using security_manager::SSLContext;
+ using namespace helpers;
+
+ ApplicationSharedPtr app = application(connection_key);
+ DCHECK_OR_RETURN(app, false);
+ if (Compare<SSLContext::HandshakeResult, EQ, ONE>(
+ result,
+ SSLContext::Handshake_Result_CertExpired,
+ SSLContext::Handshake_Result_CertNotSigned,
+ SSLContext::Handshake_Result_AppIDMismatch,
+ SSLContext::Handshake_Result_AppNameMismatch,
+ SSLContext::Handshake_Result_NotYetValid)) {
+ app->usage_report().RecordTLSError();
+ }
+ return false;
+}
+
+void ApplicationManagerImpl::OnCertificateUpdateRequired() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ policy::PolicyHandler::instance()->OnPTExchangeNeeded();
+}
+
+security_manager::SSLContext::HandshakeContext
+ApplicationManagerImpl::GetHandshakeContext(uint32_t key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationConstSharedPtr app = application(key);
+ security_manager::SSLContext::HandshakeContext res;
+ DCHECK_OR_RETURN(app.valid(), res);
+ return res.make_context(custom_str::CustomString(app->mobile_app_id()),
+ app->name());
+}
+#endif // ENABLE_SECURITY
+
void ApplicationManagerImpl::set_hmi_message_handler(
- hmi_message_handler::HMIMessageHandler* handler) {
+ hmi_message_handler::HMIMessageHandler* handler) {
hmi_handler_ = handler;
}
void ApplicationManagerImpl::set_connection_handler(
- connection_handler::ConnectionHandler* handler) {
+ connection_handler::ConnectionHandler* handler) {
connection_handler_ = handler;
}
-connection_handler::ConnectionHandler* ApplicationManagerImpl::connection_handler() {
- return connection_handler_;
-}
-
void ApplicationManagerImpl::set_protocol_handler(
- protocol_handler::ProtocolHandler* handler) {
+ protocol_handler::ProtocolHandler* handler) {
protocol_handler_ = handler;
}
void ApplicationManagerImpl::StartDevicesDiscovery() {
- connection_handler::ConnectionHandlerImpl::instance()->
- StartDevicesDiscovery();
+ connection_handler().get_device_discovery_starter().StartDevicesDiscovery();
}
void ApplicationManagerImpl::SendMessageToMobile(
@@ -1197,23 +1348,22 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
ApplicationSharedPtr app = application(
- (*message)[strings::params][strings::connection_key].asUInt());
+ (*message)[strings::params][strings::connection_key].asUInt());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_,
- "No application associated with connection key");
+ LOG4CXX_ERROR(logger_, "No application associated with connection key");
if ((*message)[strings::msg_params].keyExists(strings::result_code) &&
((*message)[strings::msg_params][strings::result_code] ==
NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION)) {
(*message)[strings::params][strings::protocol_version] =
- ProtocolVersion::kV1;
+ ProtocolVersion::kV1;
} else {
(*message)[strings::params][strings::protocol_version] =
- SupportedSDLVersion();
+ SupportedSDLVersion();
}
} else {
(*message)[strings::params][strings::protocol_version] =
- app->protocol_version();
+ app->protocol_version();
}
mobile_so_factory().attachSchema(*message, false);
@@ -1221,8 +1371,8 @@ void ApplicationManagerImpl::SendMessageToMobile(
<< message->isValid());
// Messages to mobile are not yet prioritized so use default priority value
- utils::SharedPtr<Message> message_to_send(new Message(
- protocol_handler::MessagePriority::kDefault));
+ utils::SharedPtr<Message> message_to_send(
+ new Message(protocol_handler::MessagePriority::kDefault));
if (!ConvertSOtoMessage((*message), (*message_to_send))) {
LOG4CXX_WARN(logger_, "Can't send msg to Mobile: failed to create string");
return;
@@ -1233,12 +1383,12 @@ void ApplicationManagerImpl::SendMessageToMobile(
// checked against policy permissions
if (msg_to_mobile[strings::params].keyExists(strings::correlation_id)) {
request_ctrl_.OnMobileResponse(
- msg_to_mobile[strings::params][strings::correlation_id].asInt(),
- msg_to_mobile[strings::params][strings::connection_key].asInt());
+ msg_to_mobile[strings::params][strings::correlation_id].asInt(),
+ msg_to_mobile[strings::params][strings::connection_key].asInt());
} else if (app) {
mobile_apis::FunctionID::eType function_id =
static_cast<mobile_apis::FunctionID::eType>(
- (*message)[strings::params][strings::function_id].asUInt());
+ (*message)[strings::params][strings::function_id].asUInt());
RPCParams params;
const smart_objects::SmartObject& s_map = (*message)[strings::msg_params];
@@ -1253,21 +1403,21 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
}
}
- const mobile_apis::Result::eType check_result =
- CheckPolicyPermissions( app->mobile_app_id(),
- app->hmi_level(), function_id, params);
+ const mobile_apis::Result::eType check_result = CheckPolicyPermissions(
+ app->mobile_app_id(), app->hmi_level(), function_id, params);
if (mobile_apis::Result::SUCCESS != check_result) {
const std::string string_functionID =
MessageHelper::StringifiedFunctionID(function_id);
- LOG4CXX_WARN(logger_, "Function \"" << string_functionID << "\" (#"
- << function_id << ") not allowed by policy");
+ LOG4CXX_WARN(logger_,
+ "Function \"" << string_functionID << "\" (#" << function_id
+ << ") not allowed by policy");
return;
}
if (function_id == mobile_apis::FunctionID::OnSystemRequestID) {
mobile_apis::RequestType::eType request_type =
static_cast<mobile_apis::RequestType::eType>(
- (*message)[strings::msg_params][strings::request_type].asUInt());
+ (*message)[strings::msg_params][strings::request_type].asUInt());
if (mobile_apis::RequestType::PROPRIETARY == request_type ||
mobile_apis::RequestType::HTTP == request_type) {
policy::PolicyHandler::instance()->OnUpdateRequestSentToMobile();
@@ -1276,13 +1426,16 @@ void ApplicationManagerImpl::SendMessageToMobile(
}
if (message_to_send->binary_data()) {
- LOG4CXX_DEBUG(logger_, "Binary data size: " << message_to_send->binary_data()->size());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Binary data size: " << message_to_send->binary_data()->size());
}
- messages_to_mobile_.PostMessage(impl::MessageToMobile(message_to_send,
- final_message));
+ messages_to_mobile_.PostMessage(
+ impl::MessageToMobile(message_to_send, final_message));
}
-void ApplicationManagerImpl::TerminateRequest(uint32_t connection_key, uint32_t corr_id) {
+void ApplicationManagerImpl::TerminateRequest(uint32_t connection_key,
+ uint32_t corr_id) {
request_ctrl_.terminateRequest(corr_id, connection_key, true);
}
@@ -1292,7 +1445,7 @@ bool ApplicationManagerImpl::ManageMobileCommand(
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
- LOG4CXX_WARN(logger_, "RET Null-pointer message received.");
+ LOG4CXX_WARN(logger_, "Null-pointer message received.");
return false;
}
@@ -1304,45 +1457,49 @@ bool ApplicationManagerImpl::ManageMobileCommand(
MessageHelper::PrintSmartObject(*message);
#endif
- LOG4CXX_INFO(logger_, "Trying to create message in mobile factory.");
+ LOG4CXX_DEBUG(logger_, "Trying to create message in mobile factory.");
utils::SharedPtr<commands::Command> command(
- MobileCommandFactory::CreateCommand(message, origin));
+ MobileCommandFactory::CreateCommand(message, origin));
if (!command) {
- LOG4CXX_WARN(logger_, "RET Failed to create mobile command from smart object");
+ LOG4CXX_WARN(logger_,
+ "RET Failed to create mobile command from smart object");
return false;
}
mobile_apis::FunctionID::eType function_id =
- static_cast<mobile_apis::FunctionID::eType>(
- (*message)[strings::params][strings::function_id].asInt());
+ static_cast<mobile_apis::FunctionID::eType>(
+ (*message)[strings::params][strings::function_id].asInt());
// Notifications from HMI have no such parameter
uint32_t correlation_id =
- (*message)[strings::params].keyExists(strings::correlation_id)
- ? (*message)[strings::params][strings::correlation_id].asUInt()
- : 0;
+ (*message)[strings::params].keyExists(strings::correlation_id)
+ ? (*message)[strings::params][strings::correlation_id].asUInt()
+ : 0;
uint32_t connection_key =
- (*message)[strings::params][strings::connection_key].asUInt();
+ (*message)[strings::params][strings::connection_key].asUInt();
int32_t protocol_type =
- (*message)[strings::params][strings::protocol_type].asUInt();
+ (*message)[strings::params][strings::protocol_type].asUInt();
ApplicationSharedPtr app;
- int32_t message_type = (*message)[strings::params][strings::message_type].asInt();
+ int32_t message_type =
+ (*message)[strings::params][strings::message_type].asInt();
if (((mobile_apis::FunctionID::RegisterAppInterfaceID != function_id) &&
(protocol_type == commands::CommandImpl::mobile_protocol_type_)) &&
(mobile_apis::FunctionID::UnregisterAppInterfaceID != function_id)) {
app = ApplicationManagerImpl::instance()->application(connection_key);
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "RET APPLICATION_NOT_REGISTERED");
+ LOG4CXX_ERROR(logger_, "RET APPLICATION_NOT_REGISTERED");
smart_objects::SmartObjectSPtr response =
- MessageHelper::CreateNegativeResponse(connection_key,
- static_cast<int32_t>(function_id),
- correlation_id,
- static_cast<int32_t>(mobile_apis::Result::APPLICATION_NOT_REGISTERED));
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ static_cast<int32_t>(
+ mobile_apis::Result::APPLICATION_NOT_REGISTERED));
SendMessageToMobile(response);
return false;
@@ -1352,16 +1509,14 @@ bool ApplicationManagerImpl::ManageMobileCommand(
mobile_so_factory().attachSchema(*message, false);
}
- if (message_type ==
- mobile_apis::messageType::response) {
+ if (message_type == mobile_apis::messageType::response) {
if (command->Init()) {
command->Run();
command->CleanUp();
}
return true;
}
- if (message_type ==
- mobile_apis::messageType::notification) {
+ if (message_type == mobile_apis::messageType::notification) {
request_ctrl_.addNotification(command);
if (command->Init()) {
command->Run();
@@ -1373,11 +1528,10 @@ bool ApplicationManagerImpl::ManageMobileCommand(
return true;
}
- if (message_type ==
- mobile_apis::messageType::request) {
-
+ if (message_type == mobile_apis::messageType::request) {
// commands will be launched from requesr_ctrl
- mobile_apis::HMILevel::eType app_hmi_level = mobile_apis::HMILevel::INVALID_ENUM;
+ mobile_apis::HMILevel::eType app_hmi_level =
+ mobile_apis::HMILevel::INVALID_ENUM;
if (app) {
app_hmi_level = app->hmi_level();
}
@@ -1385,56 +1539,61 @@ bool ApplicationManagerImpl::ManageMobileCommand(
// commands will be launched from request_ctrl
const request_controller::RequestController::TResult result =
- request_ctrl_.addMobileRequest(command, app_hmi_level);
+ request_ctrl_.addMobileRequest(command, app_hmi_level);
if (result == request_controller::RequestController::SUCCESS) {
- LOG4CXX_INFO(logger_, "Perform request");
- } else if (result ==
- request_controller::RequestController::
- TOO_MANY_PENDING_REQUESTS) {
- LOG4CXX_ERROR_EXT(logger_, "RET Unable top perform request: " <<
- "TOO_MANY_PENDING_REQUESTS");
+ LOG4CXX_DEBUG(logger_, "Perform request");
+ } else if (result == request_controller::RequestController::
+ TOO_MANY_PENDING_REQUESTS) {
+ LOG4CXX_ERROR(logger_,
+ "RET Unable top perform request: "
+ << "TOO_MANY_PENDING_REQUESTS");
smart_objects::SmartObjectSPtr response =
- MessageHelper::CreateNegativeResponse(connection_key,
- static_cast<int32_t>(function_id),
- correlation_id,
- static_cast<int32_t>(mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
+ MessageHelper::CreateNegativeResponse(
+ connection_key,
+ static_cast<int32_t>(function_id),
+ correlation_id,
+ static_cast<int32_t>(
+ mobile_apis::Result::TOO_MANY_PENDING_REQUESTS));
SendMessageToMobile(response);
return false;
} else if (result ==
request_controller::RequestController::TOO_MANY_REQUESTS) {
- LOG4CXX_ERROR_EXT(logger_, "RET Unable to perform request: " <<
- "TOO_MANY_REQUESTS");
+ LOG4CXX_ERROR(logger_,
+ "RET Unable to perform request: "
+ << "TOO_MANY_REQUESTS");
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- connection_key,
- mobile_api::AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS);
+ connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::TOO_MANY_REQUESTS);
UnregisterApplication(connection_key,
mobile_apis::Result::TOO_MANY_PENDING_REQUESTS,
false);
+
return false;
- } else if (result ==
- request_controller::RequestController::
- NONE_HMI_LEVEL_MANY_REQUESTS) {
- LOG4CXX_ERROR_EXT(logger_, "RET Unable to perform request: " <<
- "REQUEST_WHILE_IN_NONE_HMI_LEVEL");
+ } else if (result == request_controller::RequestController::
+ NONE_HMI_LEVEL_MANY_REQUESTS) {
+ LOG4CXX_ERROR(logger_,
+ "RET Unable to perform request: "
+ << "REQUEST_WHILE_IN_NONE_HMI_LEVEL");
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- connection_key, mobile_api::AppInterfaceUnregisteredReason::
- REQUEST_WHILE_IN_NONE_HMI_LEVEL);
+ connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::
+ REQUEST_WHILE_IN_NONE_HMI_LEVEL);
ApplicationSharedPtr app_ptr = application(connection_key);
- if(app_ptr) {
+ if (app_ptr) {
app_ptr->usage_report().RecordRemovalsForBadBehavior();
}
- UnregisterApplication(connection_key, mobile_apis::Result::INVALID_ENUM,
- false);
+ UnregisterApplication(
+ connection_key, mobile_apis::Result::INVALID_ENUM, false);
return false;
} else {
- LOG4CXX_ERROR_EXT(logger_, "RET Unable to perform request: Unknown case");
+ LOG4CXX_ERROR(logger_, "RET Unable to perform request: Unknown case");
return false;
}
return true;
@@ -1461,7 +1620,7 @@ void ApplicationManagerImpl::SendMessageToHMI(
// SmartObject |message| has no way to declare priority for now
utils::SharedPtr<Message> message_to_send(
- new Message(protocol_handler::MessagePriority::kDefault));
+ new Message(protocol_handler::MessagePriority::kDefault));
if (!message_to_send) {
LOG4CXX_ERROR(logger_, "Null pointer");
return;
@@ -1515,13 +1674,14 @@ bool ApplicationManagerImpl::ManageHMICommand(
LOG4CXX_DEBUG(logger_, "ManageHMICommand");
request_ctrl_.addHMIRequest(command);
}
+
command->Run();
- if (kResponse == message_type) {
- int32_t correlation_id =
- (*(message.get()))[strings::params][strings::correlation_id].asInt();
- request_ctrl_.OnHMIResponse(correlation_id);
- }
- return true;
+ if (kResponse == message_type) {
+ const uint32_t correlation_id =
+ (*(message.get()))[strings::params][strings::correlation_id].asUInt();
+ request_ctrl_.OnHMIResponse(correlation_id);
+ }
+ return true;
}
return false;
}
@@ -1534,6 +1694,11 @@ bool ApplicationManagerImpl::Init() {
!IsReadWriteAllowed(app_storage_folder, TYPE_STORAGE)) {
return false;
}
+ if (!resume_ctrl_.Init()) {
+ LOG4CXX_ERROR(logger_, "Problem with initialization of resume controller");
+
+ return false;
+ }
const std::string system_files_path =
profile::Profile::instance()->system_files_path();
@@ -1541,7 +1706,6 @@ bool ApplicationManagerImpl::Init() {
!IsReadWriteAllowed(system_files_path, TYPE_SYSTEM)) {
return false;
}
-
const std::string app_icons_folder =
profile::Profile::instance()->app_icons_folder();
if (!InitDirectory(app_icons_folder, TYPE_ICONS)) {
@@ -1550,10 +1714,10 @@ bool ApplicationManagerImpl::Init() {
// In case there is no R/W permissions for this location, SDL just has to
// log this and proceed
IsReadWriteAllowed(app_icons_folder, TYPE_ICONS);
-
if (policy::PolicyHandler::instance()->PolicyEnabled()) {
- if(!policy::PolicyHandler::instance()->LoadPolicyLibrary()) {
- LOG4CXX_ERROR(logger_, "Policy library is not loaded. Check LD_LIBRARY_PATH");
+ if (!policy::PolicyHandler::instance()->LoadPolicyLibrary()) {
+ LOG4CXX_ERROR(logger_,
+ "Policy library is not loaded. Check LD_LIBRARY_PATH");
return false;
}
LOG4CXX_INFO(logger_, "Policy library is loaded, now initing PT");
@@ -1562,18 +1726,20 @@ bool ApplicationManagerImpl::Init() {
return false;
}
} else {
- LOG4CXX_WARN(logger_, "System is configured to work without policy functionality.");
+ LOG4CXX_WARN(logger_,
+ "System is configured to work without policy functionality.");
}
media_manager_ = media_manager::MediaManagerImpl::instance();
return true;
}
bool ApplicationManagerImpl::ConvertMessageToSO(
- const Message& message, smart_objects::SmartObject& output) {
- LOG4CXX_INFO(
- logger_,
- "\t\t\tMessage to convert: protocol " << message.protocol_version()
- << "; json " << message.json_message());
+ const Message& message, smart_objects::SmartObject& output) {
+ LOG4CXX_DEBUG(logger_,
+ "\t\t\tMessage to convert: protocol "
+ << message.protocol_version()
+ << "; json "
+ << message.json_message());
switch (message.protocol_version()) {
case ProtocolVersion::kV4:
@@ -1581,42 +1747,52 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
case ProtocolVersion::kV2: {
const bool conversion_result =
formatters::CFormatterJsonSDLRPCv2::fromString(
- message.json_message(), output, message.function_id(),
- message.type(), message.correlation_id());
- if (!conversion_result
- || !mobile_so_factory().attachSchema(output, true)
- || ((output.validate() != smart_objects::Errors::OK))) {
- LOG4CXX_WARN(logger_, "Failed to parse string to smart object :"
- << message.json_message());
+ message.json_message(),
+ output,
+ message.function_id(),
+ message.type(),
+ message.correlation_id());
+ if (!conversion_result || !mobile_so_factory().attachSchema(output, false) ||
+ ((output.validate() != smart_objects::Errors::OK))) {
+ LOG4CXX_WARN(logger_,
+ "Failed to parse string to smart object :"
+ << message.json_message());
utils::SharedPtr<smart_objects::SmartObject> response(
MessageHelper::CreateNegativeResponse(
- message.connection_key(), message.function_id(),
- message.correlation_id(), mobile_apis::Result::INVALID_DATA));
- ManageMobileCommand(response, commands::Command::ORIGIN_SDL);
+ message.connection_key(),
+ message.function_id(),
+ message.correlation_id(),
+ mobile_apis::Result::INVALID_DATA));
+ ManageMobileCommand(response);
return false;
}
- LOG4CXX_INFO(
- logger_,
- "Convertion result for sdl object is true" << " function_id "
- << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
+ LOG4CXX_DEBUG(logger_,
+ "Convertion result for sdl object is true"
+ << " function_id "
+ << output[jhs::S_PARAMS][jhs::S_FUNCTION_ID].asInt());
output[strings::params][strings::connection_key] =
- message.connection_key();
+ message.connection_key();
output[strings::params][strings::protocol_version] =
- message.protocol_version();
+ message.protocol_version();
if (message.binary_data()) {
if (message.payload_size() < message.data_size()) {
- LOG4CXX_ERROR(logger_, "Incomplete binary" <<
- " binary size should be " << message.data_size() <<
- " payload data size is " << message.payload_size());
+ LOG4CXX_ERROR(logger_,
+ "Incomplete binary"
+ << " binary size should be "
+ << message.data_size()
+ << " payload data size is "
+ << message.payload_size());
utils::SharedPtr<smart_objects::SmartObject> response(
- MessageHelper::CreateNegativeResponse(
- message.connection_key(), message.function_id(),
- message.correlation_id(), mobile_apis::Result::INVALID_DATA));
+ MessageHelper::CreateNegativeResponse(
+ message.connection_key(),
+ message.function_id(),
+ message.correlation_id(),
+ mobile_apis::Result::INVALID_DATA));
ManageMobileCommand(response);
return false;
}
output[strings::params][strings::binary_data] =
- *(message.binary_data());
+ *(message.binary_data());
}
break;
}
@@ -1624,7 +1800,7 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
#ifdef ENABLE_LOG
int32_t result =
#endif
- formatters::FormatterJsonRpc::FromString<
+ formatters::FormatterJsonRpc::FromString<
hmi_apis::FunctionID::eType, hmi_apis::messageType::eType>(
message.json_message(), output);
LOG4CXX_INFO(logger_,
@@ -1652,9 +1828,9 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
output.erase(strings::msg_params);
output[strings::params][hmi_response::code] =
- hmi_apis::Common_Result::INVALID_DATA;
+ hmi_apis::Common_Result::INVALID_DATA;
output[strings::msg_params][strings::info] =
- std::string("Received invalid data on HMI response");
+ std::string("Received invalid data on HMI response");
}
break;
}
@@ -1665,25 +1841,26 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
LOG4CXX_ERROR(logger_, "Message received: UNSUPPORTED_VERSION");
int32_t conversation_result =
- formatters::CFormatterJsonSDLRPCv1::fromString <
- NsSmartDeviceLinkRPC::V1::FunctionID::eType,
- NsSmartDeviceLinkRPC::V1::messageType::eType > (
- message.json_message(), output);
-
- if (formatters::CFormatterJsonSDLRPCv1::kSuccess
- == conversation_result) {
+ formatters::CFormatterJsonSDLRPCv1::fromString<
+ NsSmartDeviceLinkRPC::V1::FunctionID::eType,
+ NsSmartDeviceLinkRPC::V1::messageType::eType>(
+ message.json_message(), output);
- smart_objects::SmartObject params = smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
+ if (formatters::CFormatterJsonSDLRPCv1::kSuccess ==
+ conversation_result) {
+ smart_objects::SmartObject params = smart_objects::SmartObject(
+ smart_objects::SmartType::SmartType_Map);
output[strings::params][strings::message_type] =
- NsSmartDeviceLinkRPC::V1::messageType::response;
- output[strings::params][strings::connection_key] = message.connection_key();
+ NsSmartDeviceLinkRPC::V1::messageType::response;
+ output[strings::params][strings::connection_key] =
+ message.connection_key();
- output[strings::msg_params] =
- smart_objects::SmartObject(smart_objects::SmartType::SmartType_Map);
+ output[strings::msg_params] = smart_objects::SmartObject(
+ smart_objects::SmartType::SmartType_Map);
output[strings::msg_params][strings::success] = false;
output[strings::msg_params][strings::result_code] =
- NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION;
+ NsSmartDeviceLinkRPC::V1::Result::UNSUPPORTED_VERSION;
smart_objects::SmartObjectSPtr msg_to_send =
new smart_objects::SmartObject(output);
@@ -1698,56 +1875,58 @@ bool ApplicationManagerImpl::ConvertMessageToSO(
default:
// TODO(PV):
// removed NOTREACHED() because some app can still have vesion 1.
- LOG4CXX_WARN(
- logger_,
- "Application used unsupported protocol :" << message.protocol_version()
- << ".");
+ LOG4CXX_WARN(logger_,
+ "Application used unsupported protocol :"
+ << message.protocol_version()
+ << ".");
return false;
}
- LOG4CXX_INFO(logger_, "Successfully parsed message into smart object");
+ LOG4CXX_DEBUG(logger_, "Successfully parsed message into smart object");
return true;
}
bool ApplicationManagerImpl::ConvertSOtoMessage(
- const smart_objects::SmartObject& message, Message& output) {
- LOG4CXX_INFO(logger_, "Message to convert");
+ const smart_objects::SmartObject& message, Message& output) {
+ LOG4CXX_AUTO_TRACE(logger_);
- if (smart_objects::SmartType_Null == message.getType()
- || smart_objects::SmartType_Invalid == message.getType()) {
+ if (smart_objects::SmartType_Null == message.getType() ||
+ smart_objects::SmartType_Invalid == message.getType()) {
LOG4CXX_WARN(logger_, "Invalid smart object received.");
return false;
}
- LOG4CXX_INFO(
- logger_,
- "Message with protocol: "
- << message.getElement(jhs::S_PARAMS).getElement(jhs::S_PROTOCOL_TYPE)
- .asInt());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Message with protocol: " << message.getElement(jhs::S_PARAMS)
+ .getElement(jhs::S_PROTOCOL_TYPE)
+ .asInt());
std::string output_string;
- switch (message.getElement(jhs::S_PARAMS).getElement(jhs::S_PROTOCOL_TYPE)
- .asInt()) {
+ const int64_t protocol_type = message.getElement(jhs::S_PARAMS)
+ .getElement(jhs::S_PROTOCOL_TYPE)
+ .asInt();
+ const int64_t protocol_version = message.getElement(jhs::S_PARAMS)
+ .getElement(jhs::S_PROTOCOL_VERSION)
+ .asInt();
+ switch (protocol_type) {
case 0: {
- if (message.getElement(jhs::S_PARAMS).getElement(jhs::S_PROTOCOL_VERSION).asInt() == 1) {
+ if (protocol_version == 1) {
if (!formatters::CFormatterJsonSDLRPCv1::toString(message,
- output_string)) {
+ output_string)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
output.set_protocol_version(application_manager::kV1);
} else {
if (!formatters::CFormatterJsonSDLRPCv2::toString(message,
- output_string)) {
+ output_string)) {
LOG4CXX_WARN(logger_, "Failed to serialize smart object");
return false;
}
- output.set_protocol_version(
- static_cast<ProtocolVersion>(
- message.getElement(jhs::S_PARAMS).getElement(
- jhs::S_PROTOCOL_VERSION).asUInt()));
+ output.set_protocol_version(static_cast<ProtocolVersion>(
+ protocol_version));
}
-
break;
}
case 1: {
@@ -1763,35 +1942,38 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
return false;
}
- LOG4CXX_INFO(logger_, "Convertion result: " << output_string);
+ LOG4CXX_DEBUG(logger_, "Convertion result: " << output_string);
- output.set_connection_key(
- message.getElement(jhs::S_PARAMS).getElement(strings::connection_key)
- .asInt());
+ output.set_connection_key(message.getElement(jhs::S_PARAMS)
+ .getElement(strings::connection_key)
+ .asInt());
output.set_function_id(
- message.getElement(jhs::S_PARAMS).getElement(jhs::S_FUNCTION_ID).asInt());
+ message.getElement(jhs::S_PARAMS).getElement(jhs::S_FUNCTION_ID).asInt());
- output.set_correlation_id(
- message.getElement(jhs::S_PARAMS).getElement(jhs::S_CORRELATION_ID)
- .asInt());
+ output.set_correlation_id(message.getElement(jhs::S_PARAMS)
+ .getElement(jhs::S_CORRELATION_ID)
+ .asInt());
output.set_message_type(
- static_cast<MessageType>(message.getElement(jhs::S_PARAMS).getElement(
- jhs::S_MESSAGE_TYPE).asInt()));
+ static_cast<MessageType>(message.getElement(jhs::S_PARAMS)
+ .getElement(jhs::S_MESSAGE_TYPE)
+ .asInt()));
// Currently formatter creates JSON = 3 bytes for empty SmartObject.
// workaround for notification. JSON must be empty
- if (mobile_apis::FunctionID::OnAudioPassThruID
- != message.getElement(jhs::S_PARAMS).getElement(strings::function_id)
- .asInt()) {
+ if (mobile_apis::FunctionID::OnAudioPassThruID !=
+ message.getElement(jhs::S_PARAMS)
+ .getElement(strings::function_id)
+ .asInt()) {
output.set_json_message(output_string);
}
if (message.getElement(jhs::S_PARAMS).keyExists(strings::binary_data)) {
application_manager::BinaryData* binaryData =
- new application_manager::BinaryData(
- message.getElement(jhs::S_PARAMS).getElement(strings::binary_data)
- .asBinary());
+ new application_manager::BinaryData(
+ message.getElement(jhs::S_PARAMS)
+ .getElement(strings::binary_data)
+ .asBinary());
if (NULL == binaryData) {
LOG4CXX_ERROR(logger_, "Null pointer");
@@ -1800,26 +1982,26 @@ bool ApplicationManagerImpl::ConvertSOtoMessage(
output.set_binary_data(binaryData);
}
- LOG4CXX_INFO(logger_, "Successfully parsed smart object into message");
+ LOG4CXX_DEBUG(logger_, "Successfully parsed smart object into message");
return true;
}
utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage(
- const ::protocol_handler::RawMessagePtr message) {
+ const ::protocol_handler::RawMessagePtr message) {
DCHECK(message);
utils::SharedPtr<Message> outgoing_message;
- LOG4CXX_INFO(logger_, "Service type." << message->service_type());
+ LOG4CXX_DEBUG(logger_, "Service type." << message->service_type());
- if (message->service_type() != protocol_handler::kRpc
- &&
+ if (message->service_type() != protocol_handler::kRpc &&
message->service_type() != protocol_handler::kBulk) {
// skip this message, not under handling of ApplicationManager
LOG4CXX_TRACE(logger_, "Skipping message; not the under AM handling.");
return outgoing_message;
}
- Message* convertion_result = MobileMessageHandler::HandleIncomingMessageProtocol(message);
+ Message* convertion_result =
+ MobileMessageHandler::HandleIncomingMessageProtocol(message);
if (convertion_result) {
outgoing_message = convertion_result;
@@ -1830,12 +2012,13 @@ utils::SharedPtr<Message> ApplicationManagerImpl::ConvertRawMsgToMessage(
}
void ApplicationManagerImpl::ProcessMessageFromMobile(
- const utils::SharedPtr<Message> message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ProcessMessageFromMobile()");
-#ifdef TIME_TESTER
- AMMetricObserver::MessageMetricSharedPtr metric(new AMMetricObserver::MessageMetric());
+ const utils::SharedPtr<Message> message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+#ifdef TELEMETRY_MONITOR
+ AMTelemetryObserver::MessageMetricSharedPtr metric(
+ new AMTelemetryObserver::MessageMetric());
metric->begin = date_time::DateTime::getCurrentTime();
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
smart_objects::SmartObjectSPtr so_from_mobile(new smart_objects::SmartObject);
if (!so_from_mobile) {
@@ -1847,25 +2030,24 @@ void ApplicationManagerImpl::ProcessMessageFromMobile(
LOG4CXX_ERROR(logger_, "Cannot create smart object from message");
return;
}
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
metric->message = so_from_mobile;
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
- if (!ManageMobileCommand(so_from_mobile,
- commands::Command::ORIGIN_MOBILE)) {
+ if (!ManageMobileCommand(so_from_mobile, commands::Command::ORIGIN_MOBILE)) {
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
metric->end = date_time::DateTime::getCurrentTime();
if (metric_observer_) {
metric_observer_->OnMessage(metric);
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
}
void ApplicationManagerImpl::ProcessMessageFromHMI(
- const utils::SharedPtr<Message> message) {
- LOG4CXX_INFO(logger_, "ApplicationManagerImpl::ProcessMessageFromHMI()");
+ const utils::SharedPtr<Message> message) {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr smart_object(new smart_objects::SmartObject);
if (!smart_object) {
@@ -1882,7 +2064,7 @@ void ApplicationManagerImpl::ProcessMessageFromHMI(
}
#endif // HMI_DBUS_API
- LOG4CXX_INFO(logger_, "Converted message, trying to create hmi command");
+ LOG4CXX_DEBUG(logger_, "Converted message, trying to create hmi command");
if (!ManageHMICommand(smart_object)) {
LOG4CXX_ERROR(logger_, "Received command didn't run successfully");
}
@@ -1918,33 +2100,56 @@ void ApplicationManagerImpl::PullLanguagesInfo(const SmartObject& app_data,
SmartObject& ttsName,
SmartObject& vrSynonym) {
LOG4CXX_AUTO_TRACE(logger_);
- if (app_data.keyExists(json::languages)) {
+ if (!app_data.keyExists(json::languages)) {
+ LOG4CXX_WARN(logger_, "\"languages\" not exists");
+ return;
+ }
- const HMICapabilities& hmi_cap = hmi_capabilities();
- std::string vr(MessageHelper::CommonLanguageToString(hmi_cap.active_vr_language()));
- const SmartObject& arr = app_data[json::languages];
+ const HMICapabilities& hmi_cap = hmi_capabilities();
+ std::string cur_vr_lang(MessageHelper::CommonLanguageToString
+ (hmi_cap.active_vr_language()));
+ const SmartObject& languages = app_data[json::languages];
- std::transform(vr.begin(), vr.end(), vr.begin(), ::toupper);
+ std::transform(cur_vr_lang.begin(), cur_vr_lang.end(), cur_vr_lang.begin(), ::toupper);
- ssize_t default_idx = -1;
- ssize_t specific_idx = -1;
+ ssize_t default_idx = -1;
+ ssize_t specific_idx = -1;
- const size_t size = arr.length();
- for (size_t idx = 0; idx < size; ++idx) {
- if (arr[idx].keyExists(vr)) {
- specific_idx = idx; break;
- } else if (arr[idx].keyExists(json::default_)) { default_idx = idx; }
- else { LOG4CXX_DEBUG(logger_, "Unknown key was specified."); }
- }
+ const size_t size = languages.length();
+ for (size_t idx = 0; idx < size; ++idx) {
+ if (languages[idx].keyExists(cur_vr_lang)) {
+ LOG4CXX_DEBUG(logger_, "Found active HMI language " << cur_vr_lang);
+ specific_idx = idx;
+ } else if (languages[idx].keyExists(json::default_)) {
+ LOG4CXX_DEBUG(logger_, "Found default language");
+ default_idx = idx;
+ }
+ }
+
+ if ( (-1 == specific_idx) && (-1 == default_idx) ) {
+ LOG4CXX_DEBUG(logger_, "No suitable language found");
+ return;
+ }
- const ssize_t regular_id = specific_idx != -1 ? specific_idx : default_idx;
+ if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists(
+ json::ttsName)) {
+ LOG4CXX_DEBUG(logger_, "Get ttsName from " << cur_vr_lang << " language");
+ ttsName =
+ app_data[json::languages][specific_idx][cur_vr_lang][json::ttsName];
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "No data for ttsName for " << cur_vr_lang << " language");
+ }
- if (regular_id != -1 &&
- app_data[json::languages][regular_id][vr].keyExists(json::ttsName) &&
- app_data[json::languages][regular_id][vr].keyExists(json::vrSynonyms)) {
- ttsName = app_data[json::languages][regular_id][vr][json::ttsName];
- vrSynonym = app_data[json::languages][regular_id][vr][json::vrSynonyms];
- }
+ if (app_data[json::languages][specific_idx][cur_vr_lang].keyExists(
+ json::vrSynonyms)) {
+ LOG4CXX_DEBUG(logger_,
+ "Get vrSynonyms from " << cur_vr_lang << " language");
+ vrSynonym =
+ app_data[json::languages][specific_idx][cur_vr_lang][json::vrSynonyms];
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "No data for vrSynonyms for " << cur_vr_lang << " language");
}
}
@@ -1963,13 +2168,15 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
continue;
}
- const std::string mobile_app_id(app_data[json::appId].asString());
+ const std::string policy_app_id(app_data[json::appId].asString());
ApplicationSharedPtr registered_app =
- ApplicationManagerImpl::instance()->
- application_by_policy_id(mobile_app_id);
+ ApplicationManagerImpl::instance()->application_by_policy_id(
+ policy_app_id);
if (registered_app) {
- LOG4CXX_DEBUG(logger_, "Application with the same id: " << mobile_app_id
- << " is registered already.");
+ LOG4CXX_DEBUG(
+ logger_,
+ "Application with the same id: " << policy_app_id
+ << " is registered already.");
continue;
}
@@ -1979,51 +2186,59 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
SmartObject vrSynonym;
SmartObject ttsName;
- const std::string appName(app_data[json::name].asString());
+ const custom_str::CustomString appName(app_data[json::name].asCustomString());
if (app_data.keyExists(json::ios)) {
os_type = json::ios;
url_scheme = app_data[os_type][json::urlScheme].asString();
} else if (app_data.keyExists(json::android)) {
os_type = json::android;
- package_name =
- app_data[os_type][json::packageName].asString();
+ package_name = app_data[os_type][json::packageName].asString();
}
PullLanguagesInfo(app_data[os_type], ttsName, vrSynonym);
- if (ttsName.empty() || vrSynonym.empty()) {
+ if (ttsName.empty()) {
ttsName = SmartObject(SmartType_Array);
- vrSynonym = SmartObject(SmartType_Array);
-
ttsName[0] = appName;
+ }
+ if (vrSynonym.empty()) {
+ vrSynonym = SmartObject(SmartType_Array);
vrSynonym[0] = appName;
}
- const uint32_t hmi_app_id = resume_ctrl_.IsApplicationSaved(mobile_app_id)?
- resume_ctrl_.GetHMIApplicationID(mobile_app_id) : GenerateNewHMIAppID();
-
const std::string app_icon_dir(Profile::instance()->app_icons_folder());
- const std::string full_icon_path(app_icon_dir + "/" + mobile_app_id);
+ const std::string full_icon_path(app_icon_dir + "/" + policy_app_id);
uint32_t device_id = 0;
- connection_handler::ConnectionHandlerImpl* con_handler_impl =
- static_cast<connection_handler::ConnectionHandlerImpl*>(
- connection_handler_);
- if (-1 == con_handler_impl->GetDataOnSessionKey(
- connection_key, NULL, NULL, &device_id)) {
+ if (-1 == connection_handler().GetDataOnSessionKey(
+ connection_key, NULL, NULL, &device_id)) {
LOG4CXX_ERROR(logger_,
"Failed to create application: no connection info.");
continue;
}
- // AppId = 0 because this is query_app(provided by hmi for download, but not yet registered)
+ std::string device_mac;
+ connection_handler().get_session_observer().GetDataOnDeviceID(device_id,
+ NULL,
+ NULL,
+ &device_mac,
+ NULL);
+
+ const uint32_t hmi_app_id =
+ resume_ctrl_.IsApplicationSaved(policy_app_id, device_mac)
+ ? resume_ctrl_.GetHMIApplicationID(policy_app_id, device_mac)
+ : GenerateNewHMIAppID();
+
+ // AppId = 0 because this is query_app(provided by hmi for download, but not
+ // yet registered)
ApplicationSharedPtr app(
- new ApplicationImpl(0,
- mobile_app_id,
- appName,
- PolicyHandler::instance()->GetStatisticManager()));
+ new ApplicationImpl(0,
+ policy_app_id,
+ device_mac,
+ appName,
+ PolicyHandler::instance()->GetStatisticManager()));
DCHECK_OR_RETURN_VOID(app);
app->SetShemaUrl(url_scheme);
app->SetPackageName(package_name);
@@ -2035,11 +2250,11 @@ void ApplicationManagerImpl::CreateApplications(SmartArray& obj_array,
app->set_tts_name(ttsName);
sync_primitives::AutoLock lock(apps_to_register_list_lock_);
- LOG4CXX_DEBUG(logger_, "apps_to_register_ size before: "
- << apps_to_register_.size());
+ LOG4CXX_DEBUG(
+ logger_, "apps_to_register_ size before: " << apps_to_register_.size());
apps_to_register_.insert(app);
- LOG4CXX_DEBUG(logger_, "apps_to_register_ size after: "
- << apps_to_register_.size());
+ LOG4CXX_DEBUG(logger_,
+ "apps_to_register_ size after: " << apps_to_register_.size());
}
}
@@ -2061,7 +2276,6 @@ void ApplicationManagerImpl::ProcessQueryApp(
AppsWaitRegistrationSet::const_iterator it = apps_to_register_.begin();
for (; it != apps_to_register_.end(); ++it) {
-
const std::string full_icon_path((*it)->app_icon_path());
if (file_system::FileExists(full_icon_path)) {
MessageHelper::SendSetAppIcon((*it)->hmi_app_id(), full_icon_path);
@@ -2070,33 +2284,40 @@ void ApplicationManagerImpl::ProcessQueryApp(
}
}
-#ifdef TIME_TESTER
-void ApplicationManagerImpl::SetTimeMetricObserver(AMMetricObserver* observer) {
+bool ApplicationManagerImpl::is_attenuated_supported() {
+ return hmi_capabilities().attenuated_supported() &&
+ profile::Profile::instance()->is_mixing_audio_supported();
+}
+
+#ifdef TELEMETRY_MONITOR
+void ApplicationManagerImpl::SetTelemetryObserver(AMTelemetryObserver* observer) {
metric_observer_ = observer;
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
void ApplicationManagerImpl::addNotification(const CommandSharedPtr ptr) {
request_ctrl_.addNotification(ptr);
}
-void ApplicationManagerImpl::removeNotification(const commands::Command* notification) {
+void ApplicationManagerImpl::removeNotification(
+ const commands::Command* notification) {
request_ctrl_.removeNotification(notification);
}
-void ApplicationManagerImpl::updateRequestTimeout(uint32_t connection_key,
+void ApplicationManagerImpl::updateRequestTimeout(
+ uint32_t connection_key,
uint32_t mobile_correlation_id,
uint32_t new_timeout_value) {
LOG4CXX_AUTO_TRACE(logger_);
- request_ctrl_.updateRequestTimeout(connection_key, mobile_correlation_id,
- new_timeout_value);
+ request_ctrl_.updateRequestTimeout(
+ connection_key, mobile_correlation_id, new_timeout_value);
}
-const uint32_t ApplicationManagerImpl::application_id
-(const int32_t correlation_id) {
+const uint32_t ApplicationManagerImpl::application_id(
+ const int32_t correlation_id) {
// ykazakov: there is no erase for const iterator for QNX
std::map<const int32_t, const uint32_t>::iterator it =
- appID_list_.find(correlation_id);
+ appID_list_.find(correlation_id);
if (appID_list_.end() != it) {
const uint32_t app_id = it->second;
appID_list_.erase(it);
@@ -2107,21 +2328,23 @@ const uint32_t ApplicationManagerImpl::application_id
}
void ApplicationManagerImpl::set_application_id(const int32_t correlation_id,
- const uint32_t app_id) {
- appID_list_.insert(std::pair<const int32_t, const uint32_t>
- (correlation_id, app_id));
+ const uint32_t app_id) {
+ appID_list_.insert(
+ std::pair<const int32_t, const uint32_t>(correlation_id, app_id));
}
-void ApplicationManagerImpl::AddPolicyObserver( policy::PolicyHandlerObserver* listener) {
+void ApplicationManagerImpl::AddPolicyObserver(
+ policy::PolicyHandlerObserver* listener) {
policy::PolicyHandler::instance()->add_listener(listener);
}
-void ApplicationManagerImpl::RemovePolicyObserver(policy::PolicyHandlerObserver* listener) {
+void ApplicationManagerImpl::RemovePolicyObserver(
+ policy::PolicyHandlerObserver* listener) {
policy::PolicyHandler::instance()->remove_listener(listener);
}
void ApplicationManagerImpl::SetUnregisterAllApplicationsReason(
- mobile_api::AppInterfaceUnregisteredReason::eType reason) {
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) {
LOG4CXX_TRACE(logger_, "reason = " << reason);
unregister_reason_ = reason;
}
@@ -2138,7 +2361,8 @@ void ApplicationManagerImpl::HeadUnitReset(
policy::PolicyHandler::instance()->UnloadPolicyLibrary();
resume_controller().StopSavePersistentDataTimer();
- file_system::remove_directory_content(profile::Profile::instance()->app_storage_folder());
+ file_system::remove_directory_content(
+ profile::Profile::instance()->app_storage_folder());
break;
}
case mobile_api::AppInterfaceUnregisteredReason::FACTORY_DEFAULTS: {
@@ -2152,18 +2376,16 @@ void ApplicationManagerImpl::HeadUnitReset(
}
}
-
void ApplicationManagerImpl::SendOnSDLClose() {
LOG4CXX_AUTO_TRACE(logger_);
// must be sent to PASA HMI on shutdown synchronously
- smart_objects::SmartObjectSPtr msg = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr msg =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
(*msg)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_OnSDLClose;
- (*msg)[strings::params][strings::message_type] =
- MessageType::kNotification;
+ hmi_apis::FunctionID::BasicCommunication_OnSDLClose;
+ (*msg)[strings::params][strings::message_type] = MessageType::kNotification;
(*msg)[strings::params][strings::protocol_type] =
commands::CommandImpl::hmi_protocol_type_;
(*msg)[strings::params][strings::protocol_version] =
@@ -2177,13 +2399,12 @@ void ApplicationManagerImpl::SendOnSDLClose() {
// SmartObject |message| has no way to declare priority for now
utils::SharedPtr<Message> message_to_send(
- new Message(protocol_handler::MessagePriority::kDefault));
+ new Message(protocol_handler::MessagePriority::kDefault));
hmi_so_factory().attachSchema(*msg, false);
LOG4CXX_DEBUG(logger_,
"Attached schema to message, result if valid: " << msg->isValid());
-
#ifdef HMI_DBUS_API
message_to_send->set_smart_object(*msg);
#else
@@ -2202,7 +2423,6 @@ void ApplicationManagerImpl::SendOnSDLClose() {
hmi_handler_->SendMessageToHMI(message_to_send);
}
-
void ApplicationManagerImpl::UnregisterAllApplications() {
LOG4CXX_DEBUG(logger_, "Unregister reason " << unregister_reason_);
@@ -2214,38 +2434,29 @@ void ApplicationManagerImpl::UnregisterAllApplications() {
is_ignition_off =
Compare<eType, EQ, ONE>(unregister_reason_, IGNITION_OFF, INVALID_ENUM);
- bool is_unexpected_disconnect =
- Compare<eType, NEQ, ALL>(unregister_reason_,
- IGNITION_OFF, MASTER_RESET, FACTORY_DEFAULTS);
+ bool is_unexpected_disconnect = Compare<eType, NEQ, ALL>(
+ unregister_reason_, IGNITION_OFF, MASTER_RESET, FACTORY_DEFAULTS);
ClearTTSGlobalPropertiesList();
{ // A local scope to limit accessor's lifetime and release app list lock.
- ApplicationListAccessor accessor;
- ApplictionSetConstIt it = accessor.begin();
- while (it != accessor.end()) {
- ApplicationSharedPtr app_to_remove = *it;
-
-#ifdef CUSTOMER_PASA
- if (!is_ignition_off) {
-#endif // CUSTOMER_PASA
+ ApplicationListAccessor accessor;
+ ApplicationSetConstIt it = accessor.begin();
+ while (it != accessor.end()) {
+ ApplicationSharedPtr app_to_remove = *it;
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- app_to_remove->app_id(), unregister_reason_);
-#ifdef CUSTOMER_PASA
+ app_to_remove->app_id(), unregister_reason_);
+ UnregisterApplication(app_to_remove->app_id(),
+ mobile_apis::Result::INVALID_ENUM,
+ is_ignition_off,
+ is_unexpected_disconnect);
+ connection_handler().CloseSession(app_to_remove->app_id(),
+ connection_handler::kCommon);
+ it = accessor.begin();
}
-#endif // CUSTOMER_PASA
-
- UnregisterApplication(app_to_remove->app_id(),
- mobile_apis::Result::INVALID_ENUM, is_ignition_off,
- is_unexpected_disconnect);
- connection_handler_->CloseSession(app_to_remove->app_id(),
- connection_handler::kCommon);
- it = accessor.begin();
- }
}
-
- if (is_ignition_off) { // Move this block before unregistering apps?
- resume_controller().Suspend();
+ if (is_ignition_off) {
+ resume_controller().OnSuspend();
}
request_ctrl_.terminateAllHMIRequests();
}
@@ -2254,50 +2465,63 @@ void ApplicationManagerImpl::RemoveAppsWaitingForRegistration(
const connection_handler::DeviceHandle handle) {
DevicePredicate device_finder(handle);
apps_to_register_list_lock_.Acquire();
- AppsWaitRegistrationSet::iterator it_app =
- std::find_if(apps_to_register_.begin(), apps_to_register_.end(),
- device_finder);
+ AppsWaitRegistrationSet::iterator it_app = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), device_finder);
- while (apps_to_register_.end()!= it_app) {
- LOG4CXX_DEBUG(logger_, "Waiting app: " << (*it_app)->name()
- << " is removed.");
+ while (apps_to_register_.end() != it_app) {
+ LOG4CXX_DEBUG(logger_,
+ "Waiting app: " << (*it_app)->name().c_str() << " is removed.");
apps_to_register_.erase(it_app);
- it_app = std::find_if(apps_to_register_.begin(),
- apps_to_register_.end(),
- device_finder);
+ it_app = std::find_if(
+ apps_to_register_.begin(), apps_to_register_.end(), device_finder);
}
apps_to_register_list_lock_.Release();
}
void ApplicationManagerImpl::UnregisterApplication(
- const uint32_t& app_id, mobile_apis::Result::eType reason,
- bool is_resuming, bool is_unexpected_disconnect) {
- LOG4CXX_INFO(logger_, "app_id = " << app_id
- << "; reason = " << reason
- << "; is_resuming = " << is_resuming
- << "; is_unexpected_disconnect = " << is_unexpected_disconnect);
-
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ const uint32_t& app_id,
+ mobile_apis::Result::eType reason,
+ bool is_resuming,
+ bool is_unexpected_disconnect) {
+ LOG4CXX_DEBUG(logger_,
+ "app_id = " << app_id << "; reason = " << reason
+ << "; is_resuming = "
+ << is_resuming
+ << "; is_unexpected_disconnect = "
+ << is_unexpected_disconnect);
+
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
navi_service_status_.erase(it);
}
- //remove appID from tts_global_properties_app_list_
+ // remove appID from tts_global_properties_app_list_
RemoveAppFromTTSGlobalPropertiesList(app_id);
switch (reason) {
- case mobile_apis::Result::SUCCESS:break;
- case mobile_apis::Result::DISALLOWED: break;
- case mobile_apis::Result::USER_DISALLOWED:break;
- case mobile_apis::Result::INVALID_CERT: break;
- case mobile_apis::Result::EXPIRED_CERT: break;
+ case mobile_apis::Result::SUCCESS:
+ break;
+ case mobile_apis::Result::DISALLOWED:
+ break;
+ case mobile_apis::Result::USER_DISALLOWED:
+ break;
+ case mobile_apis::Result::INVALID_CERT:
+ break;
+ case mobile_apis::Result::EXPIRED_CERT:
+ break;
case mobile_apis::Result::TOO_MANY_PENDING_REQUESTS: {
- ApplicationSharedPtr app_ptr = application(app_id);
- if(app_ptr) {
- app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ ApplicationSharedPtr app_ptr = application(app_id);
+ if (app_ptr) {
+ app_ptr->usage_report().RecordRemovalsForBadBehavior();
+ if (reason == mobile_apis::Result::TOO_MANY_PENDING_REQUESTS) {
+ LOG4CXX_DEBUG(
+ logger_,
+ "INSERT: " << GetHashedAppID(app_id, app_ptr->mobile_app_id()));
+ forbidden_applications.insert(
+ GetHashedAppID(app_id, app_ptr->mobile_app_id()));
}
+ }
break;
}
default: {
@@ -2305,12 +2529,11 @@ void ApplicationManagerImpl::UnregisterApplication(
break;
}
}
-
ApplicationSharedPtr app_to_remove;
connection_handler::DeviceHandle handle = 0;
{
ApplicationListAccessor accessor;
- ApplictionSetConstIt it = accessor.begin();
+ ApplicationSetConstIt it = accessor.begin();
for (; it != accessor.end(); ++it) {
if ((*it)->app_id() == app_id) {
app_to_remove = *it;
@@ -2320,15 +2543,20 @@ void ApplicationManagerImpl::UnregisterApplication(
}
if (!app_to_remove) {
LOG4CXX_ERROR(logger_, "Cant find application with app_id = " << app_id);
+
+ // Just to terminate RAI in case of connection is dropped (rare case)
+ // App won't be unregistered since RAI has not been started yet
+ LOG4CXX_DEBUG(logger_, "Trying to terminate possible RAI request.");
+ request_ctrl_.terminateAppRequests(app_id);
+
return;
}
accessor.Erase(app_to_remove);
-
AppV4DevicePredicate finder(handle);
ApplicationSharedPtr app = accessor.Find(finder);
if (!app) {
- LOG4CXX_DEBUG(logger_, "There is no more SDL4 apps with device handle: "
- << handle);
+ LOG4CXX_DEBUG(
+ logger_, "There is no more SDL4 apps with device handle: " << handle);
RemoveAppsWaitingForRegistration(handle);
SendUpdateAppList();
@@ -2336,9 +2564,9 @@ void ApplicationManagerImpl::UnregisterApplication(
}
if (is_resuming) {
- resume_ctrl_.SaveApplication(app_to_remove);
+ resume_ctrl_.SaveApplication(app_to_remove);
} else {
- resume_ctrl_.RemoveApplicationFromSaved(app_to_remove->mobile_app_id());
+ resume_ctrl_.RemoveApplicationFromSaved(app_to_remove);
}
if (audio_pass_thru_active_) {
@@ -2347,25 +2575,25 @@ void ApplicationManagerImpl::UnregisterApplication(
StopAudioPassThru(app_id);
MessageHelper::SendStopAudioPathThru();
}
+
MessageHelper::SendOnAppUnregNotificationToHMI(app_to_remove,
is_unexpected_disconnect);
-
request_ctrl_.terminateAppRequests(app_id);
return;
}
void ApplicationManagerImpl::OnAppUnauthorized(const uint32_t& app_id) {
- connection_handler_->CloseSession(app_id, connection_handler::kUnauthorizedApp);
+ connection_handler().CloseSession(app_id,
+ connection_handler::kUnauthorizedApp);
}
void ApplicationManagerImpl::Handle(const impl::MessageFromMobile message) {
- LOG4CXX_INFO(logger_, "Received message from Mobile side");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
return;
}
-
sync_primitives::AutoLock lock(stopping_flag_lock_);
if (is_stopping_) {
LOG4CXX_INFO(logger_, "Application manager is stopping");
@@ -2382,7 +2610,7 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) {
}
utils::SharedPtr<protocol_handler::RawMessage> rawMessage =
- MobileMessageHandler::HandleOutgoingMessageProtocol(message);
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message);
if (!rawMessage) {
LOG4CXX_ERROR(logger_, "Failed to create raw message.");
@@ -2392,7 +2620,8 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) {
bool is_final = message.is_final;
bool close_session = false;
if (is_final) {
- if (1 < connection_handler_->GetConnectionSessionsCount(message->connection_key())) {
+ if (1 < connection_handler().GetConnectionSessionsCount(
+ message->connection_key())) {
is_final = false;
close_session = true;
}
@@ -2402,13 +2631,13 @@ void ApplicationManagerImpl::Handle(const impl::MessageToMobile message) {
LOG4CXX_INFO(logger_, "Message for mobile given away");
if (close_session) {
- connection_handler_->CloseSession(message->connection_key(),
+ connection_handler().CloseSession(message->connection_key(),
connection_handler::kCommon);
}
}
void ApplicationManagerImpl::Handle(const impl::MessageFromHmi message) {
- LOG4CXX_INFO(logger_, "Received message from hmi");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_ERROR(logger_, "Null-pointer message received.");
@@ -2419,26 +2648,27 @@ void ApplicationManagerImpl::Handle(const impl::MessageFromHmi message) {
}
void ApplicationManagerImpl::Handle(const impl::MessageToHmi message) {
- LOG4CXX_INFO(logger_, "Received message to hmi");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!hmi_handler_) {
LOG4CXX_ERROR(logger_, "Observer is not set for HMIMessageHandler");
return;
}
hmi_handler_->SendMessageToHMI(message);
- LOG4CXX_INFO(logger_, "Message to hmi given away.");
+ LOG4CXX_INFO(logger_, "Message for HMI given away");
}
void ApplicationManagerImpl::Handle(const impl::AudioData message) {
- LOG4CXX_INFO(logger_, "Send AudioPassThru notification");
- smart_objects::SmartObjectSPtr on_audio_pass = new smart_objects::SmartObject();
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr on_audio_pass =
+ new smart_objects::SmartObject();
if (!on_audio_pass) {
- LOG4CXX_ERROR_EXT(logger_, "OnAudioPassThru NULL pointer");
+ LOG4CXX_ERROR(logger_, "OnAudioPassThru NULL pointer");
return;
}
- LOG4CXX_INFO_EXT(logger_, "Fill smart object");
+ LOG4CXX_DEBUG(logger_, "Fill smart object");
(*on_audio_pass)[strings::params][strings::message_type] =
application_manager::MessageType::kNotification;
@@ -2448,20 +2678,18 @@ void ApplicationManagerImpl::Handle(const impl::AudioData message) {
(*on_audio_pass)[strings::params][strings::function_id] =
mobile_apis::FunctionID::OnAudioPassThruID;
- LOG4CXX_INFO_EXT(logger_, "Fill binary data");
+ LOG4CXX_DEBUG(logger_, "Fill binary data");
// binary data
(*on_audio_pass)[strings::params][strings::binary_data] =
smart_objects::SmartObject(message.binary_data);
- LOG4CXX_INFO_EXT(logger_, "After fill binary data");
+ LOG4CXX_DEBUG(logger_, "Send data");
+ CommandSharedPtr command(MobileCommandFactory::CreateCommand(
+ on_audio_pass, commands::Command::ORIGIN_SDL));
- LOG4CXX_INFO_EXT(logger_, "Send data");
- CommandSharedPtr command (
- MobileCommandFactory::CreateCommand(on_audio_pass,
- commands::Command::ORIGIN_SDL));
- command->Init();
- command->Run();
- command->CleanUp();
+ command->Init();
+ command->Run();
+ command->CleanUp();
}
mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
@@ -2470,7 +2698,7 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
mobile_apis::FunctionID::eType function_id,
const RPCParams& rpc_params,
CommandParametersPermissions* params_permissions) {
- LOG4CXX_INFO(logger_, "CheckPolicyPermissions");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(AOleynik): Remove check of policy_enable, when this flag will be
// unused in config file
if (!policy::PolicyHandler::instance()->PolicyEnabled()) {
@@ -2481,27 +2709,26 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
MessageHelper::StringifiedFunctionID(function_id);
const std::string stringified_hmi_level =
MessageHelper::StringifiedHMILevel(hmi_level);
- LOG4CXX_INFO(
- logger_,
- "Checking permissions for " << policy_app_id <<
- " in " << stringified_hmi_level <<
- " rpc " << stringified_functionID);
- policy::CheckPermissionResult result;
- policy::PolicyHandler::instance()->CheckPermissions(
- policy_app_id,
- stringified_hmi_level,
- stringified_functionID,
- rpc_params,
- result);
+ LOG4CXX_DEBUG(logger_,
+ "Checking permissions for " << policy_app_id << " in "
+ << stringified_hmi_level
+ << " rpc "
+ << stringified_functionID);
+ policy::CheckPermissionResult result;
+ policy::PolicyHandler::instance()->CheckPermissions(policy_app_id,
+ stringified_hmi_level,
+ stringified_functionID,
+ rpc_params,
+ result);
if (NULL != params_permissions) {
- params_permissions->allowed_params = result.list_of_allowed_params;
- params_permissions->disallowed_params = result.list_of_disallowed_params;
- params_permissions->undefined_params = result.list_of_undefined_params;
+ params_permissions->allowed_params = result.list_of_allowed_params;
+ params_permissions->disallowed_params = result.list_of_disallowed_params;
+ params_permissions->undefined_params = result.list_of_undefined_params;
}
- if (hmi_level == mobile_apis::HMILevel::HMI_NONE
- && function_id != mobile_apis::FunctionID::UnregisterAppInterfaceID) {
+ if (hmi_level == mobile_apis::HMILevel::HMI_NONE &&
+ function_id != mobile_apis::FunctionID::UnregisterAppInterfaceID) {
ApplicationSharedPtr app = application_by_policy_id(policy_app_id);
if (!app) {
LOG4CXX_ERROR(logger_, "No application for policy id " << policy_app_id);
@@ -2512,12 +2739,12 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
}
}
- const std::string log_msg = "Application: "+ policy_app_id+
- ", RPC: "+stringified_functionID+
- ", HMI status: "+stringified_hmi_level;
+ const std::string log_msg = "Application: " + policy_app_id + ", RPC: " +
+ stringified_functionID + ", HMI status: " +
+ stringified_hmi_level;
if (result.hmi_level_permitted != policy::kRpcAllowed) {
- LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg );
+ LOG4CXX_WARN(logger_, "Request is blocked by policies. " << log_msg);
ApplicationSharedPtr app = application_by_policy_id(policy_app_id);
if (!app) {
@@ -2535,15 +2762,14 @@ mobile_apis::Result::eType ApplicationManagerImpl::CheckPolicyPermissions(
return mobile_apis::Result::INVALID_ENUM;
}
}
- LOG4CXX_INFO(logger_, "Request is allowed by policies. "+log_msg);
+ LOG4CXX_DEBUG(logger_, "Request is allowed by policies. " << log_msg);
return mobile_api::Result::SUCCESS;
}
-
-void ApplicationManagerImpl::OnLowVoltage() {
- LOG4CXX_AUTO_TRACE(logger_);
- is_low_voltage_ = true;
- request_ctrl_.OnLowVoltage();
+void ApplicationManagerImpl::OnLowVoltage() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_low_voltage_ = true;
+ request_ctrl_.OnLowVoltage();
}
bool ApplicationManagerImpl::IsLowVoltage() {
@@ -2551,6 +2777,21 @@ bool ApplicationManagerImpl::IsLowVoltage() {
return is_low_voltage_;
}
+std::string ApplicationManagerImpl::GetHashedAppID(
+ uint32_t connection_key, const std::string& mobile_app_id) {
+ uint32_t device_id = 0;
+ connection_handler().GetDataOnSessionKey(
+ connection_key, 0, NULL, &device_id);
+ std::string device_name;
+ connection_handler().get_session_observer().GetDataOnDeviceID(device_id,
+ &device_name,
+ NULL,
+ NULL,
+ NULL);
+
+ return mobile_app_id + device_name;
+}
+
bool ApplicationManagerImpl::HMILevelAllowsStreaming(
uint32_t app_id, protocol_handler::ServiceType service_type) const {
LOG4CXX_AUTO_TRACE(logger_);
@@ -2562,8 +2803,7 @@ bool ApplicationManagerImpl::HMILevelAllowsStreaming(
LOG4CXX_WARN(logger_, "An application is not registered.");
return false;
}
- return Compare<eType, EQ, ONE>(
- app->hmi_level(), HMI_FULL, HMI_LIMITED);
+ return Compare<eType, EQ, ONE>(app->hmi_level(), HMI_FULL, HMI_LIMITED);
}
bool ApplicationManagerImpl::CanAppStream(
@@ -2585,7 +2825,8 @@ bool ApplicationManagerImpl::CanAppStream(
} else {
LOG4CXX_WARN(logger_, "Unsupported service_type " << service_type);
}
- return HMILevelAllowsStreaming(app_id, service_type) && is_allowed;
+
+ return HMILevelAllowsStreaming(app_id, service_type) && is_allowed;
}
void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
@@ -2601,14 +2842,16 @@ void ApplicationManagerImpl::ForbidStreaming(uint32_t app_id) {
}
if (navi_app_to_stop_.end() != std::find(navi_app_to_stop_.begin(),
- navi_app_to_stop_.end(), app_id) ||
- navi_app_to_end_stream_.end() != std::find(navi_app_to_end_stream_.begin(),
- navi_app_to_end_stream_.end(), app_id)) {
+ navi_app_to_stop_.end(),
+ app_id) ||
+ navi_app_to_end_stream_.end() !=
+ std::find(navi_app_to_end_stream_.begin(),
+ navi_app_to_end_stream_.end(),
+ app_id)) {
return;
}
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it ||
(!it->second.first && !it->second.second)) {
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
@@ -2650,43 +2893,48 @@ void ApplicationManagerImpl::EndNaviServices(uint32_t app_id) {
return;
}
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() == it) {
+ LOG4CXX_ERROR(logger_, "No info about navi servicies for app");
return;
}
if (connection_handler_) {
if (it->second.first) {
LOG4CXX_DEBUG(logger_, "Going to end video service");
- connection_handler_->SendEndService(app_id, ServiceType::kMobileNav);
- app->set_video_streaming_approved(false);
- app->set_video_streaming_allowed(false);
+ connection_handler().SendEndService(app_id, ServiceType::kMobileNav);
+ app->StopStreamingForce(ServiceType::kMobileNav);
}
if (it->second.second) {
LOG4CXX_DEBUG(logger_, "Going to end audio service");
- connection_handler_->SendEndService(app_id, ServiceType::kAudio);
- app->set_audio_streaming_approved(false);
- app->set_audio_streaming_allowed(false);
+ connection_handler().SendEndService(app_id, ServiceType::kAudio);
+ app->StopStreamingForce(ServiceType::kAudio);
}
+ DisallowStreaming(app_id);
+
navi_app_to_stop_.push_back(app_id);
- ApplicationManagerTimerPtr closeTimer(new TimerThread<ApplicationManagerImpl>(
- "CloseAppTimer", this, &ApplicationManagerImpl::CloseNaviApp));
- closeTimer->start(navi_close_app_timeout_);
+ TimerSPtr close_timer(utils::MakeShared<timer::Timer>(
+ "CloseNaviAppTimer",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this,
+ &ApplicationManagerImpl::CloseNaviApp)));
+ close_timer->Start(navi_close_app_timeout_, false);
sync_primitives::AutoLock lock(timer_pool_lock_);
- timer_pool_.push_back(closeTimer);
+ timer_pool_.push_back(close_timer);
}
}
void ApplicationManagerImpl::OnHMILevelChanged(uint32_t app_id,
mobile_apis::HMILevel::eType from,
mobile_apis::HMILevel::eType to) {
+ LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis::HMILevel;
using namespace helpers;
if (from == to) {
+ LOG4CXX_TRACE(logger_, "HMILevel from = to");
return;
}
@@ -2697,38 +2945,75 @@ void ApplicationManagerImpl::OnHMILevelChanged(uint32_t app_id,
}
if (to == HMI_FULL || to == HMI_LIMITED) {
+ LOG4CXX_TRACE(logger_, "HMILevel to FULL or LIMITED");
if (from == HMI_BACKGROUND) {
+ LOG4CXX_TRACE(logger_, "HMILevel from BACKGROUND");
AllowStreaming(app_id);
}
} else if (to == HMI_BACKGROUND) {
+ LOG4CXX_TRACE(logger_, "HMILevel to BACKGROUND");
if (from == HMI_FULL || from == HMI_LIMITED) {
+ LOG4CXX_TRACE(logger_, "HMILevel from FULL or LIMITED");
navi_app_to_end_stream_.push_back(app_id);
- ApplicationManagerTimerPtr endStreamTimer(new TimerThread<ApplicationManagerImpl>(
- "EndStreamTimer", this, &ApplicationManagerImpl::EndNaviStreaming));
- endStreamTimer->start(navi_end_stream_timeout_);
+ TimerSPtr end_stream_timer(utils::MakeShared<timer::Timer>(
+ "AppShouldFinishStreaming",
+ new TimerTaskImpl<ApplicationManagerImpl>(
+ this,
+ &ApplicationManagerImpl::EndNaviStreaming)
+ ));
+ end_stream_timer->Start(navi_end_stream_timeout_, false);
sync_primitives::AutoLock lock(timer_pool_lock_);
- timer_pool_.push_back(endStreamTimer);
+ timer_pool_.push_back(end_stream_timer);
}
} else if (to == HMI_NONE) {
- if (from == HMI_FULL || from == HMI_LIMITED ||
- from == HMI_BACKGROUND) {
+ LOG4CXX_TRACE(logger_, "HMILevel to NONE");
+ if (from == HMI_FULL || from == HMI_LIMITED || from == HMI_BACKGROUND) {
EndNaviServices(app_id);
}
}
}
+void ApplicationManagerImpl::SendHMIStatusNotification(
+ const ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(app);
+ smart_objects::SmartObjectSPtr notification =
+ utils::MakeShared<smart_objects::SmartObject>();
+ smart_objects::SmartObject& message = *notification;
+
+ message[strings::params][strings::function_id] =
+ static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID);
+
+ message[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+
+ message[strings::params][strings::connection_key] =
+ static_cast<int32_t>(app->app_id());
+
+ message[strings::msg_params][strings::hmi_level] =
+ static_cast<int32_t>(app->hmi_level());
+
+ message[strings::msg_params][strings::audio_streaming_state] =
+ static_cast<int32_t>(app->audio_streaming_state());
+
+ message[strings::msg_params][strings::system_context] =
+ static_cast<int32_t>(app->system_context());
+
+ ManageMobileCommand(notification, commands::Command::ORIGIN_SDL);
+}
+
void ApplicationManagerImpl::ClearTimerPool() {
LOG4CXX_AUTO_TRACE(logger_);
- std::vector<ApplicationManagerTimerPtr> new_timer_pool;
+ std::vector<TimerSPtr> new_timer_pool;
sync_primitives::AutoLock lock(timer_pool_lock_);
new_timer_pool.push_back(timer_pool_[0]);
- for (size_t i = 1; i < timer_pool_.size(); i++) {
- if (timer_pool_[i]->isRunning()) {
+ for (size_t i = 1; i < timer_pool_.size(); ++i) {
+ if (timer_pool_[i]->IsRunning()) {
new_timer_pool.push_back(timer_pool_[i]);
}
}
@@ -2745,10 +3030,10 @@ void ApplicationManagerImpl::CloseNaviApp() {
uint32_t app_id = navi_app_to_stop_.front();
navi_app_to_stop_.pop_front();
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
if (it->second.first || it->second.second) {
+ LOG4CXX_INFO(logger_, "App haven't answered for EndService. Unregister it.");
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
app_id, PROTOCOL_VIOLATION);
UnregisterApplication(app_id, ABORTED);
@@ -2764,8 +3049,8 @@ void ApplicationManagerImpl::EndNaviStreaming() {
uint32_t app_id = navi_app_to_end_stream_.front();
navi_app_to_end_stream_.pop_front();
- if (navi_app_to_stop_.end() == std::find(navi_app_to_stop_.begin(),
- navi_app_to_stop_.end(), app_id)) {
+ if (navi_app_to_stop_.end() ==
+ std::find(navi_app_to_stop_.begin(), navi_app_to_stop_.end(), app_id)) {
DisallowStreaming(app_id);
}
}
@@ -2780,8 +3065,7 @@ void ApplicationManagerImpl::DisallowStreaming(uint32_t app_id) {
return;
}
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
if (it->second.first) {
app->set_video_streaming_allowed(false);
@@ -2802,8 +3086,7 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) {
return;
}
- NaviServiceStatusMap::iterator it =
- navi_service_status_.find(app_id);
+ NaviServiceStatusMap::iterator it = navi_service_status_.find(app_id);
if (navi_service_status_.end() != it) {
if (it->second.first) {
app->set_video_streaming_allowed(true);
@@ -2814,18 +3097,26 @@ void ApplicationManagerImpl::AllowStreaming(uint32_t app_id) {
}
}
+bool ApplicationManagerImpl::IsApplicationForbidden(
+ uint32_t connection_key, const std::string& mobile_app_id) {
+ const std::string name = GetHashedAppID(connection_key, mobile_app_id);
+ return forbidden_applications.find(name) != forbidden_applications.end();
+}
void ApplicationManagerImpl::OnWakeUp() {
- LOG4CXX_AUTO_TRACE(logger_);
- is_low_voltage_ = false;
- request_ctrl_.OnWakeUp();
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_low_voltage_ = false;
+ request_ctrl_.OnWakeUp();
}
mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
- const std::vector<uint8_t>& binary_data, const std::string& file_path,
- const std::string& file_name, const int64_t offset) {
- LOG4CXX_INFO(logger_,
- "SaveBinaryWithOffset binary_size = " << binary_data.size()
- << " offset = " << offset);
+ const std::vector<uint8_t>& binary_data,
+ const std::string& file_path,
+ const std::string& file_name,
+ const int64_t offset) {
+ LOG4CXX_DEBUG(logger_,
+ "SaveBinaryWithOffset binary_size = " << binary_data.size()
+ << " offset = "
+ << offset);
if (binary_data.size() > file_system::GetAvailableDiskSpace(file_path)) {
LOG4CXX_ERROR(logger_, "Out of free disc space.");
@@ -2837,36 +3128,40 @@ mobile_apis::Result::eType ApplicationManagerImpl::SaveBinary(
std::ofstream* file_stream;
if (offset != 0) {
if (file_size != offset) {
- LOG4CXX_INFO(logger_,
- "ApplicationManagerImpl::SaveBinaryWithOffset offset"
- << " does'n match existing file size");
+ LOG4CXX_DEBUG(logger_,
+ "ApplicationManagerImpl::SaveBinaryWithOffset offset"
+ << " does'n match existing file size");
return mobile_apis::Result::INVALID_DATA;
}
file_stream = file_system::Open(full_file_path, std::ios_base::app);
} else {
- LOG4CXX_INFO(
- logger_,
- "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite");
+ LOG4CXX_DEBUG(
+ logger_,
+ "ApplicationManagerImpl::SaveBinaryWithOffset offset is 0, rewrite");
// if offset == 0: rewrite file
file_stream = file_system::Open(full_file_path, std::ios_base::out);
}
- if (!file_system::Write(file_stream, binary_data.data(),
- binary_data.size())) {
+ if (!file_system::Write(
+ file_stream, binary_data.data(), binary_data.size())) {
file_system::Close(file_stream);
+ delete file_stream;
+ file_stream = NULL;
return mobile_apis::Result::GENERIC_ERROR;
}
file_system::Close(file_stream);
+ delete file_stream;
+ file_stream = NULL;
LOG4CXX_INFO(logger_, "Successfully write data to file");
return mobile_apis::Result::SUCCESS;
}
uint32_t ApplicationManagerImpl::GetAvailableSpaceForApp(
- const std::string& folder_name) {
+ const std::string& folder_name) {
const uint32_t app_quota = profile::Profile::instance()->app_dir_quota();
std::string app_storage_path =
- profile::Profile::instance()->app_storage_folder();
+ profile::Profile::instance()->app_storage_folder();
app_storage_path += "/";
app_storage_path += folder_name;
@@ -2879,7 +3174,7 @@ uint32_t ApplicationManagerImpl::GetAvailableSpaceForApp(
uint32_t current_app_quota = app_quota - size_of_directory;
uint32_t available_disk_space =
- file_system::GetAvailableDiskSpace(app_storage_path);
+ file_system::GetAvailableDiskSpace(app_storage_path);
if (current_app_quota > available_disk_space) {
return available_disk_space;
@@ -2920,7 +3215,8 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
}
if (!app_list.empty()) {
for (uint32_t i = 0; i < app_list.size(); ++i) {
- LOG4CXX_INFO(logger_, "Send TTS GlobalProperties to HMI with default helpPrompt");
+ LOG4CXX_INFO(logger_,
+ "Send TTS GlobalProperties to HMI with default helpPrompt");
MessageHelper::SendTTSGlobalProperties(application(app_list[i]), true);
RemoveAppFromTTSGlobalPropertiesList(app_list[i]);
}
@@ -2930,7 +3226,8 @@ void ApplicationManagerImpl::OnTimerSendTTSGlobalProperties() {
void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- uint16_t timeout = profile::Profile::instance()->tts_global_properties_timeout();
+ uint16_t timeout =
+ profile::Profile::instance()->tts_global_properties_timeout();
TimevalStruct current_time = date_time::DateTime::getCurrentTime();
current_time.tv_sec += timeout;
// please avoid AutoLock usage to avoid deadlock
@@ -2939,11 +3236,12 @@ void ApplicationManagerImpl::AddAppToTTSGlobalPropertiesList(
tts_global_properties_app_list_.find(app_id)) {
tts_global_properties_app_list_[app_id] = current_time;
}
- //if add first item need to start timer on one second
+ // if add first item need to start timer on one second
if (1 == tts_global_properties_app_list_.size()) {
LOG4CXX_INFO(logger_, "Start tts_global_properties_timer_");
tts_global_properties_app_list_lock_.Release();
- tts_global_properties_timer_.start(1);
+ const uint32_t timeout_ms = 1000;
+ tts_global_properties_timer_.Start(timeout_ms, true);
return;
}
tts_global_properties_app_list_lock_.Release();
@@ -2962,14 +3260,15 @@ void ApplicationManagerImpl::RemoveAppFromTTSGlobalPropertiesList(
LOG4CXX_INFO(logger_, "Stop tts_global_properties_timer_");
// if container is empty need to stop timer
tts_global_properties_app_list_lock_.Release();
- tts_global_properties_timer_.suspend();
+ tts_global_properties_timer_.Stop();
return;
}
}
tts_global_properties_app_list_lock_.Release();
}
-mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType(std::string str) {
+mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType(
+ std::string str) {
LOG4CXX_AUTO_TRACE(logger_);
if ("DEFAULT" == str) {
return mobile_apis::AppHMIType::DEFAULT;
@@ -2996,21 +3295,22 @@ mobile_apis::AppHMIType::eType ApplicationManagerImpl::StringToAppHMIType(std::s
}
}
-bool ApplicationManagerImpl::CompareAppHMIType (const smart_objects::SmartObject& from_policy,
- const smart_objects::SmartObject& from_application) {
+bool ApplicationManagerImpl::CompareAppHMIType(
+ const smart_objects::SmartObject& from_policy,
+ const smart_objects::SmartObject& from_application) {
LOG4CXX_AUTO_TRACE(logger_);
bool equal = false;
uint32_t lenght_policy_app_types = from_policy.length();
uint32_t lenght_application_app_types = from_application.length();
- for(uint32_t i = 0; i < lenght_application_app_types; ++i) {
- for(uint32_t k = 0; k < lenght_policy_app_types; ++k) {
+ for (uint32_t i = 0; i < lenght_application_app_types; ++i) {
+ for (uint32_t k = 0; k < lenght_policy_app_types; ++k) {
if (from_application[i] == from_policy[k]) {
equal = true;
break;
}
}
- if(!equal) {
+ if (!equal) {
return false;
}
equal = false;
@@ -3019,58 +3319,57 @@ bool ApplicationManagerImpl::CompareAppHMIType (const smart_objects::SmartObject
}
void ApplicationManagerImpl::OnUpdateHMIAppType(
- std::map<std::string, std::vector<std::string> > app_hmi_types) {
+ std::map<std::string, std::vector<std::string>> app_hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
- std::map<std::string, std::vector<std::string> >::iterator it_app_hmi_types_from_policy;
+ std::map<std::string, std::vector<std::string>>::iterator
+ it_app_hmi_types_from_policy;
std::vector<std::string> hmi_types_from_policy;
- smart_objects::SmartObject transform_app_hmi_types(smart_objects::SmartType_Array);
+ smart_objects::SmartObject transform_app_hmi_types(
+ smart_objects::SmartType_Array);
bool flag_diffirence_app_hmi_type = false;
ApplicationListAccessor accessor;
- for (ApplictionSetIt it = accessor.begin();
- it != accessor.end(); ++it) {
-
- it_app_hmi_types_from_policy =
- app_hmi_types.find(((*it)->mobile_app_id()));
+ for (ApplicationSetIt it = accessor.begin(); it != accessor.end(); ++it) {
+ it_app_hmi_types_from_policy = app_hmi_types.find(((*it)->mobile_app_id()));
if (it_app_hmi_types_from_policy != app_hmi_types.end() &&
((it_app_hmi_types_from_policy->second).size())) {
flag_diffirence_app_hmi_type = false;
hmi_types_from_policy = (it_app_hmi_types_from_policy->second);
- if(transform_app_hmi_types.length()) {
+ if (transform_app_hmi_types.length()) {
transform_app_hmi_types =
smart_objects::SmartObject(smart_objects::SmartType_Array);
}
- for(uint32_t i = 0; i < hmi_types_from_policy.size(); ++i) {
- transform_app_hmi_types[i] = StringToAppHMIType(hmi_types_from_policy[i]);
+ for (uint32_t i = 0; i < hmi_types_from_policy.size(); ++i) {
+ transform_app_hmi_types[i] =
+ StringToAppHMIType(hmi_types_from_policy[i]);
}
ApplicationConstSharedPtr app = *it;
- const smart_objects::SmartObject* save_application_hmi_type = app->app_types();
+ const smart_objects::SmartObject* save_application_hmi_type =
+ app->app_types();
if (save_application_hmi_type == NULL ||
- ((*save_application_hmi_type).length() != transform_app_hmi_types.length())) {
+ ((*save_application_hmi_type).length() !=
+ transform_app_hmi_types.length())) {
flag_diffirence_app_hmi_type = true;
} else {
- flag_diffirence_app_hmi_type = !(CompareAppHMIType(transform_app_hmi_types,
- *save_application_hmi_type));
+ flag_diffirence_app_hmi_type = !(CompareAppHMIType(
+ transform_app_hmi_types, *save_application_hmi_type));
}
if (flag_diffirence_app_hmi_type) {
(*it)->set_app_types(transform_app_hmi_types);
(*it)->ChangeSupportingAppHMIType();
if ((*it)->hmi_level() == mobile_api::HMILevel::HMI_BACKGROUND) {
-
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it);
} else if (((*it)->hmi_level() == mobile_api::HMILevel::HMI_FULL) ||
- ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
-
+ ((*it)->hmi_level() == mobile_api::HMILevel::HMI_LIMITED)) {
MessageHelper::SendUIChangeRegistrationRequestToHMI(*it);
- ApplicationManagerImpl::instance()->SetState<true>((*it)->app_id(),
- mobile_apis::HMILevel::HMI_BACKGROUND
- );
+ ApplicationManagerImpl::instance()->SetState<true>(
+ (*it)->app_id(), mobile_apis::HMILevel::HMI_BACKGROUND);
}
}
}
@@ -3079,20 +3378,21 @@ void ApplicationManagerImpl::OnUpdateHMIAppType(
ProtocolVersion ApplicationManagerImpl::SupportedSDLVersion() const {
LOG4CXX_AUTO_TRACE(logger_);
- bool heart_beat_support =
- profile::Profile::instance()->heart_beat_timeout();
+ bool heart_beat_support = profile::Profile::instance()->heart_beat_timeout();
bool sdl4_support = profile::Profile::instance()->enable_protocol_4();
if (sdl4_support) {
- LOG4CXX_DEBUG(logger_, "SDL Supported protocol version "<<ProtocolVersion::kV4);
+ LOG4CXX_DEBUG(logger_,
+ "SDL Supported protocol version " << ProtocolVersion::kV4);
return ProtocolVersion::kV4;
}
if (heart_beat_support) {
- LOG4CXX_DEBUG(logger_, "SDL Supported protocol version "<<ProtocolVersion::kV3);
+ LOG4CXX_DEBUG(logger_,
+ "SDL Supported protocol version " << ProtocolVersion::kV3);
return ProtocolVersion::kV3;
}
-
- LOG4CXX_DEBUG(logger_, "SDL Supported protocol version "<<ProtocolVersion::kV2);
+ LOG4CXX_DEBUG(logger_,
+ "SDL Supported protocol version " << ProtocolVersion::kV2);
return ProtocolVersion::kV2;
}
@@ -3106,37 +3406,37 @@ const std::string ApplicationManagerImpl::DirectoryTypeToString(
}
bool ApplicationManagerImpl::InitDirectory(
- const std::string& path,
- ApplicationManagerImpl::DirectoryType type) const {
+ const std::string& path, ApplicationManagerImpl::DirectoryType type) const {
const std::string directory_type = DirectoryTypeToString(type);
if (!file_system::DirectoryExists(path)) {
LOG4CXX_WARN(logger_, directory_type << " directory doesn't exist.");
// if storage directory doesn't exist try to create it
if (!file_system::CreateDirectoryRecursively(path)) {
- LOG4CXX_ERROR(logger_, "Unable to create " << directory_type
- << " directory " << path);
+ LOG4CXX_ERROR(logger_,
+ "Unable to create " << directory_type << " directory "
+ << path);
return false;
}
- LOG4CXX_DEBUG(logger_, directory_type << " directory has been created: "
- << path);
+ LOG4CXX_DEBUG(logger_,
+ directory_type << " directory has been created: " << path);
}
return true;
}
-bool ApplicationManagerImpl::IsReadWriteAllowed(
- const std::string& path,
- DirectoryType type) const {
+bool ApplicationManagerImpl::IsReadWriteAllowed(const std::string& path,
+ DirectoryType type) const {
const std::string directory_type = DirectoryTypeToString(type);
if (!(file_system::IsWritingAllowed(path) &&
file_system::IsReadingAllowed(path))) {
- LOG4CXX_ERROR(logger_, directory_type
- << " directory doesn't have read/write permissions.");
+ LOG4CXX_ERROR(logger_,
+ directory_type
+ << " directory doesn't have read/write permissions.");
return false;
}
- LOG4CXX_DEBUG(logger_, directory_type
- << " directory has read/write permissions.");
+ LOG4CXX_DEBUG(logger_,
+ directory_type << " directory has read/write permissions.");
return true;
}
@@ -3147,7 +3447,6 @@ void ApplicationManagerImpl::ClearTTSGlobalPropertiesList() {
tts_global_properties_app_list_.clear();
}
-ApplicationManagerImpl::ApplicationListAccessor::~ApplicationListAccessor() {
-}
+ApplicationManagerImpl::ApplicationListAccessor::~ApplicationListAccessor() {}
} // namespace application_manager
diff --git a/src/components/application_manager/src/application_state.cc b/src/components/application_manager/src/application_state.cc
new file mode 100644
index 0000000000..101a565a8e
--- /dev/null
+++ b/src/components/application_manager/src/application_state.cc
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/application_state.h"
+#include <algorithm>
+#include "utils/logger.h"
+#include "utils/macro.h"
+
+namespace {
+
+struct StateIDComparator {
+ application_manager::HmiState::StateID state_id_;
+ StateIDComparator(application_manager::HmiState::StateID state_id)
+ : state_id_(state_id) {}
+ bool operator()(const application_manager::HmiStatePtr cur) const {
+ return cur->state_id() == state_id_;
+ }
+};
+}
+
+namespace application_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+
+ApplicationState::ApplicationState() {}
+
+void ApplicationState::InitState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(state);
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ hmi_states_.clear();
+ hmi_states_.push_back(state);
+}
+
+void ApplicationState::AddState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(state);
+ switch (state->state_id()) {
+ case HmiState::StateID::STATE_ID_REGULAR:
+ SetRegularState(state);
+ return;
+ case HmiState::StateID::STATE_ID_POSTPONED:
+ SetPostponedState(state);
+ return;
+ case HmiState::StateID::STATE_ID_CURRENT:
+ LOG4CXX_ERROR(logger_, "State of type '" << state << "' can't be added.");
+ return;
+ default:
+ AddHMIState(state);
+ break;
+ }
+
+ return;
+}
+
+void ApplicationState::RemoveState(HmiState::StateID state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(state);
+ switch (state) {
+ case HmiState::StateID::STATE_ID_CURRENT:
+ case HmiState::StateID::STATE_ID_REGULAR:
+ LOG4CXX_ERROR(logger_,
+ "State of type '" << state << "'can't be removed.");
+ break;
+ case HmiState::StateID::STATE_ID_POSTPONED:
+ RemovePostponedState();
+ break;
+ default:
+ RemoveHMIState(state);
+ break;
+ }
+}
+
+HmiStatePtr ApplicationState::GetState(HmiState::StateID state_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ switch (state_id) {
+ case HmiState::StateID::STATE_ID_REGULAR:
+ LOG4CXX_DEBUG(logger_, "Getting regular state.");
+ return RegularHmiState();
+ case HmiState::StateID::STATE_ID_POSTPONED:
+ LOG4CXX_DEBUG(logger_, "Getting postponed state.");
+ return PostponedHmiState();
+ default:
+ LOG4CXX_DEBUG(logger_, "Getting current state.");
+ return CurrentHmiState();
+ }
+}
+
+void ApplicationState::AddHMIState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(state);
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ HmiStates::iterator it = std::find_if(hmi_states_.begin(),
+ hmi_states_.end(),
+ StateIDComparator(state->state_id()));
+ if (hmi_states_.end() != it) {
+ LOG4CXX_WARN(
+ logger_,
+ "Hmi state with ID "
+ << state->state_id()
+ << "has been already applied to this application. Ignoring");
+ return;
+ }
+
+ hmi_states_.push_back(state);
+}
+
+void ApplicationState::RemoveHMIState(HmiState::StateID state_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ HmiStates::iterator it = std::find_if(
+ hmi_states_.begin(), hmi_states_.end(), StateIDComparator(state_id));
+ if (it == hmi_states_.end()) {
+ LOG4CXX_ERROR(logger_, "Unsuccesful remove HmiState: " << state_id);
+ return;
+ }
+
+ // unable to remove regular state
+ DCHECK_OR_RETURN_VOID(it != hmi_states_.begin());
+ HmiStates::iterator next = it;
+ HmiStates::iterator prev = it;
+ next++;
+ prev--;
+ if (next != hmi_states_.end()) {
+ HmiStatePtr next_state = *next;
+ HmiStatePtr prev_state = *prev;
+ next_state->set_parent(prev_state);
+ }
+ hmi_states_.erase(it);
+}
+
+void ApplicationState::RemovePostponedState() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+
+ StateIDComparator finder(HmiState::StateID::STATE_ID_POSTPONED);
+
+ HmiStates::iterator postponed_state =
+ std::find_if(hmi_states_.begin(), hmi_states_.end(), finder);
+
+ if (hmi_states_.end() == postponed_state) {
+ LOG4CXX_ERROR(logger_, "No postponed state is set for app.");
+ return;
+ }
+ hmi_states_.erase(postponed_state);
+}
+
+void ApplicationState::SetRegularState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(state);
+ DCHECK_OR_RETURN_VOID(state->state_id() ==
+ HmiState::StateID::STATE_ID_REGULAR);
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+
+ HmiStatePtr front_state = hmi_states_.front();
+ HmiState::StateID front_state_id = front_state->state_id();
+ if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
+ // Drop postponed state
+ hmi_states_.erase(hmi_states_.begin());
+ }
+
+ // Drop regular state
+ hmi_states_.erase(hmi_states_.begin());
+
+ if (!hmi_states_.empty()) {
+ HmiStatePtr front_state = hmi_states_.front();
+ front_state->set_parent(state);
+ }
+ hmi_states_.insert(hmi_states_.begin(), state);
+ if (HmiState::StateID::STATE_ID_POSTPONED == front_state_id) {
+ hmi_states_.insert(hmi_states_.begin(), front_state);
+ }
+}
+
+void ApplicationState::SetPostponedState(HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(state);
+ DCHECK_OR_RETURN_VOID(state->state_id() ==
+ HmiState::StateID::STATE_ID_POSTPONED);
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ DCHECK_OR_RETURN_VOID(!hmi_states_.empty());
+ HmiStatePtr front_state = hmi_states_.front();
+ if (front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
+ hmi_states_.erase(hmi_states_.begin());
+ }
+ hmi_states_.insert(hmi_states_.begin(), state);
+}
+
+HmiStatePtr ApplicationState::CurrentHmiState() const {
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
+ HmiStatePtr back_state = hmi_states_.back();
+ DCHECK_OR_RETURN(
+ back_state->state_id() != HmiState::StateID::STATE_ID_POSTPONED,
+ HmiStatePtr());
+ return back_state;
+}
+
+HmiStatePtr ApplicationState::RegularHmiState() const {
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
+ HmiStates::const_iterator front_itr = hmi_states_.begin();
+ if ((*front_itr)->state_id() == HmiState::StateID::STATE_ID_POSTPONED) {
+ ++front_itr;
+ }
+ return *front_itr;
+}
+
+HmiStatePtr ApplicationState::PostponedHmiState() const {
+ sync_primitives::AutoLock auto_lock(hmi_states_lock_);
+ DCHECK_OR_RETURN(!hmi_states_.empty(), HmiStatePtr());
+ HmiStatePtr front_state = hmi_states_.front();
+ return front_state->state_id() == HmiState::StateID::STATE_ID_POSTPONED
+ ? front_state
+ : HmiStatePtr();
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/command_request_impl.cc b/src/components/application_manager/src/commands/command_request_impl.cc
index 544b12a290..b83b646385 100644
--- a/src/components/application_manager/src/commands/command_request_impl.cc
+++ b/src/components/application_manager/src/commands/command_request_impl.cc
@@ -44,9 +44,7 @@ namespace commands {
struct DisallowedParamsInserter {
DisallowedParamsInserter(smart_objects::SmartObject& response,
mobile_apis::VehicleDataResultCode::eType code)
- : response_(response),
- code_(code) {
- }
+ : response_(response), code_(code) {}
bool operator()(const std::string& param) {
const VehicleData& vehicle_data =
@@ -62,18 +60,16 @@ struct DisallowedParamsInserter {
}
return false;
}
-private:
+
+ private:
smart_objects::SmartObject& response_;
mobile_apis::VehicleDataResultCode::eType code_;
};
CommandRequestImpl::CommandRequestImpl(const MessageSharedPtr& message)
- : CommandImpl(message),
- current_state_(kAwaitingHMIResponse) {
-}
+ : CommandImpl(message), current_state_(kAwaitingHMIResponse) {}
-CommandRequestImpl::~CommandRequestImpl() {
-}
+CommandRequestImpl::~CommandRequestImpl() {}
bool CommandRequestImpl::Init() {
return true;
@@ -87,8 +83,7 @@ bool CommandRequestImpl::CleanUp() {
return true;
}
-void CommandRequestImpl::Run() {
-}
+void CommandRequestImpl::Run() {}
void CommandRequestImpl::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -107,19 +102,21 @@ void CommandRequestImpl::onTimeOut() {
}
smart_objects::SmartObjectSPtr response =
- MessageHelper::CreateNegativeResponse(connection_key(), function_id(),
- correlation_id(), mobile_api::Result::GENERIC_ERROR);
+ MessageHelper::CreateNegativeResponse(connection_key(),
+ function_id(),
+ correlation_id(),
+ mobile_api::Result::GENERIC_ERROR);
ApplicationManagerImpl::instance()->ManageMobileCommand(response);
}
-void CommandRequestImpl::on_event(const event_engine::Event& event) {
-}
+void CommandRequestImpl::on_event(const event_engine::Event& event) {}
void CommandRequestImpl::SendResponse(
- const bool success, const mobile_apis::Result::eType& result_code,
- const char* info, const smart_objects::SmartObject* response_params) {
-
+ const bool success,
+ const mobile_apis::Result::eType& result_code,
+ const char* info,
+ const smart_objects::SmartObject* response_params) {
{
sync_primitives::AutoLock auto_lock(state_lock_);
if (kTimedOut == current_state_) {
@@ -154,12 +151,13 @@ void CommandRequestImpl::SendResponse(
response[strings::msg_params][strings::info] = std::string(info);
}
- // Add disallowed parameters and info from request back to response with appropriate
+ // Add disallowed parameters and info from request back to response with
+ // appropriate
// reasons (VehicleData result codes)
if (result_code != mobile_apis::Result::APPLICATION_NOT_REGISTERED) {
const mobile_apis::FunctionID::eType& id =
static_cast<mobile_apis::FunctionID::eType>(function_id());
- if ((id == mobile_apis::FunctionID::SubscribeVehicleDataID) ||
+ if ((id == mobile_apis::FunctionID::SubscribeVehicleDataID) ||
(id == mobile_apis::FunctionID::UnsubscribeVehicleDataID)) {
AddDisallowedParameters(response);
AddDisallowedParametersToInfo(response);
@@ -174,7 +172,8 @@ void CommandRequestImpl::SendResponse(
ApplicationManagerImpl::instance()->ManageMobileCommand(result);
}
-bool CommandRequestImpl::CheckSyntax(std::string str, bool allow_empty_line) {
+bool CommandRequestImpl::CheckSyntax(const std::string& str,
+ bool allow_empty_line) {
if (std::string::npos != str.find_first_of("\t\n")) {
LOG4CXX_ERROR(logger_, "CheckSyntax failed! :" << str);
return false;
@@ -194,14 +193,16 @@ bool CommandRequestImpl::CheckSyntax(std::string str, bool allow_empty_line) {
uint32_t CommandRequestImpl::SendHMIRequest(
const hmi_apis::FunctionID::eType& function_id,
- const smart_objects::SmartObject* msg_params, bool use_events) {
-
+ const smart_objects::SmartObject* msg_params,
+ bool use_events) {
smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
const uint32_t hmi_correlation_id =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
if (use_events) {
- LOG4CXX_DEBUG(logger_, "subscribe_on_event " << function_id << " " << hmi_correlation_id);
+ LOG4CXX_DEBUG(logger_,
+ "subscribe_on_event " << function_id << " "
+ << hmi_correlation_id);
subscribe_on_event(function_id, hmi_correlation_id);
}
@@ -228,7 +229,6 @@ uint32_t CommandRequestImpl::SendHMIRequest(
void CommandRequestImpl::CreateHMINotification(
const hmi_apis::FunctionID::eType& function_id,
const NsSmart::SmartObject& msg_params) const {
-
smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
if (!result) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
@@ -252,7 +252,6 @@ void CommandRequestImpl::CreateHMINotification(
mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
const hmi_apis::Common_Result::eType& hmi_code) const {
-
mobile_apis::Result::eType mobile_result = mobile_apis::Result::GENERIC_ERROR;
switch (hmi_code) {
case hmi_apis::Common_Result::SUCCESS: {
@@ -361,7 +360,7 @@ mobile_apis::Result::eType CommandRequestImpl::GetMobileResultCode(
}
bool CommandRequestImpl::CheckAllowedParameters() {
- LOG4CXX_INFO(logger_, "CheckAllowedParameters");
+ LOG4CXX_AUTO_TRACE(logger_);
// RegisterAppInterface should always be allowed
if (mobile_apis::FunctionID::RegisterAppInterfaceID ==
@@ -370,23 +369,21 @@ bool CommandRequestImpl::CheckAllowedParameters() {
}
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list =
- accessor.begin();
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list_end =
- accessor.end();
+ ApplicationSetConstIt it_app_list = accessor.begin();
+ ApplicationSetConstIt it_app_list_end = accessor.end();
for (; it_app_list != it_app_list_end; ++it_app_list) {
if (connection_key() == (*it_app_list).get()->app_id()) {
-
RPCParams params;
- const smart_objects::SmartObject& s_map = (*message_)[strings::msg_params];
+ const smart_objects::SmartObject& s_map =
+ (*message_)[strings::msg_params];
if (smart_objects::SmartType_Map == s_map.getType()) {
smart_objects::SmartMap::iterator iter = s_map.map_begin();
smart_objects::SmartMap::iterator iter_end = s_map.map_end();
for (; iter != iter_end; ++iter) {
if (true == iter->second.asBool()) {
- LOG4CXX_INFO(logger_, "Request's param: " << iter->first);
+ LOG4CXX_DEBUG(logger_, "Request's param: " << iter->first);
params.push_back(iter->first);
}
}
@@ -394,20 +391,22 @@ bool CommandRequestImpl::CheckAllowedParameters() {
CommandParametersPermissions params_permissions;
mobile_apis::Result::eType check_result =
- application_manager::ApplicationManagerImpl::instance()->
- CheckPolicyPermissions(
- (*it_app_list).get()->mobile_app_id(),
- (*it_app_list).get()->hmi_level(),
- static_cast<mobile_api::FunctionID::eType>(function_id()),
- params,
- &params_permissions);
+ application_manager::ApplicationManagerImpl::instance()
+ ->CheckPolicyPermissions(
+ (*it_app_list).get()->mobile_app_id(),
+ (*it_app_list).get()->hmi_level(),
+ static_cast<mobile_api::FunctionID::eType>(function_id()),
+ params,
+ &params_permissions);
// Check, if RPC is allowed by policy
if (mobile_apis::Result::SUCCESS != check_result) {
smart_objects::SmartObjectSPtr response =
- MessageHelper::CreateBlockedByPoliciesResponse(
- static_cast<mobile_api::FunctionID::eType>(function_id()),
- check_result, correlation_id(), (*it_app_list)->app_id());
+ MessageHelper::CreateBlockedByPoliciesResponse(
+ static_cast<mobile_api::FunctionID::eType>(function_id()),
+ check_result,
+ correlation_id(),
+ (*it_app_list)->app_id());
ApplicationManagerImpl::instance()->SendMessageToMobile(response);
return false;
@@ -429,7 +428,7 @@ bool CommandRequestImpl::CheckAllowedParameters() {
void CommandRequestImpl::RemoveDisallowedParameters(
const CommandParametersPermissions& params_permissions) {
- LOG4CXX_INFO(logger_, "RemoveDisallowedParameters");
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& params = (*message_)[strings::msg_params];
@@ -438,13 +437,13 @@ void CommandRequestImpl::RemoveDisallowedParameters(
params_permissions.disallowed_params.begin();
std::vector<std::string>::const_iterator it_disallowed_end =
params_permissions.disallowed_params.end();
- for (;it_disallowed != it_disallowed_end; ++it_disallowed) {
+ for (; it_disallowed != it_disallowed_end; ++it_disallowed) {
if (params.keyExists(*it_disallowed)) {
params.erase(*it_disallowed);
- parameters_permissions_.disallowed_params.push_back(
- *it_disallowed);
- LOG4CXX_INFO(logger_, "Following parameter is disallowed by user: "
- << *it_disallowed);
+ parameters_permissions_.disallowed_params.push_back(*it_disallowed);
+ LOG4CXX_INFO(
+ logger_,
+ "Following parameter is disallowed by user: " << *it_disallowed);
}
}
@@ -453,13 +452,13 @@ void CommandRequestImpl::RemoveDisallowedParameters(
params_permissions.undefined_params.begin();
std::vector<std::string>::const_iterator it_undefined_end =
params_permissions.undefined_params.end();
- for (;it_undefined != it_undefined_end; ++it_undefined) {
+ for (; it_undefined != it_undefined_end; ++it_undefined) {
if (params.keyExists(*it_undefined)) {
params.erase(*it_undefined);
- parameters_permissions_.undefined_params.push_back(
- *it_undefined);
- LOG4CXX_INFO(logger_, "Following parameter is disallowed by policy: "
- << *it_undefined);
+ parameters_permissions_.undefined_params.push_back(*it_undefined);
+ LOG4CXX_INFO(
+ logger_,
+ "Following parameter is disallowed by policy: " << *it_undefined);
}
}
@@ -469,19 +468,19 @@ void CommandRequestImpl::RemoveDisallowedParameters(
VehicleData::const_iterator it_vehicle_data = vehicle_data.begin();
VehicleData::const_iterator it_vehicle_data_end = vehicle_data.end();
- for (;it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) {
+ for (; it_vehicle_data != it_vehicle_data_end; ++it_vehicle_data) {
const std::string key = it_vehicle_data->first;
if (params.keyExists(key) &&
params_permissions.allowed_params.end() ==
- std::find(params_permissions.allowed_params.begin(),
- params_permissions.allowed_params.end(),
- key)) {
+ std::find(params_permissions.allowed_params.begin(),
+ params_permissions.allowed_params.end(),
+ key)) {
params.erase(key);
parameters_permissions_.undefined_params.push_back(key);
LOG4CXX_INFO(logger_,
"Following parameter is not found among allowed parameters '"
- << key
- << "' and will be treated as disallowed.");
+ << key
+ << "' and will be treated as disallowed.");
}
}
}
@@ -527,15 +526,13 @@ void CommandRequestImpl::AddDisallowedParametersToInfo(
void CommandRequestImpl::AddDisallowedParameters(
smart_objects::SmartObject& response) {
DisallowedParamsInserter disallowed_inserter(
- response,
- mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
+ response, mobile_apis::VehicleDataResultCode::VDRC_USER_DISALLOWED);
std::for_each(parameters_permissions_.disallowed_params.begin(),
parameters_permissions_.disallowed_params.end(),
disallowed_inserter);
DisallowedParamsInserter undefined_inserter(
- response,
- mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
+ response, mobile_apis::VehicleDataResultCode::VDRC_DISALLOWED);
std::for_each(parameters_permissions_.undefined_params.begin(),
parameters_permissions_.undefined_params.end(),
undefined_inserter);
@@ -543,7 +540,7 @@ void CommandRequestImpl::AddDisallowedParameters(
bool CommandRequestImpl::HasDisallowedParams() const {
return ((!parameters_permissions_.disallowed_params.empty()) ||
- (!parameters_permissions_.undefined_params.empty()));
+ (!parameters_permissions_.undefined_params.empty()));
}
} // namespace commands
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 b34752a00f..80b1edb5bb 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
@@ -29,5 +29,3 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-
-
diff --git a/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc b/src/components/application_manager/src/commands/hmi/dial_number_request.cc
index 9820bb02ad..b0a30cca26 100644
--- a/src/components/application_manager/src/commands/hmi/on_play_tone_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/dial_number_request.cc
@@ -30,25 +30,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/commands/hmi/on_play_tone_notification.h"
+#include "application_manager/commands/hmi/dial_number_request.h"
namespace application_manager {
namespace commands {
-OnPlayToneNotification::OnPlayToneNotification(const MessageSharedPtr& message)
- : NotificationToHMI(message) {
-}
+namespace hmi {
-OnPlayToneNotification::~OnPlayToneNotification() {
+DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message)
+ : RequestToHMI(message) {
}
-void OnPlayToneNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
+DialNumberRequest::~DialNumberRequest() {
+}
- SendNotification();
+void DialNumberRequest::Run() {
+ SendRequest();
}
+} // namespace hmi
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_icon_response.cc b/src/components/application_manager/src/commands/hmi/dial_number_response.cc
index f4565baaf1..22b61659bd 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_icon_response.cc
+++ b/src/components/application_manager/src/commands/hmi/dial_number_response.cc
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright (c) 2013, Ford Motor Company
* All rights reserved.
*
@@ -29,29 +29,29 @@
* 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/ui_set_icon_response.h"
-#include "application_manager/event_engine/event.h"
-#include "interfaces/HMI_API.h"
+#include "application_manager/commands/hmi/dial_number_response.h"
namespace application_manager {
namespace commands {
-UISetIconResponse::UISetIconResponse(const MessageSharedPtr& message)
+namespace hmi {
+
+DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message)
: ResponseFromHMI(message) {
}
-UISetIconResponse::~UISetIconResponse() {
+DialNumberResponse::~DialNumberResponse() {
}
-void UISetIconResponse::Run() {
- LOG4CXX_INFO(logger_, "UISetIconResponse::Run");
-
- event_engine::Event event(hmi_apis::FunctionID::UI_SetAppIcon);
+void DialNumberResponse::Run() {
+ event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_DialNumber);
event.set_smart_object(*message_);
event.raise();
}
+} // namespace hmi
+
} // 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 4a637341c1..314624b60c 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
@@ -55,44 +55,6 @@ AudioStartStreamRequest::AudioStartStreamRequest(
AudioStartStreamRequest::~AudioStartStreamRequest() {
}
-void AudioStartStreamRequest::RetryStartSession() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
- application_by_hmi_app(application_id());
- if (!app) {
- LOG4CXX_ERROR(logger_,
- "StartAudioStreamRequest aborted. Application not found");
- return;
- }
- if (app->audio_streaming_approved()) {
- LOG4CXX_DEBUG(logger_, "AudioStartStream retry sequence stopped. "
- << "SUCCESS received");
- app->set_audio_stream_retry_number(0);
- return;
- }
-
- uint32_t curr_retry_number = app->audio_stream_retry_number();
- if (curr_retry_number < retry_number_ - 1) {
- LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry. retry_number = "
- << curr_retry_number);
- MessageHelper::SendAudioStartStream(app->app_id());
- app->set_audio_stream_retry_number(++curr_retry_number);
- } else {
- LOG4CXX_DEBUG(logger_, "Audio start stream retry sequence stopped. "
- << "Attempts expired.");
- app->set_audio_stream_retry_number(0);
- ApplicationManagerImpl::instance()->EndNaviServices(app->app_id());
- }
-}
-
-void AudioStartStreamRequest::onTimeOut() {
- RetryStartSession();
-
- ApplicationManagerImpl::instance()->TerminateRequest(
- connection_key(), correlation_id());
-}
-
void AudioStartStreamRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -133,16 +95,21 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- LOG4CXX_DEBUG(logger_, "StartAudioStreamResponse SUCCESS");
+ LOG4CXX_INFO(logger_, "StartAudioStream response SUCCESS");
if (ApplicationManagerImpl::instance()->
HMILevelAllowsStreaming(app->app_id(), ServiceType::kAudio)) {
app->set_audio_streaming_approved(true);
} else {
- LOG4CXX_DEBUG(logger_,
+ LOG4CXX_WARN(logger_,
"StartAudioStreamRequest aborted. Application can not stream");
}
+ break;
+ }
+ if (hmi_apis::Common_Result::REJECTED == code) {
+ LOG4CXX_INFO(logger_, "StartAudioStream response REJECTED");
+ RetryStartSession();
+ break;
}
- break;
}
default: {
LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
@@ -151,6 +118,50 @@ void AudioStartStreamRequest::on_event(const event_engine::Event& event) {
}
}
+void AudioStartStreamRequest::onTimeOut() {
+ RetryStartSession();
+
+ ApplicationManagerImpl::instance()->TerminateRequest(
+ connection_key(), correlation_id());
+}
+
+void AudioStartStreamRequest::RetryStartSession() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ ApplicationSharedPtr app = ApplicationManagerImpl::instance()->
+ application_by_hmi_app(application_id());
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "StartAudioStreamRequest aborted. Application not found");
+ return;
+ }
+
+ if (!app->audio_streaming_allowed()) {
+ LOG4CXX_WARN(logger_, "Audio streaming not allowed");
+ return;
+ }
+
+ if (app->audio_streaming_approved()) {
+ LOG4CXX_INFO(logger_, "AudioStartStream retry sequence stopped. "
+ << "SUCCESS received");
+ app->set_audio_stream_retry_number(0);
+ return;
+ }
+
+ uint32_t curr_retry_number = app->audio_stream_retry_number();
+ if (curr_retry_number < retry_number_ - 1) {
+ LOG4CXX_DEBUG(logger_, "Send AudioStartStream retry. retry_number = "
+ << curr_retry_number);
+ MessageHelper::SendAudioStartStream(app->app_id());
+ app->set_audio_stream_retry_number(++curr_retry_number);
+ } else {
+ LOG4CXX_DEBUG(logger_, "Audio start stream retry sequence stopped. "
+ << "Attempts expired.");
+
+ ApplicationManagerImpl::instance()->EndNaviServices(app->app_id());
+ }
+}
+
} // namespace commands
} // namespace application_manager
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 1ff7916b9a..a839ee5275 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
@@ -95,7 +95,7 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == code) {
- LOG4CXX_DEBUG(logger_, "NaviStartStreamResponse SUCCESS");
+ LOG4CXX_INFO(logger_, "NaviStartStreamResponse SUCCESS");
if (ApplicationManagerImpl::instance()->
HMILevelAllowsStreaming(app->app_id(), ServiceType::kMobileNav)) {
app->set_video_streaming_approved(true);
@@ -103,8 +103,13 @@ void NaviStartStreamRequest::on_event(const event_engine::Event& event) {
LOG4CXX_DEBUG(logger_,
"NaviStartStreamRequest aborted. Application can not stream");
}
+ break;
+ }
+ if (hmi_apis::Common_Result::REJECTED == code) {
+ LOG4CXX_INFO(logger_, "StartStream response REJECTED ");
+ SendRequest();
+ break;
}
- break;
}
default: {
LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
@@ -130,8 +135,14 @@ void NaviStartStreamRequest::RetryStartSession() {
"NaviStartStreamRequest aborted. Application not found");
return;
}
+
+ if (!app->video_streaming_allowed()) {
+ LOG4CXX_WARN(logger_, "Video streaming not allowed");
+ return;
+ }
+
if (app->video_streaming_approved()) {
- LOG4CXX_DEBUG(logger_, "NaviStartStream retry sequence stopped. "
+ LOG4CXX_INFO(logger_, "NaviStartStream retry sequence stopped. "
<< "SUCCESS received");
app->set_video_stream_retry_number(0);
return;
@@ -146,7 +157,7 @@ void NaviStartStreamRequest::RetryStartSession() {
} else {
LOG4CXX_DEBUG(logger_, "NaviStartStream retry sequence stopped. "
<< "Attempts expired");
- app->set_video_stream_retry_number(0);
+
ApplicationManagerImpl::instance()->EndNaviServices(app->app_id());
}
}
diff --git a/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc b/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc
index 506413ce1e..6bb010ed78 100644
--- a/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_allow_sdl_functionality_notification.cc
@@ -39,17 +39,15 @@ namespace commands {
OnAllowSDLFunctionalityNotification::OnAllowSDLFunctionalityNotification(
const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ : NotificationFromHMI(message) {}
-OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {
-}
+OnAllowSDLFunctionalityNotification::~OnAllowSDLFunctionalityNotification() {}
void OnAllowSDLFunctionalityNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t device_id = 0;
+ std::string device_id;
if ((*message_)[strings::msg_params].keyExists("device")) {
- device_id = (*message_)[strings::msg_params]["device"]["id"].asUInt();
+ device_id = (*message_)[strings::msg_params]["device"]["id"].asString();
}
policy::PolicyHandler::instance()->OnAllowSDLFunctionalityNotification(
(*message_)[strings::msg_params][hmi_response::allowed].asBool(),
@@ -59,4 +57,3 @@ void OnAllowSDLFunctionalityNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc
index 0ff76a45f5..acdcc5da9f 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_activated_notification.cc
@@ -49,10 +49,9 @@ OnAppActivatedNotification::~OnAppActivatedNotification() {
void OnAppActivatedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- uint32_t app_id = ((*message_)[strings::msg_params][strings::app_id]).asUInt();
- ApplicationManagerImpl::instance()->SetState<true>(app_id,
- mobile_apis::HMILevel::HMI_FULL
- );
+ event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ event.set_smart_object(*message_);
+ event.raise();
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc
index 3df1c566d9..899c29b369 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_deactivated_notification.cc
@@ -51,68 +51,11 @@ OnAppDeactivatedNotification::~OnAppDeactivatedNotification() {
void OnAppDeactivatedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
- uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt();
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(app_id);
-
- if (!app.valid()) {
- LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found");
- return;
- }
-
- using namespace hmi_apis;
- using namespace mobile_apis;
- using namespace helpers;
-
- Common_DeactivateReason::eType deactivate_reason =
- static_cast<Common_DeactivateReason::eType>
- ((*message_)[strings::msg_params][hmi_request::reason].asInt());
-
- if (!((Common_DeactivateReason::AUDIO == deactivate_reason ||
- Common_DeactivateReason::PHONECALL == deactivate_reason) &&
- HMILevel::HMI_LIMITED == app->hmi_level())) {
- app = ApplicationManagerImpl::instance()->active_application();
-
- if (!app.valid()) {
- LOG4CXX_ERROR_EXT(logger_, "No active application");
- return;
- }
- if (app_id != app->app_id()) {
- LOG4CXX_ERROR_EXT(logger_, "Wrong application id");
- return;
- }
- }
-
- if (HMILevel::HMI_NONE == app->hmi_level()) {
- return;
- }
- HmiStatePtr regular = app->RegularHmiState();
- DCHECK_OR_RETURN_VOID(regular);
- HmiStatePtr new_regular(new HmiState(*regular));
-
- switch ((*message_)[strings::msg_params][hmi_request::reason].asInt()) {
- case hmi_apis::Common_DeactivateReason::AUDIO: {
- new_regular->set_audio_streaming_state(mobile_api::AudioStreamingState::NOT_AUDIBLE);
- new_regular->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
- break;
- }
- case hmi_apis::Common_DeactivateReason::NAVIGATIONMAP:
- case hmi_apis::Common_DeactivateReason::PHONEMENU:
- case hmi_apis::Common_DeactivateReason::SYNCSETTINGS:
- case hmi_apis::Common_DeactivateReason::GENERAL: {
- if (app->IsAudioApplication()) {
- new_regular->set_hmi_level(mobile_api::HMILevel::HMI_LIMITED);
- } else {
- new_regular->set_hmi_level(mobile_api::HMILevel::HMI_BACKGROUND);
- }
- }
- }
- ApplicationManagerImpl::instance()->SetState<false>(app->app_id(), new_regular);
-
+ event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
+ event.set_smart_object(*message_);
+ event.raise();
}
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc
index 69a18200fa..3e39e2c44e 100644
--- a/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_app_permission_consent_notification.cc
@@ -40,12 +40,11 @@ namespace application_manager {
namespace commands {
-OnAppPermissionConsentNotification::OnAppPermissionConsentNotification(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+OnAppPermissionConsentNotification::OnAppPermissionConsentNotification(
+ const MessageSharedPtr& message)
+ : NotificationFromHMI(message) {}
-OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {
-}
+OnAppPermissionConsentNotification::~OnAppPermissionConsentNotification() {}
void OnAppPermissionConsentNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -62,28 +61,29 @@ void OnAppPermissionConsentNotification::Run() {
if (msg_params.keyExists("consentedFunctions")) {
smart_objects::SmartArray* user_consent =
- msg_params["consentedFunctions"].asArray();
-
- smart_objects::SmartArray::const_iterator it = user_consent->begin();
- smart_objects::SmartArray::const_iterator it_end = user_consent->end();
- for (; it != it_end; ++it) {
- policy::FunctionalGroupPermission permissions;
- permissions.group_id = (*it)["id"].asInt();
- permissions.group_alias = (*it)["name"].asString();
- if ((*it).keyExists("allowed")) {
- permissions.state = (*it)["allowed"].asBool() ? policy::kGroupAllowed :
- policy::kGroupDisallowed;
- } else {
- permissions.state = policy::kGroupUndefined;
- }
+ msg_params["consentedFunctions"].asArray();
+
+ smart_objects::SmartArray::const_iterator it = user_consent->begin();
+ smart_objects::SmartArray::const_iterator it_end = user_consent->end();
+ for (; it != it_end; ++it) {
+ policy::FunctionalGroupPermission permissions;
+ permissions.group_id = (*it)["id"].asInt();
+ permissions.group_alias = (*it)["name"].asString();
+ if ((*it).keyExists("allowed")) {
+ permissions.state = (*it)["allowed"].asBool()
+ ? policy::kGroupAllowed
+ : policy::kGroupDisallowed;
+ } else {
+ permissions.state = policy::kGroupUndefined;
+ }
permission_consent.group_permissions.push_back(permissions);
}
permission_consent.consent_source = msg_params["source"].asString();
- policy::PolicyHandler::instance()->OnAppPermissionConsent(connection_key,
- permission_consent);
+ policy::PolicyHandler::instance()->OnAppPermissionConsent(
+ connection_key, permission_consent);
}
}
diff --git a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc
index 441538bee2..fbd866927b 100644
--- a/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_device_chosen_notification.cc
@@ -38,11 +38,10 @@ namespace application_manager {
namespace commands {
OnDeviceChosenNotification::OnDeviceChosenNotification(
- const MessageSharedPtr& message) : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message)
+ : NotificationFromHMI(message) {}
-OnDeviceChosenNotification::~OnDeviceChosenNotification() {
-}
+OnDeviceChosenNotification::~OnDeviceChosenNotification() {}
void OnDeviceChosenNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -57,4 +56,3 @@ void OnDeviceChosenNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc
index b41eb6b861..a1d8d753e7 100644
--- a/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_device_state_changed_notification.cc
@@ -38,38 +38,40 @@
#include "encryption/hashing.h"
namespace {
- // TODO(AOleynik) : replace this !!!
- void check_zero(const char& a, const char& b, std::string& bt_mac) {
- if ('0' != a && '0' == b) {
- bt_mac.push_back(a);
- bt_mac.push_back(b);
- } else if ('0' == a) {
- bt_mac.push_back(b);
- } else {
- bt_mac.push_back(a);
- bt_mac.push_back(b);
- }
- }
-
- std::string convert_to_bt_mac(std::string& deviceInternalId) {
- std::transform(deviceInternalId.begin(), deviceInternalId.end(),deviceInternalId.begin(), ::tolower);
+// TODO(AOleynik) : replace this !!!
+void check_zero(const char& a, const char& b, std::string& bt_mac) {
+ if ('0' != a && '0' == b) {
+ bt_mac.push_back(a);
+ bt_mac.push_back(b);
+ } else if ('0' == a) {
+ bt_mac.push_back(b);
+ } else {
+ bt_mac.push_back(a);
+ bt_mac.push_back(b);
+ }
+}
- std::string bt_mac;
- check_zero(deviceInternalId[10], deviceInternalId[11], bt_mac);
- bt_mac.push_back(':');
- check_zero(deviceInternalId[8], deviceInternalId[9], bt_mac);
- bt_mac.push_back(':');
- check_zero(deviceInternalId[6], deviceInternalId[7], bt_mac);
- bt_mac.push_back(':');
- check_zero(deviceInternalId[4], deviceInternalId[5], bt_mac);
- bt_mac.push_back(':');
- check_zero(deviceInternalId[2], deviceInternalId[3], bt_mac);
- bt_mac.push_back(':');
- check_zero(deviceInternalId[0], deviceInternalId[1], bt_mac);
+std::string convert_to_bt_mac(std::string& deviceInternalId) {
+ std::transform(deviceInternalId.begin(),
+ deviceInternalId.end(),
+ deviceInternalId.begin(),
+ ::tolower);
- return bt_mac;
- }
+ std::string bt_mac;
+ check_zero(deviceInternalId[10], deviceInternalId[11], bt_mac);
+ bt_mac.push_back(':');
+ check_zero(deviceInternalId[8], deviceInternalId[9], bt_mac);
+ bt_mac.push_back(':');
+ check_zero(deviceInternalId[6], deviceInternalId[7], bt_mac);
+ bt_mac.push_back(':');
+ check_zero(deviceInternalId[4], deviceInternalId[5], bt_mac);
+ bt_mac.push_back(':');
+ check_zero(deviceInternalId[2], deviceInternalId[3], bt_mac);
+ bt_mac.push_back(':');
+ check_zero(deviceInternalId[0], deviceInternalId[1], bt_mac);
+ return bt_mac;
+}
}
namespace application_manager {
@@ -77,33 +79,32 @@ namespace application_manager {
namespace commands {
OnDeviceStateChangedNotification::OnDeviceStateChangedNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ const MessageSharedPtr& message)
+ : NotificationFromHMI(message) {}
-OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {
-}
+OnDeviceStateChangedNotification::~OnDeviceStateChangedNotification() {}
void OnDeviceStateChangedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- if ((*message_)[strings::msg_params]["deviceState"]
- == hmi_apis::Common_DeviceState::UNPAIRED) {
- // It is expected, that "deviceInternalId" is the device MAC address in
- // form XXXXXXXXXX
- std::string device_id = (*message_)[strings::msg_params]["deviceInternalId"]
- .asString();
+ if ((*message_)[strings::msg_params]["deviceState"] ==
+ hmi_apis::Common_DeviceState::UNPAIRED) {
+ // It is expected, that "deviceInternalId" is the device MAC address in
+ // form XXXXXXXXXX
+ std::string device_id =
+ (*message_)[strings::msg_params]["deviceInternalId"].asString();
if (device_id.empty()) {
if ((*message_)[strings::msg_params].keyExists("deviceId")) {
- device_id = (*message_)[strings::msg_params]["deviceId"]["id"].asString();
+ device_id =
+ (*message_)[strings::msg_params]["deviceId"]["id"].asString();
}
} else {
- // Policy uses hashed MAC address as device_id
- LOG4CXX_DEBUG(logger_,"Device_id from HMI: " << device_id);
- std::string bt_mac = convert_to_bt_mac(device_id);
- LOG4CXX_DEBUG(logger_,"Device_id as BT MAC: " << bt_mac);
- device_id = encryption::MakeHash(bt_mac);
- LOG4CXX_DEBUG(logger_,"Device_id hashed as BT MAC : " << device_id);
+ // Policy uses hashed MAC address as device_id
+ LOG4CXX_DEBUG(logger_, "Device_id from HMI: " << device_id);
+ std::string bt_mac = convert_to_bt_mac(device_id);
+ LOG4CXX_DEBUG(logger_, "Device_id as BT MAC: " << bt_mac);
+ device_id = encryption::MakeHash(bt_mac);
+ LOG4CXX_DEBUG(logger_, "Device_id hashed as BT MAC : " << device_id);
}
policy::PolicyHandler::instance()->RemoveDevice(device_id);
}
diff --git a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc
index ceb6e1b586..96bbf5e17a 100644
--- a/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_driver_distraction_notification.cc
@@ -45,26 +45,23 @@ namespace hmi {
OnDriverDistractionNotification::OnDriverDistractionNotification(
const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ : NotificationFromHMI(message) {}
-OnDriverDistractionNotification::~OnDriverDistractionNotification() {
-}
+OnDriverDistractionNotification::~OnDriverDistractionNotification() {}
void OnDriverDistractionNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
const hmi_apis::Common_DriverDistractionState::eType state =
static_cast<hmi_apis::Common_DriverDistractionState::eType>(
- (*message_)[strings::msg_params][hmi_notification::state]
- .asInt());
+ (*message_)[strings::msg_params][hmi_notification::state].asInt());
ApplicationManagerImpl::instance()->set_driver_distraction(state);
smart_objects::SmartObjectSPtr on_driver_distraction =
new smart_objects::SmartObject();
if (!on_driver_distraction) {
- LOG4CXX_ERROR_EXT(logger_, "NULL pointer");
+ LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
@@ -75,14 +72,14 @@ void OnDriverDistractionNotification::Run() {
state;
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationManagerImpl::ApplictionSet applications = accessor.applications();
+ const ApplicationSet applications = accessor.applications();
- ApplicationManagerImpl::ApplictionSetConstIt it = applications.begin();
+ ApplicationSetConstIt it = applications.begin();
for (; applications.end() != it; ++it) {
const ApplicationSharedPtr app = *it;
if (app) {
- (*on_driver_distraction)[strings::params]
- [strings::connection_key] = app->app_id();
+ (*on_driver_distraction)[strings::params][strings::connection_key] =
+ app->app_id();
SendNotificationToMobile(on_driver_distraction);
}
}
@@ -93,4 +90,3 @@ void OnDriverDistractionNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc b/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc
index 47b80a1d2b..fe52759c46 100644
--- a/src/components/application_manager/src/commands/hmi/on_emergency_event_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_event_changed_notification.cc
@@ -30,24 +30,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/commands/hmi/on_emergency_event_notification.h"
-#include "application_manager/application_manager_impl.h"
+#include "application_manager/commands/hmi/on_event_changed_notification.h"
namespace application_manager {
namespace commands {
-OnEmergencyEventNotification::OnEmergencyEventNotification(
+OnEventChangedNotification::OnEventChangedNotification(
const MessageSharedPtr& message)
: NotificationFromHMI(message) {
}
-OnEmergencyEventNotification::~OnEmergencyEventNotification() {
+OnEventChangedNotification::~OnEventChangedNotification() {
}
-void OnEmergencyEventNotification::Run() {
+void OnEventChangedNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnEmergencyEvent);
+ event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
event.set_smart_object(*message_);
event.raise();
}
@@ -56,4 +55,3 @@ void OnEmergencyEventNotification::Run() {
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc
index d64ba3adf9..5dfd178bc6 100644
--- a/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_exit_application_notification.cc
@@ -51,30 +51,52 @@ OnExitApplicationNotification::~OnExitApplicationNotification() {
void OnExitApplicationNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+ using namespace hmi_apis;
+
ApplicationManagerImpl* app_mgr = ApplicationManagerImpl::instance();
- ApplicationSharedPtr app_impl = app_mgr->application(
- (*message_)[strings::msg_params][strings::app_id].asUInt());
+ uint32_t app_id = (*message_)[strings::msg_params][strings::app_id].asUInt();
+ ApplicationSharedPtr app_impl = app_mgr->application(app_id);
+
if (!(app_impl.valid())) {
LOG4CXX_ERROR(logger_, "Application does not exist");
return;
}
- hmi_apis::Common_ApplicationToNONEReason::eType reason;
- reason = static_cast<hmi_apis::Common_ApplicationToNONEReason::eType>
- ((*message_)[strings::msg_params][strings::reason].asInt());
+
+ Common_ApplicationExitReason::eType reason;
+ reason = static_cast<Common_ApplicationExitReason::eType>
+ ((*message_)[strings::msg_params][strings::reason].asInt());
+
switch (reason) {
- case hmi_apis::Common_ApplicationToNONEReason::USER_EXIT : {
+ case Common_ApplicationExitReason::DRIVER_DISTRACTION_VIOLATION: {
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ app_impl->app_id(),
+ AppInterfaceUnregisteredReason::DRIVER_DISTRACTION_VIOLATION);
break;
}
- default : {
- LOG4CXX_WARN(logger_, "Unhandled reason");
+ case Common_ApplicationExitReason::USER_EXIT: {
break;
}
+ case Common_ApplicationExitReason::UNAUTHORIZED_TRANSPORT_REGISTRATION: {
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
+ app_mgr->UnregisterApplication(app_id, Result::SUCCESS);
+ return;
+ }
+ case Common_ApplicationExitReason::UNSUPPORTED_HMI_RESOURCE: {
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ app_id, AppInterfaceUnregisteredReason::UNSUPPORTED_HMI_RESOURCE);
+ app_mgr->UnregisterApplication(app_id, Result::SUCCESS);
+ return;
+ }
+ default: {
+ LOG4CXX_WARN(logger_, "Unhandled reason");
+ return;
+ }
}
- using namespace mobile_apis;
- ApplicationManagerImpl::instance()->SetState<false>(app_impl->app_id(),
- HMILevel::HMI_NONE,
- AudioStreamingState::NOT_AUDIBLE,
- SystemContext::SYSCTXT_MAIN);
+
+ ApplicationManagerImpl::instance()->SetState<false>(
+ app_id, HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc b/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc
deleted file mode 100644
index 5f47c2908a..0000000000
--- a/src/components/application_manager/src/commands/hmi/on_phone_call_notification.cc
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "application_manager/commands/hmi/on_phone_call_notification.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application_impl.h"
-#include "application_manager/message_helper.h"
-
-namespace application_manager {
-
-namespace commands {
-
-namespace hmi {
-
-OnPhoneCallNotification::OnPhoneCallNotification(
- const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
-
-OnPhoneCallNotification::~OnPhoneCallNotification() {
-}
-
-void OnPhoneCallNotification::Run() {
- LOG4CXX_AUTO_TRACE(logger_);
- event_engine::Event event(hmi_apis::FunctionID::BasicCommunication_OnPhoneCall);
- event.set_smart_object(*message_);
- event.raise();
-}
-
-} // namespace hmi
-
-} // namespace commands
-
-} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
index a5ea29c6d2..df620effb0 100644
--- a/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
+++ b/src/components/application_manager/src/commands/hmi/on_received_policy_update.cc
@@ -40,22 +40,21 @@ namespace application_manager {
namespace commands {
OnReceivedPolicyUpdate::OnReceivedPolicyUpdate(const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ : NotificationFromHMI(message) {}
-OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {
-}
+OnReceivedPolicyUpdate::~OnReceivedPolicyUpdate() {}
void OnReceivedPolicyUpdate::Run() {
LOG4CXX_AUTO_TRACE(logger_);
const std::string& file_path =
- (*message_)[strings::msg_params][hmi_notification::policyfile].asString();
+ (*message_)[strings::msg_params][hmi_notification::policyfile].asString();
policy::BinaryMessage file_content;
if (!file_system::ReadBinaryFile(file_path, file_content)) {
LOG4CXX_ERROR(logger_, "Failed to read Update file.");
return;
}
- policy::PolicyHandler::instance()->ReceiveMessageFromSDK(file_path, file_content);
+ policy::PolicyHandler::instance()->ReceiveMessageFromSDK(file_path,
+ file_content);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc
index c393219134..56ebcced4e 100644
--- a/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_sdl_close_notification.cc
@@ -44,7 +44,7 @@ OnSDLCloseNotification::~OnSDLCloseNotification() {
}
void OnSDLCloseNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSdlCloseNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc b/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc
index afe0ffeabc..ff39131a28 100644
--- a/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_sdl_persistence_complete_notification.cc
@@ -45,7 +45,7 @@ OnSDLPersistenceCompleteNotification::~OnSDLPersistenceCompleteNotification() {
}
void OnSDLPersistenceCompleteNotification::Run() {
- LOG4CXX_INFO(logger_, "OnSDLpersistenceCompleteNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc b/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc
index 7db0053e2d..9f95d04380 100644
--- a/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_status_update_notification.cc
@@ -45,7 +45,7 @@ OnStatusUpdateNotification::~OnStatusUpdateNotification() {
}
void OnStatusUpdateNotification::Run() {
- LOG4CXX_INFO(logger_, "OnGetStatusUpdateNotification::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendNotification();
}
diff --git a/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc b/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc
index aa334d8259..a3fc28e5a6 100644
--- a/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_system_context_notification.cc
@@ -54,7 +54,6 @@ void OnSystemContextNotification::Run() {
(*message_)[strings::msg_params][hmi_notification::system_context].asInt());
ApplicationSharedPtr app;
-
if ((mobile_api::SystemContext::SYSCTXT_VRSESSION == system_context) ||
(mobile_api::SystemContext::SYSCTXT_MENU == system_context) ||
(mobile_api::SystemContext::SYSCTXT_HMI_OBSCURED == system_context)) {
@@ -67,21 +66,13 @@ void OnSystemContextNotification::Run() {
}
}
- if (app.valid() && (system_context != app->system_context()) &&
- (system_context != mobile_api::SystemContext::INVALID_ENUM)) {
- SendSystemContextNotification(app, system_context);
+ if (app && mobile_api::SystemContext::INVALID_ENUM != system_context) {
+ ApplicationManagerImpl::instance()->SetState(app->app_id(), system_context);
} else {
- LOG4CXX_ERROR(logger_, "Ignored wrong SystemContext notification!");
+ LOG4CXX_ERROR(logger_, "Application does not exist");
}
}
-void OnSystemContextNotification::SendSystemContextNotification(ApplicationSharedPtr app,
- mobile_api::SystemContext::eType system_context) {
- ApplicationManagerImpl::instance()->SetState(app->app_id(),
- system_context);
-}
-
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc
index daa307d627..0576b6d020 100644
--- a/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_tts_language_change_notification.cc
@@ -42,11 +42,9 @@ namespace commands {
OnTTSLanguageChangeNotification::OnTTSLanguageChangeNotification(
const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ : NotificationFromHMI(message) {}
-OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {
-}
+OnTTSLanguageChangeNotification::~OnTTSLanguageChangeNotification() {}
void OnTTSLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -72,14 +70,14 @@ void OnTTSLanguageChangeNotification::Run() {
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetIt it = accessor.begin();
for (; accessor.end() != it;) {
ApplicationSharedPtr app = *it++;
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
- if (static_cast<int>(app->language())
- != (*message_)[strings::msg_params][strings::language].asInt()) {
+ if (static_cast<int>(app->language()) !=
+ (*message_)[strings::msg_params][strings::language].asInt()) {
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
@@ -92,4 +90,3 @@ void OnTTSLanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc
index 7e54099994..19b1212b04 100644
--- a/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_ui_language_change_notification.cc
@@ -42,11 +42,9 @@ namespace commands {
OnUILanguageChangeNotification::OnUILanguageChangeNotification(
const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ : NotificationFromHMI(message) {}
-OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {
-}
+OnUILanguageChangeNotification::~OnUILanguageChangeNotification() {}
void OnUILanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -69,15 +67,15 @@ void OnUILanguageChangeNotification::Run() {
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetIt it = accessor.begin();
for (; accessor.end() != it;) {
ApplicationSharedPtr app = *it++;
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
- if (app->ui_language() != (*message_)[strings::msg_params]
- [strings::hmi_display_language].asInt()) {
-
+ if (app->ui_language() !=
+ (*message_)[strings::msg_params][strings::hmi_display_language]
+ .asInt()) {
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
@@ -90,4 +88,3 @@ void OnUILanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
index 9a146c19e7..a0e8277b5b 100644
--- a/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
+++ b/src/components/application_manager/src/commands/hmi/on_vr_language_change_notification.cc
@@ -42,11 +42,9 @@ namespace commands {
OnVRLanguageChangeNotification::OnVRLanguageChangeNotification(
const MessageSharedPtr& message)
- : NotificationFromHMI(message) {
-}
+ : NotificationFromHMI(message) {}
-OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {
-}
+OnVRLanguageChangeNotification::~OnVRLanguageChangeNotification() {}
void OnVRLanguageChangeNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -66,16 +64,15 @@ void OnVRLanguageChangeNotification::Run() {
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetIt it = accessor.begin();
for (; accessor.end() != it;) {
ApplicationSharedPtr app = *it++;
(*message_)[strings::params][strings::connection_key] = app->app_id();
SendNotificationToMobile(message_);
- if (static_cast<int32_t>(app->language())
- != (*message_)[strings::msg_params][strings::language].asInt()) {
-
- ApplicationManagerImpl::instance()->SetState<false>(app->app_id(),
- mobile_api::HMILevel::HMI_NONE);
+ if (static_cast<int32_t>(app->language()) !=
+ (*message_)[strings::msg_params][strings::language].asInt()) {
+ ApplicationManagerImpl::instance()->SetState<false>(
+ app->app_id(), mobile_api::HMILevel::HMI_NONE);
MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
app->app_id(),
@@ -89,4 +86,3 @@ void OnVRLanguageChangeNotification::Run() {
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
index af55040ad1..c1ee4142c5 100644
--- a/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
+++ b/src/components/application_manager/src/commands/hmi/sdl_activate_app_request.cc
@@ -39,11 +39,9 @@ namespace application_manager {
namespace commands {
SDLActivateAppRequest::SDLActivateAppRequest(const MessageSharedPtr& message)
- : RequestFromHMI(message) {
-}
+ : RequestFromHMI(message) {}
-SDLActivateAppRequest::~SDLActivateAppRequest() {
-}
+SDLActivateAppRequest::~SDLActivateAppRequest() {}
void SDLActivateAppRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -56,38 +54,39 @@ void SDLActivateAppRequest::Run() {
ApplicationManagerImpl::instance()->application(application_id);
if (!app) {
- LOG4CXX_WARN(logger_, "Can't find application within regular apps: "
- << application_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Can't find application within regular apps: " << application_id);
app = ApplicationManagerImpl::instance()->waiting_app(application_id);
if (!app) {
- LOG4CXX_WARN(logger_, "Can't find application within waiting apps: "
- << application_id);
+ LOG4CXX_WARN(
+ logger_,
+ "Can't find application within waiting apps: " << application_id);
return;
}
}
if (!app->IsRegistered()) {
- DevicesApps devices_apps =
- FindAllAppOnParticularDevice(app->device());
+ DevicesApps devices_apps = FindAllAppOnParticularDevice(app->device());
if (!devices_apps.first && devices_apps.second.empty()) {
- LOG4CXX_ERROR(logger_, "Can't find regular foreground app with the same "
- "connection id:" << app->device());
- SendResponse(correlation_id(),
- SDL_ActivateApp, NO_APPS_REGISTERED);
+ LOG4CXX_ERROR(logger_,
+ "Can't find regular foreground app with the same "
+ "connection id:"
+ << app->device());
+ SendResponse(correlation_id(), SDL_ActivateApp, NO_APPS_REGISTERED);
return;
}
if (devices_apps.first) {
- MessageHelper::SendLaunchApp(devices_apps.first->app_id(),
- app->SchemaUrl(),
- app->PackageName());
+ MessageHelper::SendLaunchApp(
+ devices_apps.first->app_id(), app->SchemaUrl(), app->PackageName());
} else {
- std::vector<ApplicationSharedPtr>::const_iterator it = devices_apps.second.begin();
+ std::vector<ApplicationSharedPtr>::const_iterator it =
+ devices_apps.second.begin();
for (; it != devices_apps.second.end(); ++it) {
- MessageHelper::SendLaunchApp((*it)->app_id(),
- app->SchemaUrl(),
- app->PackageName());
+ MessageHelper::SendLaunchApp(
+ (*it)->app_id(), app->SchemaUrl(), app->PackageName());
}
}
subscribe_on_event(BasicCommunication_OnAppRegistered);
@@ -102,8 +101,7 @@ void SDLActivateAppRequest::onTimeOut() {
using namespace hmi_apis::Common_Result;
using namespace application_manager;
unsubscribe_from_event(BasicCommunication_OnAppRegistered);
- SendResponse(correlation_id(),
- SDL_ActivateApp, APPLICATION_NOT_REGISTERED);
+ SendResponse(correlation_id(), SDL_ActivateApp, APPLICATION_NOT_REGISTERED);
}
void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
@@ -119,11 +117,11 @@ void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
const uint32_t hmi_application_id = hmi_app_id(event.smart_object());
ApplicationSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->
- application_by_hmi_app(hmi_application_id);
+ application_manager::ApplicationManagerImpl::instance()
+ ->application_by_hmi_app(hmi_application_id);
if (!app) {
- LOG4CXX_ERROR(logger_, "Application not found by HMI app id: "
- << hmi_application_id);
+ LOG4CXX_ERROR(
+ logger_, "Application not found by HMI app id: " << hmi_application_id);
return;
}
policy::PolicyHandler::instance()->OnActivateApp(app->app_id(),
@@ -132,8 +130,8 @@ void SDLActivateAppRequest::on_event(const event_engine::Event& event) {
uint32_t SDLActivateAppRequest::app_id() const {
if ((*message_).keyExists(strings::msg_params)) {
- if ((*message_)[strings::msg_params].keyExists(strings::app_id)){
- return (*message_)[strings::msg_params][strings::app_id].asUInt();
+ if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
+ return (*message_)[strings::msg_params][strings::app_id].asUInt();
}
}
LOG4CXX_DEBUG(logger_, "app_id section is absent in the message.");
@@ -143,11 +141,11 @@ uint32_t SDLActivateAppRequest::app_id() const {
uint32_t SDLActivateAppRequest::hmi_app_id(
const smart_objects::SmartObject& so) const {
if (so.keyExists(strings::params)) {
- if (so[strings::msg_params].keyExists(strings::application)){
- if (so[strings::msg_params][strings::application].
- keyExists(strings::app_id)) {
- return so[strings::msg_params][strings::application]
- [strings::app_id].asUInt();
+ if (so[strings::msg_params].keyExists(strings::application)) {
+ if (so[strings::msg_params][strings::application].keyExists(
+ strings::app_id)) {
+ return so[strings::msg_params][strings::application][strings::app_id]
+ .asUInt();
}
}
}
@@ -155,18 +153,17 @@ uint32_t SDLActivateAppRequest::hmi_app_id(
return 0;
}
-DevicesApps
-SDLActivateAppRequest::FindAllAppOnParticularDevice(
+DevicesApps SDLActivateAppRequest::FindAllAppOnParticularDevice(
const connection_handler::DeviceHandle handle) {
DevicesApps apps;
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSet app_list = accessor.GetData();
+ const ApplicationSet app_list = accessor.applications();
- ApplicationManagerImpl::ApplictionSetIt it = app_list.begin();
- ApplicationManagerImpl::ApplictionSetIt it_end = app_list.end();
+ ApplicationSetIt it = app_list.begin();
+ ApplicationSetIt it_end = app_list.end();
- for (;it != it_end; ++it) {
+ for (; it != it_end; ++it) {
if (handle == (*it)->device()) {
if ((*it)->is_foreground()) {
apps.first = *it;
@@ -179,4 +176,3 @@ SDLActivateAppRequest::FindAllAppOnParticularDevice(
} // namespace commands
} // namespace application_manager
-
diff --git a/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc b/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc
index 6c2122557b..996e977d60 100644
--- a/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc
+++ b/src/components/application_manager/src/commands/hmi/tts_get_language_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/tts_get_language_response.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/event_engine/event.h"
namespace application_manager {
@@ -45,13 +46,26 @@ TTSGetLanguageResponse::~TTSGetLanguageResponse() {
void TTSGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ Common_Language::eType language = Common_Language::INVALID_ENUM;
- hmi_capabilities.set_active_tts_language(
- static_cast<hmi_apis::Common_Language::eType>(
- (*message_)[strings::msg_params][hmi_response::language].asInt()));
+ if ((*message_).keyExists(strings::msg_params) &&
+ (*message_)[strings::msg_params].keyExists(hmi_response::language)) {
+
+ language = static_cast<Common_Language::eType>(
+ (*message_)[strings::msg_params][hmi_response::language].asInt());
+ }
+
+ ApplicationManagerImpl::instance()->hmi_capabilities().
+ set_active_tts_language(language);
+
+ LOG4CXX_DEBUG(logger_, "Raising event for function_id "
+ << function_id()
+ << " and correlation_id " << correlation_id());
+ event_engine::Event event(FunctionID::TTS_GetLanguage);
+ event.set_smart_object(*message_);
+ event.raise();
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc b/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc
index 667499584f..891b9a5e18 100644
--- a/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_add_submenu_request.cc
@@ -44,7 +44,7 @@ UIAddSubmenuRequest::~UIAddSubmenuRequest() {
}
void UIAddSubmenuRequest::Run() {
- LOG4CXX_INFO(logger_, "UIAddCommandRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc b/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc
index cba85d91e7..206f7d84a6 100644
--- a/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_get_language_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/ui_get_language_response.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/event_engine/event.h"
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -46,13 +47,26 @@ UIGetLanguageResponse::~UIGetLanguageResponse() {
void UIGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
+ Common_Language::eType language = Common_Language::INVALID_ENUM;
- hmi_capabilities.set_active_ui_language(
- static_cast<hmi_apis::Common_Language::eType>(
- (*message_)[strings::msg_params][hmi_response::language].asInt()));
+ if ((*message_).keyExists(strings::msg_params) &&
+ (*message_)[strings::msg_params].keyExists(hmi_response::language)) {
+
+ language = static_cast<Common_Language::eType>(
+ (*message_)[strings::msg_params][hmi_response::language].asInt());
+ }
+
+ ApplicationManagerImpl::instance()->hmi_capabilities().
+ set_active_ui_language(language);
+
+ LOG4CXX_DEBUG(logger_, "Raising event for function_id "
+ << function_id()
+ << " and correlation_id " << correlation_id());
+ event_engine::Event event(FunctionID::UI_GetLanguage);
+ event.set_smart_object(*message_);
+ event.raise();
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc
index b587a3028e..19612470b7 100644
--- a/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc
+++ b/src/components/application_manager/src/commands/hmi/ui_set_icon_request.cc
@@ -44,7 +44,7 @@ UISetIconRequest::~UISetIconRequest() {
}
void UISetIconRequest::Run() {
- LOG4CXX_INFO(logger_, "UISetIconRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
SendRequest();
}
diff --git a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc b/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc
index 5bd2fb853a..1109d85337 100644
--- a/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_change_registration_response.cc
@@ -46,7 +46,7 @@ VRChangeRegistrationResponse::~VRChangeRegistrationResponse() {
}
void VRChangeRegistrationResponse::Run() {
- LOG4CXX_INFO(logger_, "VRChangeRegistratioResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
event_engine::Event event(hmi_apis::FunctionID::VR_ChangeRegistration);
event.set_smart_object(*message_);
diff --git a/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc b/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc
index 62127bdf9b..831fb5040c 100644
--- a/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc
+++ b/src/components/application_manager/src/commands/hmi/vr_get_language_response.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,7 @@
*/
#include "application_manager/commands/hmi/vr_get_language_response.h"
#include "application_manager/application_manager_impl.h"
+#include "application_manager/event_engine/event.h"
#include "interfaces/HMI_API.h"
namespace application_manager {
@@ -46,12 +47,26 @@ VRGetLanguageResponse::~VRGetLanguageResponse() {
void VRGetLanguageResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace hmi_apis;
- HMICapabilities& hmi_capabilities =
- ApplicationManagerImpl::instance()->hmi_capabilities();
- hmi_capabilities.set_active_vr_language(
- static_cast<hmi_apis::Common_Language::eType>(
- (*message_)[strings::msg_params][hmi_response::language].asInt()));
+ Common_Language::eType language = Common_Language::INVALID_ENUM;
+
+ if ((*message_).keyExists(strings::msg_params) &&
+ (*message_)[strings::msg_params].keyExists(hmi_response::language)) {
+
+ language = static_cast<Common_Language::eType>(
+ (*message_)[strings::msg_params][hmi_response::language].asInt());
+ }
+
+ ApplicationManagerImpl::instance()->hmi_capabilities().
+ set_active_vr_language(language);
+
+ LOG4CXX_DEBUG(logger_, "Raising event for function_id "
+ << function_id()
+ << " and correlation_id " << correlation_id());
+ event_engine::Event event(FunctionID::VR_GetLanguage);
+ event.set_smart_object(*message_);
+ event.raise();
}
} // namespace commands
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 da44d0e7c4..9079f34488 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
@@ -37,23 +37,25 @@
#include "application_manager/application.h"
#include "application_manager/message_helper.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
+#include "utils/custom_string.h"
namespace application_manager {
namespace commands {
+namespace custom_str = utils::custom_string;
+
AddCommandRequest::AddCommandRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- send_ui_(false),
- send_vr_(false),
- is_ui_received_(false),
- is_vr_received_(false),
- ui_result_(hmi_apis::Common_Result::INVALID_ENUM),
- vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {
-}
+ : CommandRequestImpl(message)
+ , send_ui_(false)
+ , send_vr_(false)
+ , is_ui_received_(false)
+ , is_vr_received_(false)
+ , ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , vr_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
-AddCommandRequest::~AddCommandRequest() {
-}
+AddCommandRequest::~AddCommandRequest() {}
void AddCommandRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -68,39 +70,37 @@ void AddCommandRequest::Run() {
(*message_)[strings::params][strings::connection_key].asUInt());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "No application associated with session key");
+ LOG4CXX_ERROR(logger_, "No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) {
- mobile_apis::Result::eType verification_result =
- MessageHelper::VerifyImage((*message_)[strings::msg_params]
- [strings::cmd_icon], app);
+ mobile_apis::Result::eType verification_result = MessageHelper::VerifyImage(
+ (*message_)[strings::msg_params][strings::cmd_icon], app);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "MessageHelper::VerifyImage return " << verification_result);
+ LOG4CXX_ERROR(
+ logger_, "MessageHelper::VerifyImage return " << verification_result);
SendResponse(false, verification_result);
return;
}
}
if (!((*message_)[strings::msg_params].keyExists(strings::cmd_id))) {
- LOG4CXX_ERROR_EXT(logger_, "INVALID_DATA");
+ LOG4CXX_ERROR(logger_, "INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
if (app->FindCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asUInt())) {
- LOG4CXX_ERROR_EXT(logger_, "INVALID_ID");
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt())) {
+ LOG4CXX_ERROR(logger_, "INVALID_ID");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
- bool data_exist = false;
+ bool data_exist = false;
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
if (!CheckCommandName(app)) {
@@ -108,21 +108,22 @@ void AddCommandRequest::Run() {
return;
}
if (((*message_)[strings::msg_params][strings::menu_params].keyExists(
- hmi_request::parent_id)) && (0 != (*message_)[strings::msg_params]
- [strings::menu_params][hmi_request::parent_id].asUInt())) {
+ hmi_request::parent_id)) &&
+ (0 !=
+ (*message_)[strings::msg_params][strings::menu_params]
+ [hmi_request::parent_id]
+ .asUInt())) {
if (!CheckCommandParentId(app)) {
- SendResponse(false, mobile_apis::Result::INVALID_ID,
- "Parent ID doesn't exist");
+ SendResponse(
+ false, mobile_apis::Result::INVALID_ID, "Parent ID doesn't exist");
return;
}
}
data_exist = true;
}
- if (((*message_)[strings::msg_params].keyExists(strings::vr_commands))
- && ((*message_)[strings::msg_params]
- [strings::vr_commands].length() > 0)) {
-
+ if (((*message_)[strings::msg_params].keyExists(strings::vr_commands)) &&
+ ((*message_)[strings::msg_params][strings::vr_commands].length() > 0)) {
if (!CheckCommandVRSynonym(app)) {
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
return;
@@ -132,24 +133,22 @@ void AddCommandRequest::Run() {
}
if (!data_exist) {
- LOG4CXX_ERROR_EXT(logger_, "INVALID_DATA");
+ LOG4CXX_ERROR(logger_, "INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
if (IsWhiteSpaceExist()) {
- LOG4CXX_ERROR(logger_,
- "Incoming add command has contains \t\n \\t \\n");
+ LOG4CXX_ERROR(logger_, "Incoming add command has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
- app->AddCommand((*message_)[strings::msg_params]
- [strings::cmd_id].asUInt(),
- (*message_)[strings::msg_params]);
+ app->AddCommand((*message_)[strings::msg_params][strings::cmd_id].asUInt(),
+ (*message_)[strings::msg_params]);
- smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject ui_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
ui_msg_params[strings::cmd_id] =
(*message_)[strings::msg_params][strings::cmd_id];
@@ -158,10 +157,11 @@ void AddCommandRequest::Run() {
ui_msg_params[strings::app_id] = app->app_id();
- if ( ((*message_)[strings::msg_params].keyExists(strings::cmd_icon))
- && ((*message_)[strings::msg_params][strings::cmd_icon].keyExists(strings::value))
- && (0 < (*message_)[strings::msg_params][strings::cmd_icon]
- [strings::value].length())) {
+ if (((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) &&
+ ((*message_)[strings::msg_params][strings::cmd_icon].keyExists(
+ strings::value)) &&
+ (0 < (*message_)[strings::msg_params][strings::cmd_icon][strings::value]
+ .length())) {
ui_msg_params[strings::cmd_icon] =
(*message_)[strings::msg_params][strings::cmd_icon];
}
@@ -169,8 +169,8 @@ void AddCommandRequest::Run() {
send_ui_ = true;
}
- smart_objects::SmartObject vr_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject vr_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if ((*message_)[strings::msg_params].keyExists(strings::vr_commands)) {
vr_msg_params[strings::cmd_id] =
(*message_)[strings::msg_params][strings::cmd_id];
@@ -203,27 +203,30 @@ bool AddCommandRequest::CheckCommandName(ApplicationConstSharedPtr app) {
CommandsMap::const_iterator i = commands.begin();
uint32_t saved_parent_id = 0;
uint32_t parent_id = 0;
- if ((*message_)[strings::msg_params]
- [strings::menu_params].keyExists(hmi_request::parent_id)) {
- parent_id = (*message_)[strings::msg_params]
- [strings::menu_params][hmi_request::parent_id].asUInt();
+ if ((*message_)[strings::msg_params][strings::menu_params].keyExists(
+ hmi_request::parent_id)) {
+ parent_id = (*message_)[strings::msg_params][strings::menu_params]
+ [hmi_request::parent_id]
+ .asUInt();
}
for (; commands.end() != i; ++i) {
-
if (!(*i->second).keyExists(strings::menu_params)) {
continue;
}
saved_parent_id = 0;
if ((*i->second)[strings::menu_params].keyExists(hmi_request::parent_id)) {
- saved_parent_id = (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt();
+ saved_parent_id =
+ (*i->second)[strings::menu_params][hmi_request::parent_id].asUInt();
}
- if (((*i->second)[strings::menu_params][strings::menu_name].asString()
- == (*message_)[strings::msg_params][strings::menu_params]
- [strings::menu_name].asString()) &&
+ if (((*i->second)[strings::menu_params][strings::menu_name].asString() ==
+ (*message_)[strings::msg_params][strings::menu_params]
+ [strings::menu_name]
+ .asString()) &&
(saved_parent_id == parent_id)) {
- LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandName received"
+ LOG4CXX_INFO(logger_,
+ "AddCommandRequest::CheckCommandName received"
" command name already exist in same level menu");
return false;
}
@@ -241,23 +244,23 @@ bool AddCommandRequest::CheckCommandVRSynonym(ApplicationConstSharedPtr app) {
CommandsMap::const_iterator it = commands.begin();
for (; commands.end() != it; ++it) {
-
- if(!(*it->second).keyExists(strings::vr_commands)) {
+ if (!(*it->second).keyExists(strings::vr_commands)) {
continue;
}
for (size_t i = 0; i < (*it->second)[strings::vr_commands].length(); ++i) {
for (size_t j = 0;
- j < (*message_)[strings::msg_params][strings::vr_commands].length();
- ++j) {
- std::string vr_cmd_i =
- (*it->second)[strings::vr_commands][i].asString();
- std::string vr_cmd_j =
- (*message_)[strings::msg_params]
- [strings::vr_commands][j].asString();
-
- if (0 == strcasecmp(vr_cmd_i.c_str(), vr_cmd_j.c_str())) {
- LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandVRSynonym"
+ j < (*message_)[strings::msg_params][strings::vr_commands].length();
+ ++j) {
+ const custom_str::CustomString& vr_cmd_i =
+ (*it->second)[strings::vr_commands][i].asCustomString();
+ const custom_str::CustomString& vr_cmd_j =
+ (*message_)[strings::msg_params][strings::vr_commands][j]
+ .asCustomString();
+
+ if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) {
+ LOG4CXX_INFO(logger_,
+ "AddCommandRequest::CheckCommandVRSynonym"
" received command vr synonym already exist");
return false;
}
@@ -274,11 +277,13 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
const int32_t parent_id =
(*message_)[strings::msg_params][strings::menu_params]
- [hmi_request::parent_id].asInt();
+ [hmi_request::parent_id]
+ .asInt();
smart_objects::SmartObject* parent = app->FindSubMenu(parent_id);
if (!parent) {
- LOG4CXX_INFO(logger_, "AddCommandRequest::CheckCommandParentId received"
+ LOG4CXX_INFO(logger_,
+ "AddCommandRequest::CheckCommandParentId received"
" submenu doesn't exist");
return false;
}
@@ -287,6 +292,7 @@ bool AddCommandRequest::CheckCommandParentId(ApplicationConstSharedPtr app) {
void AddCommandRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
@@ -299,7 +305,8 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
}
smart_objects::SmartObject msg_param(smart_objects::SmartType_Map);
- msg_param[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id];
+ msg_param[strings::cmd_id] =
+ (*message_)[strings::msg_params][strings::cmd_id];
msg_param[strings::app_id] = application->app_id();
switch (event.id()) {
@@ -326,79 +333,104 @@ void AddCommandRequest::on_event(const event_engine::Event& event) {
break;
}
default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
return;
}
}
- if (!IsPendingResponseExist()) {
-
- ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ if (IsPendingResponseExist()) {
+ return;
+ }
- if (hmi_apis::Common_Result::REJECTED == ui_result_) {
- RemoveCommand();
- }
+ if (hmi_apis::Common_Result::REJECTED == ui_result_) {
+ RemoveCommand();
+ }
- smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
- msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id];
- msg_params[strings::app_id] = application->app_id();
-
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
-
- bool result = ((hmi_apis::Common_Result::SUCCESS == ui_result_) &&
- (hmi_apis::Common_Result::SUCCESS == vr_result_)) ||
- ((hmi_apis::Common_Result::SUCCESS == ui_result_) &&
- (hmi_apis::Common_Result::INVALID_ENUM == vr_result_ ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == vr_result_)) ||
- ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_ ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_ ) &&
- (hmi_apis::Common_Result::SUCCESS == vr_result_));
-
- if (!result && (hmi_apis::Common_Result::REJECTED == ui_result_)) {
- result_code = static_cast<mobile_apis::Result::eType>(ui_result_);
- } else {
- result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, vr_result_));
- }
+ smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
+ msg_params[strings::cmd_id] =
+ (*message_)[strings::msg_params][strings::cmd_id];
+ msg_params[strings::app_id] = application->app_id();
+
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+
+ const bool is_vr_invalid_unsupported =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
+
+ const bool is_ui_ivalid_unsupported =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
+
+ const bool is_no_ui_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_no_vr_error = Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
+ bool result = (is_no_ui_error && is_no_vr_error) ||
+ (is_no_ui_error && is_vr_invalid_unsupported) ||
+ (is_no_vr_error && is_ui_ivalid_unsupported);
+
+ const bool is_vr_or_ui_warning =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::WARNINGS, ui_result_, vr_result_);
+
+ if (!result && hmi_apis::Common_Result::REJECTED == ui_result_) {
+ result_code = MessageHelper::HMIToMobileResult(ui_result_);
+ } else if (is_vr_or_ui_warning) {
+ result_code = mobile_apis::Result::WARNINGS;
+ } else {
+ result_code =
+ MessageHelper::HMIToMobileResult(std::max(ui_result_, vr_result_));
+ }
- if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) {
- if (hmi_apis::Common_Result::SUCCESS != ui_result_ &&
- hmi_apis::Common_Result::WARNINGS != ui_result_ &&
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE != ui_result_) {
+ if (BothSend() && hmi_apis::Common_Result::SUCCESS == vr_result_) {
+ const bool is_ui_not_ok = Compare<hmi_apis::Common_Result::eType, NEQ, ALL>(
+ ui_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
- result_code =
- (ui_result_ == hmi_apis::Common_Result::REJECTED) ?
- mobile_apis::Result::REJECTED : mobile_apis::Result::GENERIC_ERROR;
+ if (is_ui_not_ok) {
+ result_code = ui_result_ == hmi_apis::Common_Result::REJECTED
+ ? mobile_apis::Result::REJECTED
+ : mobile_apis::Result::GENERIC_ERROR;
- msg_params[strings::grammar_id] = application->get_grammar_id();
- msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
+ msg_params[strings::grammar_id] = application->get_grammar_id();
+ msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
- application->RemoveCommand((*message_)[strings::msg_params]
- [strings::cmd_id].asUInt());
- result = false;
- }
+ SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
+ application->RemoveCommand(
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt());
+ result = false;
}
+ }
- if(BothSend() && hmi_apis::Common_Result::SUCCESS == ui_result_ &&
- hmi_apis::Common_Result::SUCCESS != vr_result_) {
+ if (BothSend() && hmi_apis::Common_Result::SUCCESS == ui_result_ &&
+ !is_no_vr_error) {
+ result_code = vr_result_ == hmi_apis::Common_Result::REJECTED
+ ? mobile_apis::Result::REJECTED
+ : mobile_apis::Result::GENERIC_ERROR;
- result_code =
- (vr_result_ == hmi_apis::Common_Result::REJECTED) ?
- mobile_apis::Result::REJECTED : mobile_apis::Result::GENERIC_ERROR;
+ SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
- SendHMIRequest(hmi_apis::FunctionID::UI_DeleteCommand, &msg_params);
+ application->RemoveCommand(
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt());
+ result = false;
+ }
- application->RemoveCommand((*message_)[strings::msg_params]
- [strings::cmd_id].asUInt());
- result = false;
- }
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- if (true == result) {
- application->UpdateHash();
- }
+ if (result) {
+ application->UpdateHash();
}
}
@@ -412,7 +444,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
if ((*message_)[strings::msg_params].keyExists(strings::menu_params)) {
str = (*message_)[strings::msg_params][strings::menu_params]
- [strings::menu_name].asCharArray();
+ [strings::menu_name]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid menu name syntax check failed.");
return true;
@@ -424,8 +457,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
(*message_)[strings::msg_params][strings::vr_commands].length();
for (size_t i = 0; i < len; ++i) {
- str = (*message_)[strings::msg_params]
- [strings::vr_commands][i].asCharArray();
+ str = (*message_)[strings::msg_params][strings::vr_commands][i]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid vr_commands syntax check failed");
return true;
@@ -434,8 +467,8 @@ bool AddCommandRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::cmd_icon)) {
- str = (*message_)[strings::msg_params]
- [strings::cmd_icon][strings::value].asCharArray();
+ str = (*message_)[strings::msg_params][strings::cmd_icon][strings::value]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_, "Invalid cmd_icon value syntax check failed");
return true;
@@ -450,19 +483,20 @@ bool AddCommandRequest::BothSend() const {
void AddCommandRequest::RemoveCommand() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- connection_key());
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app.valid()) {
LOG4CXX_ERROR(logger_, "No application associated with session key");
return;
}
smart_objects::SmartObject msg_params(smart_objects::SmartType_Map);
- msg_params[strings::cmd_id] = (*message_)[strings::msg_params][strings::cmd_id];
+ msg_params[strings::cmd_id] =
+ (*message_)[strings::msg_params][strings::cmd_id];
msg_params[strings::app_id] = app->app_id();
- app->RemoveCommand((*message_)[strings::msg_params]
- [strings::cmd_id].asUInt());
+ app->RemoveCommand(
+ (*message_)[strings::msg_params][strings::cmd_id].asUInt());
if (BothSend() && !(is_vr_received_ || is_ui_received_)) {
// in case we have send bth UI and VR and no one respond
@@ -479,7 +513,6 @@ void AddCommandRequest::RemoveCommand() {
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
}
-
}
} // namespace commands
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 f01645079c..6f2529bfee 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
@@ -34,23 +34,22 @@
#include "application_manager/commands/mobile/add_sub_menu_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
AddSubMenuRequest::AddSubMenuRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ : CommandRequestImpl(message) {}
-AddSubMenuRequest::~AddSubMenuRequest() {
-}
+AddSubMenuRequest::~AddSubMenuRequest() {}
void AddSubMenuRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -58,34 +57,37 @@ void AddSubMenuRequest::Run() {
return;
}
- if (app->FindSubMenu(
- (*message_)[strings::msg_params][strings::menu_id].asInt())) {
- LOG4CXX_ERROR(logger_, "INVALID_ID");
+ const int32_t menu_id =
+ (*message_)[strings::msg_params][strings::menu_id].asInt();
+ if (app->FindSubMenu(menu_id)) {
+ LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
- if (app->IsSubMenuNameAlreadyExist(
- (*message_)[strings::msg_params][strings::menu_name].asString())) {
- LOG4CXX_ERROR(logger_, "DUPLICATE_NAME");
+ const std::string& menu_name =
+ (*message_)[strings::msg_params][strings::menu_name].asString();
+
+ if (app->IsSubMenuNameAlreadyExist(menu_name)) {
+ LOG4CXX_ERROR(logger_, "Menu name " << menu_name << " is duplicated.");
SendResponse(false, mobile_apis::Result::DUPLICATE_NAME);
return;
}
if (!CheckSubMenuName()) {
- LOG4CXX_ERROR(logger_, "SubMenuName is not valid");
+ LOG4CXX_ERROR(logger_, "Sub-menu name is not valid.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::menu_id] =
(*message_)[strings::msg_params][strings::menu_id];
if ((*message_)[strings::msg_params].keyExists(strings::position)) {
- msg_params[strings::menu_params][strings::position] =
- (*message_)[strings::msg_params][strings::position];
+ msg_params[strings::menu_params][strings::position] =
+ (*message_)[strings::msg_params][strings::position];
}
msg_params[strings::menu_params][strings::menu_name] =
(*message_)[strings::msg_params][strings::menu_name];
@@ -96,6 +98,7 @@ void AddSubMenuRequest::Run() {
void AddSubMenuRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -104,10 +107,13 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result = mobile_apis::Result::SUCCESS == result_code;
+ const bool result = Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -115,10 +121,10 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
}
if (result) {
- application->AddSubMenu((*message_)[strings::msg_params]
- [strings::menu_id].asInt(),
- (*message_)[strings::msg_params]);
- }
+ application->AddSubMenu(
+ (*message_)[strings::msg_params][strings::menu_id].asInt(),
+ (*message_)[strings::msg_params]);
+ }
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
if (result) {
application->UpdateHash();
@@ -133,6 +139,7 @@ void AddSubMenuRequest::on_event(const event_engine::Event& event) {
}
bool AddSubMenuRequest::CheckSubMenuName() {
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::menu_name].asCharArray();
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 f1575a1a4b..bc63669e22 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
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,11 +30,13 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string.h>
+#include <cstring>
+#include <string>
#include "application_manager/commands/mobile/alert_maneuver_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -131,9 +132,9 @@ void AlertManeuverRequest::Run() {
void AlertManeuverRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
hmi_apis::FunctionID::eType event_id = event.id();
switch (event_id) {
case hmi_apis::FunctionID::Navigation_AlertManeuver: {
@@ -167,45 +168,67 @@ void AlertManeuverRequest::on_event(const event_engine::Event& event) {
}
default: {
LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
- SendResponse(false, result_code, "Received unknown event");
+ SendResponse(false, mobile_apis::Result::INVALID_ENUM,
+ "Received unknown event");
return;
}
}
- if (pending_requests_.IsFinal(event_id)) {
-
- bool result = ((hmi_apis::Common_Result::SUCCESS ==
- static_cast<hmi_apis::Common_Result::eType>(tts_speak_result_code_) ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE ==
- static_cast<hmi_apis::Common_Result::eType>(tts_speak_result_code_) ||
- (hmi_apis::Common_Result::INVALID_ENUM ==
- static_cast<hmi_apis::Common_Result::eType>(tts_speak_result_code_))) &&
- (hmi_apis::Common_Result::SUCCESS ==
- static_cast<hmi_apis::Common_Result::eType>(navi_alert_maneuver_result_code_))) ||
- (hmi_apis::Common_Result::SUCCESS == static_cast<hmi_apis::Common_Result::eType>(
- tts_speak_result_code_) && hmi_apis::Common_Result::UNSUPPORTED_RESOURCE ==
- static_cast<hmi_apis::Common_Result::eType>(navi_alert_maneuver_result_code_));
-
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(std::max(tts_speak_result_code_,
- navi_alert_maneuver_result_code_));
-
- const char* return_info = NULL;
-
- if (result && hmi_apis::Common_Result::UNSUPPORTED_RESOURCE ==
- static_cast<hmi_apis::Common_Result::eType>(tts_speak_result_code_)) {
- result_code = mobile_apis::Result::WARNINGS;
- return_info =
- std::string("Unsupported phoneme type sent in a prompt").c_str();
- }
+ if (!pending_requests_.IsFinal(event_id)) {
+ LOG4CXX_DEBUG(logger_,
+ "There are some pending responses from HMI."
+ "AlertManeuverRequest still waiting.");
+ return;
+ }
- SendResponse(result, result_code, return_info,
- &(message[strings::msg_params]));
- } else {
- LOG4CXX_INFO(logger_,
- "There are some pending responses from HMI."
- "AlertManeuverRequest still waiting.");
+ hmi_apis::Common_Result::eType tts_result =
+ MessageHelper::MobileToHMIResult(tts_speak_result_code_);
+
+ hmi_apis::Common_Result::eType navi_result =
+ MessageHelper::MobileToHMIResult(navi_alert_maneuver_result_code_);
+
+ const bool is_tts_ok =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ tts_result,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ hmi_apis::Common_Result::WARNINGS,
+ hmi_apis::Common_Result::INVALID_ENUM);
+
+ const bool is_no_navi_error =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ navi_result,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
+ const bool result =
+ (is_tts_ok && is_no_navi_error) ||
+ (hmi_apis::Common_Result::SUCCESS == tts_result &&
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == navi_result );
+
+ mobile_apis::Result::eType result_code =
+ static_cast<mobile_apis::Result::eType>(
+ std::max(tts_speak_result_code_, navi_alert_maneuver_result_code_));
+
+ std::string return_info =
+ message[strings::msg_params][hmi_response::message].asString();
+
+ const bool is_tts_or_navi_warning =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::WARNINGS,
+ tts_result,
+ navi_result);
+
+ if (result &&
+ (is_tts_or_navi_warning ||
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result)) {
+ result_code = mobile_apis::Result::WARNINGS;
+ return_info =
+ std::string("Unsupported phoneme type sent in a prompt");
}
+
+ SendResponse(result, result_code, return_info.c_str(),
+ &(message[strings::msg_params]));
}
bool AlertManeuverRequest::IsWhiteSpaceExist() {
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 ccabe4e177..2c0c798fd1 100644
--- a/src/components/application_manager/src/commands/mobile/alert_request.cc
+++ b/src/components/application_manager/src/commands/mobile/alert_request.cc
@@ -38,7 +38,7 @@
#include "application_manager/message_helper.h"
#include "application_manager/application_impl.h"
#include "application_manager/application_manager_impl.h"
-
+#include "utils/helpers.h"
namespace application_manager {
@@ -51,10 +51,10 @@ AlertRequest::AlertRequest(const MessageSharedPtr& message)
awaiting_ui_alert_response_(false),
awaiting_tts_speak_response_(false),
awaiting_tts_stop_speaking_response_(false),
- response_success_(false),
- flag_other_component_sent_(false),
- response_result_(mobile_apis::Result::INVALID_ENUM),
- tts_speak_response_(mobile_apis::Result::INVALID_ENUM) {
+ is_alert_succeeded_(false),
+ is_ui_alert_sent_(false),
+ alert_result_(mobile_apis::Result::INVALID_ENUM),
+ tts_speak_result_(mobile_apis::Result::INVALID_ENUM) {
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
subscribe_on_event(hmi_apis::FunctionID::TTS_OnResetTimeout);
}
@@ -93,30 +93,39 @@ void AlertRequest::Run() {
// Invalid command, abort execution
return;
}
+ bool tts_chunks_exists = (*message_)[strings::msg_params].keyExists(strings::tts_chunks);
+ size_t length_tts_chunks = 0;
- if ((*message_)[strings::msg_params].keyExists(strings::tts_chunks)) {
- if (0 < (*message_)[strings::msg_params][strings::tts_chunks].length()) {
- awaiting_tts_speak_response_ = true;
- }
+ if (tts_chunks_exists) {
+ length_tts_chunks = (*message_)[strings::msg_params][strings::tts_chunks].length();
+ }
+
+ if ((tts_chunks_exists && length_tts_chunks) ||
+ ((*message_)[strings::msg_params].keyExists(strings::play_tone) &&
+ (*message_)[strings::msg_params][strings::play_tone].asBool())) {
+ awaiting_tts_speak_response_ = true;
}
+
SendAlertRequest(app_id);
- SendPlayToneNotification(app_id);
if (awaiting_tts_speak_response_) {
- SendSpeakRequest(app_id);
+ SendSpeakRequest(app_id, tts_chunks_exists, length_tts_chunks);
}
}
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");
+ 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_);
+ using namespace helpers;
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -146,10 +155,17 @@ void AlertRequest::on_event(const event_engine::Event& event) {
static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
// Mobile Alert request is successful when UI_Alert is successful
- response_success_ = (mobile_apis::Result::SUCCESS == result_code ||
- mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code);
- response_result_ = result_code;
- response_params_ = message[strings::msg_params];
+
+ const bool is_alert_ok =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE,
+ mobile_apis::Result::WARNINGS);
+
+ is_alert_succeeded_ = is_alert_ok;
+ alert_result_ = result_code;
+ alert_response_params_ = message[strings::msg_params];
break;
}
case hmi_apis::FunctionID::TTS_Speak: {
@@ -157,7 +173,7 @@ void AlertRequest::on_event(const event_engine::Event& event) {
// Unsubscribe from event to avoid unwanted messages
unsubscribe_from_event(hmi_apis::FunctionID::TTS_Speak);
awaiting_tts_speak_response_ = false;
- tts_speak_response_ = static_cast<mobile_apis::Result::eType>(
+ tts_speak_result_ = static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
break;
}
@@ -173,48 +189,71 @@ void AlertRequest::on_event(const event_engine::Event& event) {
return;
}
}
- if (!HasHmiResponsesToWait()) {
- std::string response_info("");
- if ((mobile_apis::Result::UNSUPPORTED_RESOURCE == tts_speak_response_) &&
- (!flag_other_component_sent_)) {
- response_success_ = false;
- response_result_ = mobile_apis::Result::WARNINGS;
- response_info = "Unsupported phoneme type sent in a prompt";
- } else if ((mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- tts_speak_response_) && (mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- response_result_)) {
- response_result_ = mobile_apis::Result::WARNINGS;
- response_info = "Unsupported phoneme type sent in a prompt and "
- "unsupported image sent in soft buttons";
- } else if ((mobile_apis::Result::UNSUPPORTED_RESOURCE ==
- tts_speak_response_) && (mobile_apis::Result::SUCCESS ==
- response_result_)) {
- response_result_ = mobile_apis::Result::WARNINGS;
- response_info = "Unsupported phoneme type sent in a prompt";
- } else if ((mobile_apis::Result::SUCCESS == tts_speak_response_) &&
- ((mobile_apis::Result::INVALID_ENUM == response_result_) &&
- (!flag_other_component_sent_))) {
- response_result_ = mobile_apis::Result::SUCCESS;
- response_success_ = true;
- }
- if (((mobile_apis::Result::ABORTED == tts_speak_response_ )||
- (mobile_apis::Result::REJECTED == tts_speak_response_)) &&
- (!flag_other_component_sent_)) {
- response_success_ = false;
- response_result_ = tts_speak_response_;
- }
- SendResponse(response_success_, response_result_,
- response_info.empty() ? NULL : response_info.c_str(),
- &response_params_);
+ if (HasHmiResponsesToWait()) {
+ return;
+ }
+
+ const bool is_tts_alert_unsupported =
+ Compare<mobile_api::Result::eType, EQ, ALL>(
+ mobile_api::Result::UNSUPPORTED_RESOURCE,
+ tts_speak_result_,
+ alert_result_);
+
+ const bool is_alert_ok =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ alert_result_,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
+
+ std::string response_info;
+ if (mobile_apis::Result::UNSUPPORTED_RESOURCE == tts_speak_result_ &&
+ !is_ui_alert_sent_) {
+ is_alert_succeeded_ = false;
+ alert_result_ = mobile_apis::Result::WARNINGS;
+ response_info = "Unsupported phoneme type sent in a prompt";
+ } else if (is_tts_alert_unsupported) {
+ alert_result_ = mobile_apis::Result::WARNINGS;
+ response_info = "Unsupported phoneme type sent in a prompt and "
+ "unsupported image sent in soft buttons";
+ } else if (mobile_apis::Result::UNSUPPORTED_RESOURCE == tts_speak_result_ &&
+ is_alert_ok) {
+ alert_result_ = mobile_apis::Result::WARNINGS;
+ response_info = "Unsupported phoneme type sent in a prompt";
+ } else if (mobile_apis::Result::SUCCESS == tts_speak_result_ &&
+ (mobile_apis::Result::INVALID_ENUM == alert_result_ &&
+ !is_ui_alert_sent_)) {
+ alert_result_ = mobile_apis::Result::SUCCESS;
+ is_alert_succeeded_ = true;
}
+
+ const bool is_tts_not_ok =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ tts_speak_result_,
+ mobile_api::Result::ABORTED,
+ mobile_api::Result::REJECTED);
+
+ if (is_tts_not_ok && !is_ui_alert_sent_) {
+ is_alert_succeeded_ = false;
+ alert_result_ = tts_speak_result_;
+ }
+
+ if (mobile_apis::Result::WARNINGS == tts_speak_result_) {
+ alert_result_ = mobile_apis::Result::WARNINGS;
+ }
+
+ SendResponse(is_alert_succeeded_, alert_result_,
+ response_info.empty() ? NULL : response_info.c_str(),
+ &alert_response_params_);
}
bool AlertRequest::Validate(uint32_t app_id) {
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "No application associated with session key");
+ LOG4CXX_ERROR(logger_, "No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -224,7 +263,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
static_cast<mobile_apis::FunctionID::eType>(function_id()),
application_manager::TLimitSource::POLICY_TABLE)) {
LOG4CXX_ERROR(logger_, "Alert frequency is too high.");
- SendResponse(false, mobile_apis::Result::REJECTED);
+ SendResponse(false, mobile_apis::Result::REJECTED);
return false;
}
@@ -250,7 +289,7 @@ bool AlertRequest::Validate(uint32_t app_id) {
&& (!(*message_)[strings::msg_params].keyExists(strings::tts_chunks)
&& (1 > (*message_)[strings::msg_params]
[strings::tts_chunks].length()))) {
- LOG4CXX_ERROR_EXT(logger_, "Mandatory parameters are missing");
+ LOG4CXX_ERROR(logger_, "Mandatory parameters are missing");
SendResponse(false, mobile_apis::Result::INVALID_DATA,
"Mandatory parameters are missing");
return false;
@@ -260,7 +299,9 @@ bool AlertRequest::Validate(uint32_t app_id) {
}
void AlertRequest::SendAlertRequest(int32_t app_id) {
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
smart_objects::SmartObject msg_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
@@ -318,42 +359,33 @@ void AlertRequest::SendAlertRequest(int32_t app_id) {
msg_params.keyExists(hmi_request::soft_buttons)) {
awaiting_ui_alert_response_ = true;
- flag_other_component_sent_ = true;
+ is_ui_alert_sent_ = true;
SendHMIRequest(hmi_apis::FunctionID::UI_Alert, &msg_params, true);
}
}
-void AlertRequest::SendSpeakRequest(int32_t app_id) {
+void AlertRequest::SendSpeakRequest(int32_t app_id, bool tts_chunks_exists,
+ size_t length_tts_chunks) {
+ LOG4CXX_AUTO_TRACE(logger_);
using namespace hmi_apis;
using namespace smart_objects;
// crate HMI speak request
SmartObject msg_params = smart_objects::SmartObject(SmartType_Map);
-
- msg_params[hmi_request::tts_chunks] = smart_objects::SmartObject(SmartType_Array);
- msg_params[hmi_request::tts_chunks] =
- (*message_)[strings::msg_params][strings::tts_chunks];
+ if (tts_chunks_exists && length_tts_chunks) {
+ msg_params[hmi_request::tts_chunks] =
+ smart_objects::SmartObject(SmartType_Array);
+ msg_params[hmi_request::tts_chunks] =
+ (*message_)[strings::msg_params][strings::tts_chunks];
+ }
+ if ((*message_)[strings::msg_params].keyExists(strings::play_tone) &&
+ (*message_)[strings::msg_params][strings::play_tone].asBool()) {
+ msg_params[strings::play_tone] = true;
+ }
msg_params[strings::app_id] = app_id;
msg_params[hmi_request::speak_type] = Common_MethodName::ALERT;
SendHMIRequest(FunctionID::TTS_Speak, &msg_params, true);
}
-void AlertRequest::SendPlayToneNotification(int32_t app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- using namespace hmi_apis;
- using namespace smart_objects;
-
- // check playtone parameter
- if ((*message_)[strings::msg_params].keyExists(strings::play_tone)) {
- if ((*message_)[strings::msg_params][strings::play_tone].asBool()) {
- // crate HMI basic communication playtone request
- SmartObject msg_params = smart_objects::SmartObject(SmartType_Map);
- msg_params[strings::app_id] = app_id;
- msg_params[strings::method_name] = Common_MethodName::ALERT;
- CreateHMINotification(FunctionID::BasicCommunication_PlayTone, msg_params);
- }
- }
-}
-
bool AlertRequest::CheckStringsOfAlertRequest() {
LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
@@ -397,6 +429,7 @@ bool AlertRequest::CheckStringsOfAlertRequest() {
}
bool AlertRequest::HasHmiResponsesToWait() {
+ LOG4CXX_AUTO_TRACE(logger_);
return awaiting_ui_alert_response_ || awaiting_tts_speak_response_
|| awaiting_tts_stop_speaking_response_;
}
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 89b2dbaf00..0109d3235b 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
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,26 +36,39 @@
#include "application_manager/commands/mobile/change_registration_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
+#include "application_manager/policies/policy_handler.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+namespace {
+namespace custom_str = utils::custom_string;
+struct IsSameNickname {
+ IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {}
+ bool operator()(const policy::StringArray::value_type& nickname) const {
+ return app_id_.CompareIgnoreCase(nickname.c_str());
+ }
+
+ private:
+ const custom_str::CustomString& app_id_;
+};
+}
+
namespace application_manager {
namespace commands {
ChangeRegistrationRequest::ChangeRegistrationRequest(
const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- ui_result_(hmi_apis::Common_Result::INVALID_ENUM),
- vr_result_(hmi_apis::Common_Result::INVALID_ENUM),
- tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {
-}
+ : CommandRequestImpl(message)
+ , ui_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , vr_result_(hmi_apis::Common_Result::INVALID_ENUM)
+ , tts_result_(hmi_apis::Common_Result::INVALID_ENUM) {}
-ChangeRegistrationRequest::~ChangeRegistrationRequest() {
-}
+ChangeRegistrationRequest::~ChangeRegistrationRequest() {}
void ChangeRegistrationRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace smart_objects;
ApplicationManagerImpl* instance = ApplicationManagerImpl::instance();
const HMICapabilities& hmi_capabilities = instance->hmi_capabilities();
@@ -91,90 +104,84 @@ void ChangeRegistrationRequest::Run() {
tts_result_ = hmi_apis::Common_Result::UNSUPPORTED_RESOURCE;
}
+ SmartObject& msg_params = (*message_)[strings::msg_params];
+
const int32_t hmi_language =
- (*message_)[strings::msg_params][strings::hmi_display_language].asInt();
+ msg_params[strings::hmi_display_language].asInt();
- const int32_t language =
- (*message_)[strings::msg_params][strings::language].asInt();
+ const int32_t language = msg_params[strings::language].asInt();
- if (false ==
- (IsLanguageSupportedByUI(hmi_language) &&
- IsLanguageSupportedByVR(language) &&
- IsLanguageSupportedByTTS(language))) {
+ if (false == (IsLanguageSupportedByUI(hmi_language) &&
+ IsLanguageSupportedByVR(language) &&
+ IsLanguageSupportedByTTS(language))) {
LOG4CXX_ERROR(logger_, "Language is not supported");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
+ if (msg_params.keyExists(strings::app_name) &&
+ !IsNicknameAllowed(msg_params[strings::app_name].asCustomString())) {
+ LOG4CXX_ERROR(logger_, "Nickname is not allowed.");
+ SendResponse(false, mobile_apis::Result::DISALLOWED);
+ 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);
// UI processing
- smart_objects::SmartObject ui_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ SmartObject ui_params = SmartObject(SmartType_Map);
ui_params[strings::language] = hmi_language;
ui_params[strings::app_id] = app->app_id();
- if ((*message_)[strings::msg_params].keyExists(strings::app_name)) {
- ui_params[strings::app_name] =
- (*message_)[strings::msg_params][strings::app_name];
- app->set_name((*message_)[strings::msg_params][strings::app_name].asString());
+ 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 ((*message_)[strings::msg_params].keyExists(
- strings::ngn_media_screen_app_name)) {
+ if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
ui_params[strings::ngn_media_screen_app_name] =
- (*message_)[strings::msg_params][strings::ngn_media_screen_app_name];
- app->set_ngn_media_screen_name((*message_)[strings::msg_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]);
}
- SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration,
- &ui_params, true);
+ SendHMIRequest(hmi_apis::FunctionID::UI_ChangeRegistration, &ui_params, true);
// VR processing
- smart_objects::SmartObject vr_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ SmartObject vr_params = SmartObject(SmartType_Map);
- vr_params[strings::language] =
- (*message_)[strings::msg_params][strings::language];
+ vr_params[strings::language] = msg_params[strings::language];
vr_params[strings::app_id] = app->app_id();
- if ((*message_)[strings::msg_params].keyExists(strings::vr_synonyms)) {
- vr_params[strings::vr_synonyms] = (*message_)[strings::msg_params]
- [strings::vr_synonyms];
- app -> set_vr_synonyms((*message_)[strings::msg_params][strings::vr_synonyms]);
+ 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]);
}
- SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration,
- &vr_params, true);
+ SendHMIRequest(hmi_apis::FunctionID::VR_ChangeRegistration, &vr_params, true);
// TTS processing
- smart_objects::SmartObject tts_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ SmartObject tts_params = SmartObject(SmartType_Map);
- tts_params[strings::language] =
- (*message_)[strings::msg_params][strings::language];
+ tts_params[strings::language] = msg_params[strings::language];
tts_params[strings::app_id] = app->app_id();
- if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) {
- tts_params[strings::tts_name] = (*message_)[strings::msg_params]
- [strings::tts_name];
- app->set_tts_name((*message_)[strings::msg_params][strings::tts_name]);
+ 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]);
}
- SendHMIRequest(hmi_apis::FunctionID::TTS_ChangeRegistration,
- &tts_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::TTS_ChangeRegistration, &tts_params, true);
}
bool ChangeRegistrationRequest::AllHmiResponsesSuccess(
- const hmi_apis::Common_Result::eType ui,
- const hmi_apis::Common_Result::eType vr,
- const hmi_apis::Common_Result::eType tts) {
-
- return
- hmi_apis::Common_Result::SUCCESS == ui &&
- hmi_apis::Common_Result::SUCCESS == vr &&
- hmi_apis::Common_Result::SUCCESS == tts;
+ const hmi_apis::Common_Result::eType ui,
+ const hmi_apis::Common_Result::eType vr,
+ const hmi_apis::Common_Result::eType tts) {
+ return hmi_apis::Common_Result::SUCCESS == ui &&
+ hmi_apis::Common_Result::SUCCESS == vr &&
+ hmi_apis::Common_Result::SUCCESS == tts;
}
void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
@@ -222,34 +229,35 @@ void ChangeRegistrationRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS == ui_result_) {
application->set_ui_language(static_cast<mobile_api::Language::eType>(
- (*message_)[strings::msg_params][strings::hmi_display_language].asInt()));
+ (*message_)[strings::msg_params][strings::hmi_display_language]
+ .asInt()));
}
- if (hmi_apis::Common_Result::SUCCESS == vr_result_
- || hmi_apis::Common_Result::SUCCESS == tts_result_) {
+ if (hmi_apis::Common_Result::SUCCESS == vr_result_ ||
+ hmi_apis::Common_Result::SUCCESS == tts_result_) {
application->set_language(static_cast<mobile_api::Language::eType>(
(*message_)[strings::msg_params][strings::language].asInt()));
}
- int32_t greates_result_code = std::max(std::max(ui_result_, vr_result_),
- tts_result_);
+ int32_t greates_result_code =
+ std::max(std::max(ui_result_, vr_result_), tts_result_);
(*message_)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::eType::ChangeRegistrationID;
+ mobile_apis::FunctionID::eType::ChangeRegistrationID;
SendResponse(AllHmiResponsesSuccess(ui_result_, vr_result_, tts_result_),
static_cast<mobile_apis::Result::eType>(greates_result_code),
- NULL, &(message[strings::msg_params]));
+ NULL,
+ &(message[strings::msg_params]));
} else {
LOG4CXX_INFO(logger_,
- "There are some pending responses from HMI."
- "ChangeRegistrationRequest still waiting.");
+ "There are some pending responses from HMI."
+ "ChangeRegistrationRequest still waiting.");
}
}
bool ChangeRegistrationRequest::IsLanguageSupportedByUI(
const int32_t& hmi_display_lang) {
-
const HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
const smart_objects::SmartObject* ui_languages =
@@ -344,10 +352,10 @@ bool ChangeRegistrationRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params].
- keyExists(strings::ngn_media_screen_app_name)) {
- str = (*message_)[strings::msg_params]
- [strings::ngn_media_screen_app_name].asCharArray();
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::ngn_media_screen_app_name)) {
+ str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name]
+ .asCharArray();
if (!CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid ngn_media_screen_app_name syntax check failed");
@@ -380,21 +388,21 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
(*message_)[strings::msg_params];
ApplicationManagerImpl::ApplicationListAccessor accessor;
- std::string app_name;
+ custom_str::CustomString app_name;
uint32_t app_id = connection_key();
if (msg_params.keyExists(strings::app_name)) {
- app_name = msg_params[strings::app_name].asString();
+ app_name = msg_params[strings::app_name].asCustomString();
}
- ApplicationManagerImpl::ApplictionSetConstIt it = accessor.begin();
+ ApplicationSetConstIt it = accessor.begin();
for (; accessor.end() != it; ++it) {
if (app_id == (*it)->app_id()) {
continue;
}
- const std::string& cur_name = (*it)->name();
+ const custom_str::CustomString& cur_name = (*it)->name();
if (msg_params.keyExists(strings::app_name)) {
- if (!strcasecmp(app_name.c_str(), cur_name.c_str())) {
+ if (app_name.CompareIgnoreCase(cur_name)) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
}
@@ -423,10 +431,59 @@ mobile_apis::Result::eType ChangeRegistrationRequest::CheckCoincidence() {
return mobile_apis::Result::DUPLICATE_NAME;
}
} // end vr check
- } // application for end
+ } // application for end
return mobile_apis::Result::SUCCESS;
}
+bool ChangeRegistrationRequest::IsNicknameAllowed(
+ const custom_str::CustomString& app_name) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
+
+ if (!app) {
+ LOG4CXX_ERROR(logger_,
+ "Can't find appication with connection key "
+ << connection_key());
+ return false;
+ }
+
+ const std::string policy_app_id = app->mobile_app_id();
+
+ policy::StringArray app_nicknames;
+ policy::StringArray app_hmi_types;
+
+ bool init_result = policy::PolicyHandler::instance()->GetInitialAppData(
+ policy_app_id, &app_nicknames, &app_hmi_types);
+
+ if (!init_result) {
+ LOG4CXX_ERROR(logger_,
+ "Error during getting of nickname list for application "
+ << policy_app_id);
+ return false;
+ }
+
+ if (!app_nicknames.empty()) {
+ IsSameNickname compare(app_name);
+ policy::StringArray::const_iterator it =
+ std::find_if(app_nicknames.begin(), app_nicknames.end(), compare);
+ if (app_nicknames.end() == it) {
+ LOG4CXX_WARN(logger_,
+ "Application name was not found in nicknames list.");
+
+ usage_statistics::AppCounter count_of_rejections_nickname_mismatch(
+ policy::PolicyHandler::instance()->GetStatisticManager(),
+ policy_app_id,
+ usage_statistics::REJECTIONS_NICKNAME_MISMATCH);
+ ++count_of_rejections_nickname_mismatch;
+
+ return false;
+ }
+ }
+ return true;
+}
+
} // namespace commands
} // namespace application_manager
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 58c6d7e192..9f2f0ba3a1 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
@@ -39,6 +39,8 @@
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "utils/gen_hash.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -60,7 +62,7 @@ void CreateInteractionChoiceSetRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis;
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -86,7 +88,7 @@ void CreateInteractionChoiceSetRequest::Run() {
}
if (verification_result_image == Result::INVALID_DATA ||
verification_result_secondary_image == Result::INVALID_DATA) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, Result::INVALID_DATA);
return;
}
@@ -96,7 +98,8 @@ void CreateInteractionChoiceSetRequest::Run() {
[strings::interaction_choice_set_id].asInt();
if (app->FindChoiceSet(choice_set_id_)) {
- LOG4CXX_ERROR(logger_, "Invalid ID");
+ LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id_ <<
+ " is not found.");
SendResponse(false, Result::INVALID_ID);
return;
}
@@ -114,104 +117,32 @@ void CreateInteractionChoiceSetRequest::Run() {
mobile_apis::Result::eType CreateInteractionChoiceSetRequest::CheckChoiceSet(
ApplicationConstSharedPtr app) {
+ using namespace smart_objects;
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartArray* new_choice_set_array =
- (*message_)[strings::msg_params][strings::choice_set].asArray();
+ std::set<uint32_t> choice_id_set;
- smart_objects::SmartArray::const_iterator it_array =
- new_choice_set_array->begin();
+ const SmartArray* choice_set =
+ (*message_)[strings::msg_params][strings::choice_set].asArray();
- smart_objects::SmartArray::const_iterator it_array_end =
- new_choice_set_array->end();
+ SmartArray::const_iterator choice_set_it = choice_set->begin();
- // Self check of new choice set for params coincidence
- for (; it_array != it_array_end; ++it_array) {
- const smart_objects::SmartArray* vr_array =
- (*it_array)[strings::vr_commands].asArray();
-
- CoincidencePredicateChoiceID c((*it_array)[strings::choice_id].asInt());
- if (1 != std::count_if(
- new_choice_set_array->begin(),
- new_choice_set_array->end(), c)) {
- LOG4CXX_ERROR(logger_, "Incoming choice set has duplicate IDs.");
+ for (; choice_set->end() != choice_set_it; ++choice_set_it) {
+ std::pair<std::set<uint32_t>::iterator, bool> ins_res =
+ choice_id_set.insert((*choice_set_it)[strings::choice_id].asInt());
+ if (!ins_res.second) {
+ LOG4CXX_ERROR(logger_, "Choise with ID "
+ << (*choice_set_it)[strings::choice_id].asInt()
+ << " already exists");
return mobile_apis::Result::INVALID_ID;
}
- // Check new choice set params along with already registered choice sets
- const DataAccessor<ChoiceSetMap> accessor = app->choice_set_map();
- const ChoiceSetMap& app_choice_set_map = accessor.GetData();
- ChoiceSetMap::const_iterator it = app_choice_set_map.begin();
- ChoiceSetMap::const_iterator itEnd = app_choice_set_map.end();
- for (; it != itEnd; ++it) {
- const smart_objects::SmartObject* app_choice_set = it->second;
- if (NULL != app_choice_set) {
- const smart_objects::SmartArray* curr_choice_set =
- (*app_choice_set)[strings::choice_set].asArray();
-
- if (0 != std::count_if(
- curr_choice_set->begin(),
- curr_choice_set->end(),
- c)) {
- LOG4CXX_ERROR(logger_, "Incoming choice ID already exists.");
- return mobile_apis::Result::INVALID_ID;
- }
- }
- }
-
- CoincidencePredicateMenuName m((*it_array)[strings::menu_name].asString());
- if (1 != std::count_if(
- new_choice_set_array->begin(),
- new_choice_set_array->end(),
- m)) {
- LOG4CXX_ERROR(logger_, "Incoming choice set has duplicate menu names.");
- return mobile_apis::Result::DUPLICATE_NAME;
- }
-
- // Check coincidence inside the current choice
-
- smart_objects::SmartArray::const_iterator it_vr = vr_array->begin();
- smart_objects::SmartArray::const_iterator it_vr_end = vr_array->end();
-
- for (; it_vr != it_vr_end; ++it_vr) {
- CoincidencePredicateVRCommands v((*it_vr));
- if (1 != std::count_if(vr_array->begin(), vr_array->end(), v)) {
- LOG4CXX_ERROR(logger_,
- "Incoming choice set has duplicate VR command(s)");
-
- return mobile_apis::Result::DUPLICATE_NAME;
- }
- }
-
- // Check along with VR commands in other choices in the new set
- smart_objects::SmartArray::const_iterator it_same_array =
- new_choice_set_array->begin();
-
- smart_objects::SmartArray::const_iterator it_same_array_end =
- new_choice_set_array->end();
-
- for (; it_same_array != it_same_array_end; ++it_same_array) {
- // Skip check for itself
- if ((*it_array)[strings::choice_id] ==
- (*it_same_array)[strings::choice_id]) {
- continue;
- }
-
- if (compareSynonyms((*it_array), (*it_same_array))) {
- LOG4CXX_ERROR(logger_,
- "Incoming choice set has duplicate VR command(s).");
-
- return mobile_apis::Result::DUPLICATE_NAME;
- }
- }
-
- if (IsWhiteSpaceExist((*it_array))) {
+ if (IsWhiteSpaceExist(*choice_set_it)) {
LOG4CXX_ERROR(logger_,
"Incoming choice set has contains \t\n \\t \\n");
return mobile_apis::Result::INVALID_DATA;
}
}
-
return mobile_apis::Result::SUCCESS;
}
@@ -353,6 +284,7 @@ void CreateInteractionChoiceSetRequest::SendVRAddCommandRequests(
void CreateInteractionChoiceSetRequest::on_event(
const event_engine::Event& event) {
using namespace hmi_apis;
+ using namespace helpers;
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
@@ -364,40 +296,44 @@ void CreateInteractionChoiceSetRequest::on_event(
uint32_t corr_id = static_cast<uint32_t>(message[strings::params]
[strings::correlation_id].asUInt());
- SentCommandsMap::iterator it = sent_commands_map_.find(corr_id);
- if (sent_commands_map_.end() == it) {
- LOG4CXX_WARN(logger_, "HMI response for unknown VR command received");
- return;
- }
+ {
+ sync_primitives::AutoLock commands_lock(vr_commands_lock_);
+ SentCommandsMap::iterator it = sent_commands_map_.find(corr_id);
+ if (sent_commands_map_.end() == it) {
+ LOG4CXX_WARN(logger_, "HMI response for unknown VR command received");
+ return;
+ }
- Common_Result::eType vr_result_ = static_cast<Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- if (Common_Result::SUCCESS == vr_result_) {
- VRCommandInfo& vr_command = it->second;
- vr_command.succesful_response_received_ = true;
- } else {
- LOG4CXX_DEBUG(logger_, "Hmi response is not Success: " << vr_result_
- << ". Stop sending VRAddCommand requests");
- sync_primitives::AutoLock error_lock(error_from_hmi_lock_);
- if (!error_from_hmi_) {
- error_from_hmi_ = true;
- SendResponse(false, GetMobileResultCode(vr_result_));
+
+ Common_Result::eType vr_result = static_cast<Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ const bool is_vr_no_error =
+ Compare<Common_Result::eType, EQ, ONE>(
+ vr_result,
+ Common_Result::SUCCESS,
+ Common_Result::WARNINGS);
+
+ if (is_vr_no_error) {
+ VRCommandInfo& vr_command = it->second;
+ vr_command.succesful_response_received_ = true;
+ } else {
+ LOG4CXX_DEBUG(logger_, "Hmi response is not Success: " << vr_result
+ << ". Stop sending VRAddCommand requests");
+ if (!error_from_hmi_) {
+ error_from_hmi_ = true;
+ SendResponse(false, GetMobileResultCode(vr_result));
+ }
}
}
- // update request timeout for case we send many VR add command requests
- // and HMI has no time to send responses for all of them
- LOG4CXX_DEBUG(logger_, "expected_chs_count_ = " << expected_chs_count_
- << "received_chs_count_ = " << received_chs_count_);
if (received_chs_count_ < expected_chs_count_) {
- sync_primitives::AutoLock timeout_lock_(is_timed_out_lock_);
- if (!is_timed_out_) {
- ApplicationManagerImpl::instance()->updateRequestTimeout(
+ ApplicationManagerImpl::instance()->updateRequestTimeout(
connection_key(), correlation_id(), default_timeout());
- }
- } else {
- OnAllHMIResponsesReceived();
+ LOG4CXX_DEBUG(logger_, "Timeout for request was updated");
+ return;
}
+ OnAllHMIResponsesReceived();
}
}
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 99dd53d177..58fd06532a 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
@@ -36,6 +36,7 @@
#include "application_manager/application_impl.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -57,21 +58,23 @@ DeleteCommandRequest::~DeleteCommandRequest() {
void DeleteCommandRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr application = ApplicationManagerImpl::instance()->
+ application(connection_key());
if (!application) {
- SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
LOG4CXX_ERROR(logger_, "Application is not registered");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- smart_objects::SmartObject* command = application->FindCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asInt());
+ const int32_t cmd_id =
+ (*message_)[strings::msg_params][strings::cmd_id].asInt();
+
+ smart_objects::SmartObject* command = application->FindCommand(cmd_id);
if (!command) {
+ LOG4CXX_ERROR(logger_, "Command with id " << cmd_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
- LOG4CXX_ERROR(logger_, "Invalid ID");
return;
}
@@ -110,23 +113,25 @@ void DeleteCommandRequest::Run() {
void DeleteCommandRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_DeleteCommand: {
- LOG4CXX_INFO(logger_, "Received UI_DeleteCommand event");
is_ui_received_ = true;
- ui_result_ = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
+ const int result = message[strings::params][hmi_response::code].asInt();
+ ui_result_ = static_cast<hmi_apis::Common_Result::eType>(result);
+ LOG4CXX_DEBUG(logger_, "Received UI_DeleteCommand event with result "
+ << MessageHelper::HMIResultToString(ui_result_));
break;
}
case hmi_apis::FunctionID::VR_DeleteCommand: {
- LOG4CXX_INFO(logger_, "Received VR_DeleteCommand event");
is_vr_received_ = true;
- vr_result_ = static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
-
+ const int result = message[strings::params][hmi_response::code].asInt();
+ vr_result_ = static_cast<hmi_apis::Common_Result::eType>(result);
+ LOG4CXX_DEBUG(logger_, "Received VR_DeleteCommand event with result "
+ << MessageHelper::HMIResultToString(vr_result_));
break;
}
default: {
@@ -135,49 +140,86 @@ void DeleteCommandRequest::on_event(const event_engine::Event& event) {
}
}
- if (!IsPendingResponseExist()) {
- ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ if (IsPendingResponseExist()) {
+ LOG4CXX_DEBUG(logger_, "Still awaiting for other responses.");
+ return;
+ }
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL pointer");
- return;
- }
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(connection_key());
- smart_objects::SmartObject* command = application->FindCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asInt());
-
- if (command) {
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
-
- bool result = ((hmi_apis::Common_Result::SUCCESS == ui_result_) &&
- (hmi_apis::Common_Result::SUCCESS == vr_result_)) ||
- ((hmi_apis::Common_Result::SUCCESS == ui_result_) &&
- (hmi_apis::Common_Result::INVALID_ENUM == vr_result_)) ||
- ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_) &&
- (hmi_apis::Common_Result::SUCCESS == vr_result_));
-
- if (result) {
- application->RemoveCommand(
- (*message_)[strings::msg_params][strings::cmd_id].asInt());
- }
-
- if (!result && (hmi_apis::Common_Result::REJECTED == ui_result_)) {
- result_code = static_cast<mobile_apis::Result::eType>(vr_result_);
- } else {
- result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, vr_result_));
- }
-
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
- if (result) {
- application->UpdateHash();
- }
- }
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application is not registered");
+ return;
+ }
+ smart_objects::SmartObject& msg_params = (*message_)[strings::msg_params];
+
+ const int32_t cmd_id = msg_params[strings::cmd_id].asInt();
+
+ smart_objects::SmartObject* command = application->FindCommand(cmd_id);
+
+ if (!command) {
+ LOG4CXX_ERROR(logger_, "Command id " << cmd_id << " not found for "
+ "application with connection key " << connection_key());
+ return;
+ }
+
+ const bool is_vr_success_invalid =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ vr_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::INVALID_ENUM);
+
+ const bool is_ui_success_invalid =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::INVALID_ENUM);
+
+ const bool is_vr_ui_invalid =
+ Compare<hmi_apis::Common_Result::eType, EQ, ALL>(
+ hmi_apis::Common_Result::INVALID_ENUM,
+ vr_result_,
+ ui_result_);
+
+ const bool is_vr_or_ui_warning =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::WARNINGS,
+ ui_result_,
+ vr_result_);
+
+ const bool result =
+ // In case of UI/VR is SUCCESS and other is SUCCESS/INVALID_ENUM
+ (is_vr_success_invalid && is_ui_success_invalid && !is_vr_ui_invalid) ||
+ // or one of them is WARNINGS
+ is_vr_or_ui_warning;
+
+ LOG4CXX_DEBUG(logger_, "Result code is " << (result ? "true" : "false"));
+
+ if (result) {
+ application->RemoveCommand(msg_params[strings::cmd_id].asInt());
+ }
+
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+ if (!result &&
+ hmi_apis::Common_Result::REJECTED == ui_result_) {
+ result_code = MessageHelper::HMIToMobileResult(vr_result_);
+ } else if (is_vr_or_ui_warning) {
+ LOG4CXX_DEBUG(logger_, "VR or UI result is warning");
+ result_code = mobile_apis::Result::WARNINGS;
+ } else {
+ result_code = MessageHelper::HMIToMobileResult(
+ std::max(ui_result_, vr_result_));
+ }
+
+ SendResponse(result, result_code, NULL, &msg_params);
+ if (result) {
+ application->UpdateHash();
}
}
bool DeleteCommandRequest::IsPendingResponseExist() {
+ LOG4CXX_AUTO_TRACE(logger_);
return is_ui_send_ != is_ui_received_ || is_vr_send_ != is_vr_received_;
}
diff --git a/src/components/application_manager/src/commands/mobile/delete_file_response.cc b/src/components/application_manager/src/commands/mobile/delete_file_response.cc
index 1bbb18313f..401b0ea719 100644
--- a/src/components/application_manager/src/commands/mobile/delete_file_response.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_file_response.cc
@@ -59,8 +59,9 @@ void DeleteFileResponse::Run() {
}
(*message_)[strings::msg_params][strings::space_available] =
- static_cast<int32_t>(
- ApplicationManagerImpl::instance()->GetAvailableSpaceForApp(app->name()));
+ static_cast<uint32_t>(
+ ApplicationManagerImpl::instance()->
+ GetAvailableSpaceForApp(app->folder_name()));
SendResponse((*message_)[strings::msg_params][strings::success].asBool());
}
diff --git a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc
index 18c6b3b084..a29350b649 100644
--- a/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_interaction_choice_set_request.cc
@@ -37,6 +37,7 @@
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "application_manager/message_helper.h"
+
namespace application_manager {
namespace commands {
@@ -52,27 +53,29 @@ DeleteInteractionChoiceSetRequest::~DeleteInteractionChoiceSetRequest() {
void DeleteInteractionChoiceSetRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "No application associated with session key");
+ LOG4CXX_ERROR(logger_, "No application associated with connection key "
+ << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
- const int32_t choise_set_id =
+ const int32_t choice_set_id =
(*message_)[strings::msg_params]
[strings::interaction_choice_set_id].asInt();
- if (!app->FindChoiceSet(choise_set_id)) {
- LOG4CXX_ERROR_EXT(logger_, "INVALID_ID");
+ if (!app->FindChoiceSet(choice_set_id)) {
+ LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id
+ << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
return;
}
if (ChoiceSetInUse(app)) {
- LOG4CXX_ERROR_EXT(logger_, "Choice set currently in use");
+ LOG4CXX_ERROR(logger_, "Choice set currently in use.");
SendResponse(false, mobile_apis::Result::IN_USE);
return;
}
@@ -81,10 +84,10 @@ void DeleteInteractionChoiceSetRequest::Run() {
smart_objects::SmartObject msg_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
- msg_params[strings::interaction_choice_set_id] = choise_set_id;
+ msg_params[strings::interaction_choice_set_id] = choice_set_id;
msg_params[strings::app_id] = app->app_id();
- app->RemoveChoiceSet(choise_set_id);
+ app->RemoveChoiceSet(choice_set_id);
// Checking of HMI responses will be implemented with APPLINK-14600
const bool result = true;
@@ -94,49 +97,60 @@ void DeleteInteractionChoiceSetRequest::Run() {
}
}
-bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(ApplicationConstSharedPtr app) {
- if (app->is_perform_interaction_active()) {
- // retrieve stored choice sets for perform interaction
+bool DeleteInteractionChoiceSetRequest::ChoiceSetInUse(
+ ApplicationConstSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!app->is_perform_interaction_active()) {
+ return false;
+ }
const DataAccessor<PerformChoiceSetMap> accessor =
app->performinteraction_choice_set_map();
const PerformChoiceSetMap& choice_set_map = accessor.GetData();
- PerformChoiceSetMap::const_iterator it = choice_set_map.begin();
- for (; choice_set_map.end() != it; ++it) {
- const PerformChoice& choice = it->second;
- PerformChoice::const_iterator choice_it = choice.begin();
- for (; choice.end() != choice_it; ++choice_it) {
- if (choice_it->first == (*message_)[strings::msg_params]
- [strings::interaction_choice_set_id].asUInt()) {
- LOG4CXX_ERROR_EXT(logger_,
- "DeleteInteractionChoiceSetRequest::ChoiceSetInUse");
- return true;
- }
+ const uint32_t choice_set_id =
+ (*message_)[strings::msg_params][strings::interaction_choice_set_id].
+ asUInt();
+
+ PerformChoiceSetMap::const_iterator it = choice_set_map.begin();
+ for (; choice_set_map.end() != it; ++it) {
+ const PerformChoice& choice = it->second;
+ PerformChoice::const_iterator choice_it = choice.begin();
+ for (; choice.end() != choice_it; ++choice_it) {
+ if (choice_it->first == choice_set_id) {
+ LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id
+ << " is in use.");
+ return true;
}
}
}
- return false;
+ return true;
}
void DeleteInteractionChoiceSetRequest::SendVrDeleteCommand(
application_manager::ApplicationSharedPtr app) {
- LOG4CXX_INFO(logger_, "PerformInteractionRequest::SendVrDeleteCommand");
-
- smart_objects::SmartObject* choice_set =
- app->FindChoiceSet((*message_)[strings::msg_params]
- [strings::interaction_choice_set_id].asInt());
-
- if (choice_set) {
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- msg_params[strings::app_id] = app->app_id();
- msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
- msg_params[strings::grammar_id] = (*choice_set)[strings::grammar_id];
- choice_set = &((*choice_set)[strings::choice_set]);
- for (uint32_t i = 0; i < (*choice_set).length() ; ++i) {
- msg_params[strings::cmd_id] = (*choice_set)[i][strings::choice_id];
- SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
- }
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const uint32_t choice_set_id =
+ (*message_)[strings::msg_params][strings::interaction_choice_set_id].
+ asUInt();
+
+ smart_objects::SmartObject* choice_set = app->FindChoiceSet(choice_set_id);
+
+ if (!choice_set) {
+ LOG4CXX_ERROR(logger_, "Choice set with id " << choice_set_id
+ << " is not found.");
+ return;
+ }
+
+ smart_objects::SmartObject msg_params = smart_objects::SmartObject(
+ smart_objects::SmartType_Map);
+ msg_params[strings::app_id] = app->app_id();
+ msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
+ msg_params[strings::grammar_id] = (*choice_set)[strings::grammar_id];
+ choice_set = &((*choice_set)[strings::choice_set]);
+ for (uint32_t i = 0; i < (*choice_set).length() ; ++i) {
+ msg_params[strings::cmd_id] = (*choice_set)[i][strings::choice_id];
+ SendHMIRequest(hmi_apis::FunctionID::VR_DeleteCommand, &msg_params);
}
}
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 6b6bd3fbda..31387ded7d 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
@@ -35,6 +35,7 @@
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
#include "interfaces/HMI_API.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -50,8 +51,8 @@ DeleteSubMenuRequest::~DeleteSubMenuRequest() {
void DeleteSubMenuRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- (*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -59,10 +60,12 @@ void DeleteSubMenuRequest::Run() {
return;
}
- if (!app->FindSubMenu(
- (*message_)[strings::msg_params][strings::menu_id].asInt())) {
+ const int32_t menu_id =
+ (*message_)[strings::msg_params][strings::menu_id].asInt();
+
+ if (!app->FindSubMenu(menu_id)) {
+ LOG4CXX_ERROR(logger_, "Menu with id " << menu_id << " is not found.");
SendResponse(false, mobile_apis::Result::INVALID_ID);
- LOG4CXX_ERROR(logger_, "Invalid ID");
return;
}
@@ -76,7 +79,8 @@ void DeleteSubMenuRequest::Run() {
SendHMIRequest(hmi_apis::FunctionID::UI_DeleteSubMenu, &msg_params, true);
}
-void DeleteSubMenuRequest::DeleteSubMenuVRCommands(ApplicationConstSharedPtr app) {
+void DeleteSubMenuRequest::DeleteSubMenuVRCommands(
+ ApplicationConstSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
const DataAccessor<CommandsMap> accessor = app->commands_map();
@@ -104,7 +108,8 @@ void DeleteSubMenuRequest::DeleteSubMenuVRCommands(ApplicationConstSharedPtr app
}
}
-void DeleteSubMenuRequest::DeleteSubMenuUICommands(ApplicationSharedPtr const app) {
+void DeleteSubMenuRequest::DeleteSubMenuUICommands(
+ ApplicationSharedPtr const app) {
LOG4CXX_AUTO_TRACE(logger_);
const DataAccessor<CommandsMap> accessor(app->commands_map());
@@ -138,6 +143,7 @@ void DeleteSubMenuRequest::DeleteSubMenuUICommands(ApplicationSharedPtr const ap
void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -146,7 +152,11 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result = mobile_apis::Result::SUCCESS == result_code;
+ const bool result =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
ApplicationSharedPtr application =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -165,6 +175,9 @@ void DeleteSubMenuRequest::on_event(const event_engine::Event& event) {
}
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ if (result) {
+ application->UpdateHash();
+ }
break;
}
default: {
diff --git a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc
index 05795e5908..0c897e138c 100644
--- a/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc
+++ b/src/components/application_manager/src/commands/mobile/delete_sub_menu_response.cc
@@ -48,7 +48,6 @@ DeleteSubMenuResponse::~DeleteSubMenuResponse() {
void DeleteSubMenuResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
-
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 f5e8808d38..ff87779116 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
@@ -64,20 +64,19 @@ void DiagnosticMessageRequest::Run() {
const std::vector<uint32_t>& supported_diag_modes =
profile::Profile::instance()->supported_diag_modes();
- uint32_t message_data_length =
- (*message_)[strings::msg_params][strings::message_data].length();
- for (uint32_t i = 0; i < message_data_length; ++i) {
- uint32_t message_data =
- (*message_)[strings::msg_params][strings::message_data][i].asUInt();
- if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(),
- supported_diag_modes.end(),
- message_data)) {
- LOG4CXX_ERROR(logger_, "Received message data " << message_data <<
- " not supported");
- SendResponse(false, mobile_apis::Result::REJECTED,
- "Received message data not supported");
- return;
- }
+ smart_objects::SmartObject& msg_data =
+ (*message_)[strings::msg_params][strings::message_data];
+
+ const uint8_t mode_position = 0;
+ const uint32_t msg_diagnostic_mode = msg_data[mode_position].asUInt();
+ if (supported_diag_modes.end() == std::find(supported_diag_modes.begin(),
+ supported_diag_modes.end(),
+ msg_diagnostic_mode)) {
+ LOG4CXX_ERROR(logger_, "Received diagnostic mode " << msg_diagnostic_mode <<
+ " is not supported.");
+ SendResponse(false, mobile_apis::Result::REJECTED,
+ "Received diagnostic mode is not supported.");
+ return;
}
// Add app_id for HMI request
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 749b19a520..5c1cf18cf8 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
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
+#include <string>
#include "application_manager/commands/mobile/dial_number_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
@@ -40,16 +42,99 @@ namespace application_manager {
namespace commands {
DialNumberRequest::DialNumberRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ : CommandRequestImpl(message) {}
+
+DialNumberRequest::~DialNumberRequest() {}
+
+bool DialNumberRequest::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
-DialNumberRequest::~DialNumberRequest() {
+ default_timeout_ = 0;
+
+ return true;
}
void DialNumberRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- SendResponse(false, mobile_apis::Result::UNSUPPORTED_REQUEST);
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
+ return;
+ }
+ std::string number =
+ (*message_)[strings::msg_params][strings::number].asString();
+ if (!CheckSyntax(number)) {
+ LOG4CXX_ERROR(logger_, "Invalid incoming data");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+ StripNumberParam(number);
+ if (number.empty()) {
+ LOG4CXX_WARN(logger_,
+ "After strip number param is empty. Invalid incoming data");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
+ return;
+ }
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::number] =
+ (*message_)[strings::msg_params][strings::number].asString();
+ msg_params[strings::app_id] = application->hmi_app_id();
+
+ SendHMIRequest(
+ hmi_apis::FunctionID::BasicCommunication_DialNumber, &msg_params, true);
+}
+
+void DialNumberRequest::on_event(const event_engine::Event& event) {
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(connection_key());
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ return;
+ }
+
+ const smart_objects::SmartObject& message = event.smart_object();
+ mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
+ switch (event.id()) {
+ case hmi_apis::FunctionID::BasicCommunication_DialNumber: {
+ LOG4CXX_INFO(logger_, "Received DialNumber event");
+ result_code = CommandRequestImpl::GetMobileResultCode(
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt()));
+ break;
+ }
+ default: {
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
+ return;
+ }
+ }
+
+ const bool is_success = mobile_apis::Result::SUCCESS == result_code;
+ const bool is_info_valid =
+ message[strings::msg_params].keyExists(strings::info);
+
+ if (is_info_valid) {
+ const char* info_char_array =
+ message[strings::msg_params][strings::info].asCharArray();
+ SendResponse(is_success, result_code, info_char_array);
+ return;
+ }
+
+ SendResponse(is_success, result_code);
+}
+
+void DialNumberRequest::StripNumberParam(std::string& number) {
+ std::size_t found = 0;
+ while (std::string::npos !=
+ (found = number.find_first_not_of("+0123456789"))) {
+ number.erase(number.begin() + found);
+ }
+ (*message_)[strings::msg_params][strings::number] = number;
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/dial_number_response.cc b/src/components/application_manager/src/commands/mobile/dial_number_response.cc
new file mode 100644
index 0000000000..3eba98fb96
--- /dev/null
+++ b/src/components/application_manager/src/commands/mobile/dial_number_response.cc
@@ -0,0 +1,54 @@
+/*
+
+ Copyright (c) 2013, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/commands/mobile/dial_number_response.h"
+#include "application_manager/application_manager_impl.h"
+
+namespace application_manager {
+
+namespace commands {
+
+DialNumberResponse::DialNumberResponse(const MessageSharedPtr& message)
+ : CommandResponseImpl(message) {
+}
+
+DialNumberResponse::~DialNumberResponse() {
+}
+
+void DialNumberResponse::Run() {
+ ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
+}
+
+} // namespace commands
+
+} // namespace application_manager
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 ed75e62c0c..6413e9d7d4 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
@@ -47,17 +47,17 @@ namespace str = strings;
#ifdef HMI_DBUS_API
GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ : CommandRequestImpl(message) {}
-GetVehicleDataRequest::~GetVehicleDataRequest() {
-}
+GetVehicleDataRequest::~GetVehicleDataRequest() {}
void GetVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ int32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -69,8 +69,8 @@ void GetVehicleDataRequest::Run() {
VehicleData::const_iterator it = vehicle_data.begin();
for (; vehicle_data.end() != it; ++it) {
- if (true == (*message_)[str::msg_params].keyExists(it->first)
- && true == (*message_)[str::msg_params][it->first].asBool()) {
+ if (true == (*message_)[str::msg_params].keyExists(it->first) &&
+ true == (*message_)[str::msg_params][it->first].asBool()) {
SendRequestsToHmi(app->app_id());
return;
}
@@ -80,37 +80,44 @@ void GetVehicleDataRequest::Run() {
}
namespace {
- struct Subrequest {
- hmi_apis::FunctionID::eType func_id;
- const char* str;
- };
- Subrequest subrequests[] = {
- { hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps},
- { hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed},
- { hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm},
- { hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level},
- { hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState, str::fuel_level_state},
- { hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption, str::instant_fuel_consumption},
- { hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature, str::external_temp},
- { hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin},
- { hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl},
- { hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure},
- { hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer},
- { hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status},
- { hmi_apis::FunctionID::VehicleInfo_GetBodyInformation, str::body_information},
- { hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status},
- { hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking},
- { hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status},
- { hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus, str::head_lamp_status},
- { hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque},
- { hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos},
- { hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle, str::steering_wheel_angle},
- { hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info},
- { hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status},
- { hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event},
- { hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus, str::cluster_mode_status},
- { hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key},
- };
+struct Subrequest {
+ hmi_apis::FunctionID::eType func_id;
+ const char* str;
+};
+Subrequest subrequests[] = {
+ {hmi_apis::FunctionID::VehicleInfo_GetGpsData, str::gps},
+ {hmi_apis::FunctionID::VehicleInfo_GetSpeed, str::speed},
+ {hmi_apis::FunctionID::VehicleInfo_GetRpm, str::rpm},
+ {hmi_apis::FunctionID::VehicleInfo_GetFuelLevel, str::fuel_level},
+ {hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState,
+ str::fuel_level_state},
+ {hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption,
+ str::instant_fuel_consumption},
+ {hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature,
+ str::external_temp},
+ {hmi_apis::FunctionID::VehicleInfo_GetVin, str::vin},
+ {hmi_apis::FunctionID::VehicleInfo_GetPrndl, str::prndl},
+ {hmi_apis::FunctionID::VehicleInfo_GetTirePressure, str::tire_pressure},
+ {hmi_apis::FunctionID::VehicleInfo_GetOdometer, str::odometer},
+ {hmi_apis::FunctionID::VehicleInfo_GetBeltStatus, str::belt_status},
+ {hmi_apis::FunctionID::VehicleInfo_GetBodyInformation,
+ str::body_information},
+ {hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus, str::device_status},
+ {hmi_apis::FunctionID::VehicleInfo_GetDriverBraking, str::driver_braking},
+ {hmi_apis::FunctionID::VehicleInfo_GetWiperStatus, str::wiper_status},
+ {hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus,
+ str::head_lamp_status},
+ {hmi_apis::FunctionID::VehicleInfo_GetEngineTorque, str::engine_torque},
+ {hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition, str::acc_pedal_pos},
+ {hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle,
+ str::steering_wheel_angle},
+ {hmi_apis::FunctionID::VehicleInfo_GetECallInfo, str::e_call_info},
+ {hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus, str::airbag_status},
+ {hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent, str::emergency_event},
+ {hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus,
+ str::cluster_mode_status},
+ {hmi_apis::FunctionID::VehicleInfo_GetMyKey, str::my_key},
+};
}
void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) {
@@ -119,8 +126,8 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) {
for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
const Subrequest& sr = subrequests[i];
- if (true == (*message_)[str::msg_params].keyExists(sr.str)
- && true == (*message_)[str::msg_params][sr.str].asBool()) {
+ if (true == (*message_)[str::msg_params].keyExists(sr.str) &&
+ true == (*message_)[str::msg_params][sr.str].asBool()) {
HmiRequest hmi_request;
hmi_request.str = sr.str;
hmi_request.func_id = sr.func_id;
@@ -133,7 +140,8 @@ void GetVehicleDataRequest::SendRequestsToHmi(const int32_t app_id) {
hmi_requests_.size() << " requests are going to be sent to HMI");
for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end(); ++it) {
+ it != hmi_requests_.end();
+ ++it) {
SendHMIRequest(it->func_id, &msg_params, true);
}
}
@@ -144,12 +152,12 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
const smart_objects::SmartObject& message = event.smart_object();
for (HmiRequests::iterator it = hmi_requests_.begin();
- it != hmi_requests_.end(); ++it) {
- HmiRequest & hmi_request = *it;
+ it != hmi_requests_.end();
+ ++it) {
+ HmiRequest& hmi_request = *it;
if (hmi_request.func_id == event.id()) {
- hmi_request.status =
- static_cast<hmi_apis::Common_Result::eType>(message[strings::params][hmi_response::code]
- .asInt());
+ hmi_request.status = static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == hmi_request.status)
hmi_request.value = message[str::msg_params][hmi_request.str];
hmi_request.complete = true;
@@ -161,7 +169,8 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
bool any_arg_success = false;
mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS;
for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end(); ++it) {
+ it != hmi_requests_.end();
+ ++it) {
if (!it->complete) {
all_complete = false;
break;
@@ -169,13 +178,16 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
if (hmi_apis::Common_Result::SUCCESS != it->status) {
if (mobile_api::Result::SUCCESS == status) {
status = static_cast<mobile_apis::Result::eType>(it->status);
- } else if (status
- != static_cast<mobile_apis::Result::eType>(it->status)) {
+ } else if (status !=
+ static_cast<mobile_apis::Result::eType>(it->status)) {
status = mobile_api::Result::eType::GENERIC_ERROR;
}
- LOG4CXX_TRACE(logger_, "Status from HMI: " << it->status << ", so response status become " << status);
+ LOG4CXX_TRACE(logger_,
+ "Status from HMI: " << it->status
+ << ", so response status become "
+ << status);
} else {
- any_arg_success = true;
+ any_arg_success = true;
}
}
@@ -183,34 +195,34 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
if (any_arg_success) {
for (HmiRequests::const_iterator it = hmi_requests_.begin();
- it != hmi_requests_.end(); ++it) {
+ it != hmi_requests_.end();
+ ++it) {
response_params[it->str] = it->value;
}
}
- LOG4CXX_INFO(
- logger_, "All HMI requests are complete");
- const char *info = NULL;
+ LOG4CXX_INFO(logger_, "All HMI requests are complete");
+ const char* info = NULL;
std::string error_message;
if (true == message[strings::params].keyExists(strings::error_msg)) {
error_message = message[strings::params][strings::error_msg].asString();
info = error_message.c_str();
}
- SendResponse( any_arg_success, status, info, &response_params);
+ SendResponse(any_arg_success, status, info, &response_params);
}
}
#else
GetVehicleDataRequest::GetVehicleDataRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ : CommandRequestImpl(message) {}
-GetVehicleDataRequest::~GetVehicleDataRequest() {
-}
+GetVehicleDataRequest::~GetVehicleDataRequest() {}
void GetVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- int32_t app_id = (*message_)[strings::params][strings::connection_key].asUInt();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ int32_t app_id =
+ (*message_)[strings::params][strings::connection_key].asUInt();
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -219,27 +231,27 @@ void GetVehicleDataRequest::Run() {
}
if (app->IsCommandLimitsExceeded(
- static_cast<mobile_apis::FunctionID::eType>(function_id()),
- application_manager::TLimitSource::CONFIG_FILE)) {
+ static_cast<mobile_apis::FunctionID::eType>(function_id()),
+ application_manager::TLimitSource::CONFIG_FILE)) {
LOG4CXX_ERROR(logger_, "GetVehicleData frequency is too high.");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
const VehicleData& vehicle_data = MessageHelper::vehicle_data();
VehicleData::const_iterator it = vehicle_data.begin();
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app->app_id();
const uint32_t min_length_msg_params = 1;
for (; vehicle_data.end() != it; ++it) {
- if (true == (*message_)[str::msg_params].keyExists(it->first)
- && true == (*message_)[str::msg_params][it->first].asBool()) {
+ if (true == (*message_)[str::msg_params].keyExists(it->first) &&
+ true == (*message_)[str::msg_params][it->first].asBool()) {
msg_params[it->first] = (*message_)[strings::msg_params][it->first];
}
}
if (msg_params.length() > min_length_msg_params) {
- SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_GetVehicleData,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleData, &msg_params, true);
return;
} else if (HasDisallowedParams()) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
@@ -260,11 +272,11 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
bool result = false;
if (mobile_apis::Result::SUCCESS == result_code ||
(hmi_apis::Common_Result::DATA_NOT_AVAILABLE ==
- static_cast<hmi_apis::Common_Result::eType>(result_code)
- && message[strings::msg_params].length() > 1)) {
+ static_cast<hmi_apis::Common_Result::eType>(result_code) &&
+ message[strings::msg_params].length() > 1)) {
result = true;
}
- const char *info = NULL;
+ const char* info = NULL;
std::string error_message;
if (true ==
message[strings::msg_params].keyExists(hmi_response::method)) {
@@ -284,8 +296,8 @@ void GetVehicleDataRequest::on_event(const event_engine::Event& event) {
}
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
-} // namespace commands
+} // namespace commands
-} // namespace application_manager
+} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/list_files_request.cc b/src/components/application_manager/src/commands/mobile/list_files_request.cc
index 427443e3e9..49cb936d3a 100644
--- a/src/components/application_manager/src/commands/mobile/list_files_request.cc
+++ b/src/components/application_manager/src/commands/mobile/list_files_request.cc
@@ -31,6 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string>
#include "application_manager/commands/mobile/list_files_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
@@ -76,15 +77,20 @@ void ListFilesRequest::Run() {
(*message_)[strings::msg_params][strings::space_available] =
static_cast<int32_t>(ApplicationManagerImpl::instance()->
GetAvailableSpaceForApp(application->folder_name()));
- int32_t i = 0;
+ uint32_t i = 0;
const AppFilesMap& app_files = application->getAppFiles();
for (AppFilesMap::const_iterator it = app_files.begin();
it != app_files.end(); ++it) {
- //In AppFile to application stored full path to file. In message required
- //to write only name file.
- //Plus one required for move to next letter after '/'.
- (*message_)[strings::msg_params][strings::filenames][i++] =
- it->first.substr(it->first.find_last_of('/') + 1);
+ std::string filename = it->first.substr(it->first.find_last_of('/') + 1);
+ // In AppFile to application stored full path to file. In message required
+ // to write only name file.
+ // Plus one required for move to next letter after '/'.
+ if (i < ::profile::Profile::instance()->list_files_response_size()) {
+ LOG4CXX_DEBUG(logger_, "File " + filename + " added to ListFiles response");
+ (*message_)[strings::msg_params][strings::filenames][i++] = filename;
+ } else {
+ LOG4CXX_DEBUG(logger_, "File " + filename + " not added to ListFiles response");
+ }
}
(*message_)[strings::params][strings::message_type] =
application_manager::MessageType::kResponse;
diff --git a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
index 5f14ad953f..52aeebfe85 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_event_notification.cc
@@ -61,15 +61,15 @@ void OnButtonEventNotification::Run() {
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) {
- LOG4CXX_ERROR_EXT(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id.");
+ LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonEvent without app_id.");
return;
}
// custom_button_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(
hmi_response::custom_button_id)) {
- LOG4CXX_ERROR_EXT(logger_,
- "CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
+ LOG4CXX_ERROR(logger_,
+ "CUSTOM_BUTTON OnButtonEvent without custom_button_id.");
return;
}
@@ -77,7 +77,7 @@ void OnButtonEventNotification::Run() {
(*message_)[strings::msg_params][strings::app_id].asUInt());
if (false == app.valid()) {
- LOG4CXX_ERROR_EXT(logger_, "Application doesn't exist.");
+ LOG4CXX_ERROR(logger_, "Application doesn't exist.");
return;
}
@@ -86,7 +86,7 @@ void OnButtonEventNotification::Run() {
[hmi_response::custom_button_id].asUInt();
if (false == app->IsSubscribedToSoftButton(custom_btn_id)) {
- LOG4CXX_ERROR_EXT(logger_,
+ LOG4CXX_ERROR(logger_,
"Application doesn't subscribed to this custom_button_id.");
return;
}
@@ -102,20 +102,23 @@ void OnButtonEventNotification::Run() {
for (; subscribedApps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
- LOG4CXX_WARN_EXT(logger_, "Null pointer to subscribed app.");
+ LOG4CXX_WARN(logger_, "Null pointer to subscribed app.");
continue;
}
//Send ButtonEvent notification only in HMI_FULL or HMI_LIMITED mode
if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
(mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
- LOG4CXX_WARN_EXT(logger_, "OnButtonEvent in HMI_BACKGROUND or NONE");
+ LOG4CXX_WARN(logger_, "OnButtonEvent notification is allowed only"
+ << "in FULL or LIMITED hmi level");
continue;
}
//Send ButtonEvent notification for OK button only in HMI_FULL mode
if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) &&
- (!subscribed_app->IsFullscreen())) {
+ (mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) {
+ LOG4CXX_WARN(logger_, "OnButtonEvent notification for OK button"
+ << "is allowed only in FULL hmi level");
continue;
}
@@ -125,14 +128,14 @@ void OnButtonEventNotification::Run() {
void OnButtonEventNotification::SendButtonEvent(ApplicationConstSharedPtr app) {
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "OnButtonEvent NULL pointer");
+ LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer");
return;
}
smart_objects::SmartObjectSPtr on_btn_event = new smart_objects::SmartObject();
if (!on_btn_event) {
- LOG4CXX_ERROR_EXT(logger_, "OnButtonEvent NULL pointer");
+ LOG4CXX_ERROR(logger_, "OnButtonEvent NULL pointer");
return;
}
diff --git a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
index 86fe664f86..c919c36c3f 100644
--- a/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_button_press_notification.cc
@@ -61,15 +61,15 @@ void OnButtonPressNotification::Run() {
if (static_cast<uint32_t>(mobile_apis::ButtonName::CUSTOM_BUTTON) == btn_id) {
// app_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(strings::app_id)) {
- LOG4CXX_ERROR_EXT(logger_, "CUSTOM_BUTTON OnButtonPress without app_id.");
+ LOG4CXX_ERROR(logger_, "CUSTOM_BUTTON OnButtonPress without app_id.");
return;
}
// custom_button_id is mandatory for CUSTOM_BUTTON notification
if (false == (*message_)[strings::msg_params].keyExists(
hmi_response::custom_button_id)) {
- LOG4CXX_ERROR_EXT(logger_,
- "CUSTOM_BUTTON OnButtonPress without custom_button_id.");
+ LOG4CXX_ERROR(logger_,
+ "CUSTOM_BUTTON OnButtonPress without custom_button_id.");
return;
}
@@ -77,7 +77,7 @@ void OnButtonPressNotification::Run() {
(*message_)[strings::msg_params][strings::app_id].asUInt());
if (false == app.valid()) {
- LOG4CXX_ERROR_EXT(logger_, "Application doesn't exist.");
+ LOG4CXX_ERROR(logger_, "Application doesn't exist.");
return;
}
@@ -86,7 +86,7 @@ void OnButtonPressNotification::Run() {
[hmi_response::custom_button_id].asUInt();
if (false == app->IsSubscribedToSoftButton(custom_btn_id)) {
- LOG4CXX_ERROR_EXT(logger_,
+ LOG4CXX_ERROR(logger_,
"Application doesn't subscribed to this custom_button_id.");
return;
}
@@ -102,20 +102,23 @@ void OnButtonPressNotification::Run() {
for (; subscribedApps.end() != it; ++it) {
ApplicationSharedPtr subscribed_app = *it;
if (!subscribed_app) {
- LOG4CXX_WARN_EXT(logger_, "Null pointer to subscribed app.");
+ LOG4CXX_WARN(logger_, "Null pointer to subscribed app.");
continue;
}
//Send ButtonPress notification only in HMI_FULL or HMI_LIMITED mode
if ((mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level()) &&
(mobile_api::HMILevel::HMI_LIMITED != subscribed_app->hmi_level())) {
- LOG4CXX_WARN_EXT(logger_, "OnButtonPress in HMI_BACKGROUND or NONE");
+ LOG4CXX_WARN(logger_, "OnButtonPress notification is allowed only"
+ << "in FULL or LIMITED hmi level");
continue;
}
//Send ButtonPress notification for OK button only in HMI_FULL mode
if ((static_cast<uint32_t>(mobile_apis::ButtonName::OK) == btn_id) &&
(mobile_api::HMILevel::HMI_FULL != subscribed_app->hmi_level())) {
+ LOG4CXX_WARN(logger_, "OnButtonPress notification for OK button"
+ << "is allowed only in FULL hmi level");
continue;
}
@@ -125,14 +128,14 @@ void OnButtonPressNotification::Run() {
void OnButtonPressNotification::SendButtonPress(ApplicationConstSharedPtr app) {
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "OnButtonPress NULL pointer");
+ LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer");
return;
}
smart_objects::SmartObjectSPtr on_btn_press = new smart_objects::SmartObject();
if (!on_btn_press) {
- LOG4CXX_ERROR_EXT(logger_, "OnButtonPress NULL pointer");
+ LOG4CXX_ERROR(logger_, "OnButtonPress NULL pointer");
return;
}
diff --git a/src/components/application_manager/src/commands/mobile/on_command_notification.cc b/src/components/application_manager/src/commands/mobile/on_command_notification.cc
index 9bba1851f6..922fcad525 100644
--- a/src/components/application_manager/src/commands/mobile/on_command_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_command_notification.cc
@@ -53,7 +53,7 @@ void OnCommandNotification::Run() {
(*message_)[strings::msg_params][strings::app_id].asInt());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "No application associated with session key");
+ LOG4CXX_ERROR(logger_, "No application associated with session key");
return;
}
@@ -61,7 +61,7 @@ void OnCommandNotification::Run() {
.asUInt();
if (!app->FindCommand(cmd_id)) {
- LOG4CXX_ERROR_EXT(logger_,
+ LOG4CXX_ERROR(logger_,
" No applications found for the command " << cmd_id);
return;
}
diff --git a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
index 02b4b64aa0..d9f4d59567 100644
--- a/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
+++ b/src/components/application_manager/src/commands/mobile/on_hmi_status_notification_from_mobile.cc
@@ -41,29 +41,27 @@ namespace commands {
OnHMIStatusNotificationFromMobile::OnHMIStatusNotificationFromMobile(
const MessageSharedPtr& message)
- : CommandNotificationFromMobileImpl(message) {
-}
+ : CommandNotificationFromMobileImpl(message) {}
-OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {
-}
+OnHMIStatusNotificationFromMobile::~OnHMIStatusNotificationFromMobile() {}
void OnHMIStatusNotificationFromMobile::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- (*message_)[strings::params][strings::message_type] = static_cast<int32_t> (
- application_manager::MessageType::kNotification);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- connection_key());
+ (*message_)[strings::params][strings::message_type] =
+ static_cast<int32_t>(application_manager::MessageType::kNotification);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app.valid()) {
- LOG4CXX_ERROR(logger_,
- "OnHMIStatusNotificationFromMobile application doesn't exist");
+ LOG4CXX_ERROR(
+ logger_, "OnHMIStatusNotificationFromMobile application doesn't exist");
return;
}
mobile_apis::HMILevel::eType current_hmi_state =
static_cast<mobile_apis::HMILevel::eType>(
- (*message_)[strings::msg_params][strings::hmi_level].asUInt());
+ (*message_)[strings::msg_params][strings::hmi_level].asUInt());
bool is_current_state_foreground =
mobile_apis::HMILevel::HMI_FULL == current_hmi_state;
@@ -72,11 +70,14 @@ void OnHMIStatusNotificationFromMobile::Run() {
connection_handler::DeviceHandle handle = app->device();
bool is_apps_requested_before =
- application_manager::ApplicationManagerImpl::instance()->
- IsAppsQueriedFrom(handle);
+ application_manager::ApplicationManagerImpl::instance()
+ ->IsAppsQueriedFrom(handle);
- LOG4CXX_DEBUG(logger_, "Mobile HMI state notication came for connection key:"
- << connection_key() << " and handle: " << handle);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Mobile HMI state notication came for connection key:" << connection_key()
+ << " and handle: "
+ << handle);
if (!is_apps_requested_before &&
ProtocolVersion::kV4 == app->protocol_version() && app->is_foreground()) {
@@ -88,28 +89,30 @@ void OnHMIStatusNotificationFromMobile::Run() {
}
if (is_apps_requested_before) {
- LOG4CXX_DEBUG(logger_, "Remote apps list had been requested already "
- " for handle: " << handle);
+ LOG4CXX_DEBUG(logger_,
+ "Remote apps list had been requested already "
+ " for handle: "
+ << handle);
if (ProtocolVersion::kV4 == app->protocol_version()) {
ApplicationManagerImpl::ApplicationListAccessor accessor;
bool is_another_foreground_sdl4_app = false;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
- for (;accessor.end() != it; ++it) {
+ ApplicationSetIt it = accessor.begin();
+ for (; accessor.end() != it; ++it) {
if (connection_key() != (*it)->app_id() &&
ProtocolVersion::kV4 == (*it)->protocol_version() &&
- (*it)->is_foreground()) {
+ (*it)->is_foreground()) {
is_another_foreground_sdl4_app = true;
break;
}
}
if (!is_another_foreground_sdl4_app) {
- application_manager::ApplicationManagerImpl::instance()->
- MarkAppsGreyOut(handle, !is_current_state_foreground);
- application_manager::ApplicationManagerImpl::instance()->
- SendUpdateAppList();
+ application_manager::ApplicationManagerImpl::instance()
+ ->MarkAppsGreyOut(handle, !is_current_state_foreground);
+ application_manager::ApplicationManagerImpl::instance()
+ ->SendUpdateAppList();
}
}
return;
diff --git a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc
index 6285d684ea..3950efb8fe 100644
--- a/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_keyboard_input_notification.cc
@@ -44,11 +44,9 @@ namespace mobile {
OnKeyBoardInputNotification::OnKeyBoardInputNotification(
const MessageSharedPtr& message)
- : CommandNotificationImpl(message) {
-}
+ : CommandNotificationImpl(message) {}
-OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {
-}
+OnKeyBoardInputNotification::~OnKeyBoardInputNotification() {}
void OnKeyBoardInputNotification::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -56,23 +54,26 @@ void OnKeyBoardInputNotification::Run() {
ApplicationSharedPtr app_to_notify;
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetIt it = accessor.begin();
+ ApplicationSetIt it = accessor.begin();
for (; accessor.end() != it; ++it) {
// if there is app with active perform interaction use it for notification
- if ((*it)->is_perform_interaction_active()) {
- LOG4CXX_INFO(logger_, "There is application with active PerformInteraction");
- app_to_notify = *it;
+ ApplicationSharedPtr app = *it;
+ if (app->is_perform_interaction_active()) {
+ LOG4CXX_INFO(logger_,
+ "There is application with active PerformInteraction");
+ app_to_notify = app;
break;
}
- if (mobile_apis::HMILevel::eType::HMI_FULL == (*it)->hmi_level()) {
+ if (mobile_apis::HMILevel::eType::HMI_FULL == app->hmi_level()) {
LOG4CXX_INFO(logger_, "There is application in HMI_FULL level");
- app_to_notify = *it;
+ app_to_notify = app;
}
}
if (app_to_notify.valid()) {
- (*message_)[strings::params][strings::connection_key] = app_to_notify->app_id();
+ (*message_)[strings::params][strings::connection_key] =
+ app_to_notify->app_id();
SendNotification();
}
}
diff --git a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
index 4e7354776f..f2c3f42fb7 100644
--- a/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_system_request_notification.cc
@@ -76,12 +76,10 @@ void OnSystemRequestNotification::Run() {
}
if (RequestType::PROPRIETARY == request_type) {
- std::string filename =
- (*message_)[strings::msg_params][strings::file_name].asString();
-
- std::vector<uint8_t> binary_data;
- file_system::ReadBinaryFile(filename, binary_data);
- (*message_)[strings::params][strings::binary_data] = binary_data;
+ /* According to requirements:
+ "If the requestType = PROPRIETARY, add to mobile API fileType = JSON
+ If the requestType = HTTP, add to mobile API fileType = BINARY"
+ Also in Genivi SDL we don't save the PT to file - we put it directly in binary_data */
(*message_)[strings::msg_params][strings::file_type] = FileType::JSON;
} else if (RequestType::HTTP == request_type) {
(*message_)[strings::msg_params][strings::file_type] = FileType::BINARY;
diff --git a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc
index 68755bef54..9c60b90be5 100644
--- a/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc
+++ b/src/components/application_manager/src/commands/mobile/on_vehicle_data_notification.cc
@@ -66,10 +66,15 @@ void OnVehicleDataNotification::Run() {
ApplicationManagerImpl::instance()->IviInfoUpdated(it->second,
(*message_)[strings::msg_params][it->first].asInt());
- std::vector<ApplicationSharedPtr>::const_iterator app_it = applications.begin();
+ std::vector<ApplicationSharedPtr>::const_iterator app_it =
+ applications.begin();
+
for (; applications.end() != app_it; ++app_it) {
const ApplicationSharedPtr app = *app_it;
- DCHECK(app);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "NULL pointer");
+ continue;
+}
appNotification_it = find(appNotification.begin(), appNotification.end(), app);
if (appNotification_it == appNotification.end()) {
@@ -81,6 +86,7 @@ void OnVehicleDataNotification::Run() {
} else {
size_t idx = std::distance(appNotification.begin(), appNotification_it);
appSO[idx][it->first] = (*message_)[strings::msg_params][it->first];
+
}
}
}
@@ -92,7 +98,7 @@ void OnVehicleDataNotification::Run() {
for (size_t idx = 0; idx < appNotification.size(); idx++) {
LOG4CXX_INFO(
logger_,
- "Send OnVehicleData PRNDL notification to " << appNotification[idx]->name()
+ "Send OnVehicleData PRNDL notification to " << appNotification[idx]->name().c_str()
<< " application id " << appNotification[idx]->app_id());
(*message_)[strings::params][strings::connection_key] =
appNotification[idx]->app_id();
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 b1ac31b9d8..a3a869a85a 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
@@ -36,6 +36,8 @@
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "config_profile/profile.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -57,12 +59,7 @@ PerformAudioPassThruRequest::~PerformAudioPassThruRequest() {
void PerformAudioPassThruRequest::onTimeOut() {
LOG4CXX_AUTO_TRACE(logger_);
- if (ApplicationManagerImpl::instance()->end_audio_pass_thru()) {
- ApplicationManagerImpl::instance()->StopAudioPassThru(connection_key());
- }
-
FinishTTSSpeak();
-
CommandRequestImpl::onTimeOut();
}
@@ -92,7 +89,8 @@ void PerformAudioPassThruRequest::Run() {
if (IsWhiteSpaceExist()) {
LOG4CXX_ERROR(logger_,
- "Incoming perform audio pass thru has contains \\t\\n \\\\t \\\\n"
+ "Incoming perform audio pass thru has contains "
+ "\\t\\n \\\\t \\\\n"
" text contains only whitespace in initialPrompt");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
@@ -112,10 +110,18 @@ void PerformAudioPassThruRequest::Run() {
void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_PerformAudioPassThru: {
+ LOG4CXX_TRACE(logger_, "Received UI_PerformAudioPassThru");
+
+ if (!WaitTTSSpeak()) {
+ LOG4CXX_DEBUG(logger_, "TTS.Speak is absent");
+ return;
+ }
mobile_apis::Result::eType mobile_code =
GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
@@ -128,18 +134,24 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
return;
}
- if (ApplicationManagerImpl::instance()->end_audio_pass_thru()) {
- ApplicationManagerImpl::instance()->StopAudioPassThru(connection_key());
- }
-
FinishTTSSpeak();
std::string return_info;
- bool result = mobile_apis::Result::SUCCESS == mobile_code ||
- mobile_apis::Result::RETRY == mobile_code;
-
- if ((mobile_apis::Result::SUCCESS == mobile_code) &&
- (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_tts_speak_)) {
+ const bool result =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ mobile_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::RETRY,
+ mobile_apis::Result::WARNINGS);
+
+ const bool is_result_ok =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ mobile_code,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS);
+
+ if (is_result_ok &&
+ mobile_apis::Result::UNSUPPORTED_RESOURCE == result_tts_speak_) {
mobile_code = mobile_apis::Result::WARNINGS;
return_info = "Unsupported phoneme type sent in a prompt";
}
@@ -150,7 +162,8 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
}
case hmi_apis::FunctionID::TTS_Speak: {
LOG4CXX_INFO(logger_, "Received TTS_Speak event");
- result_tts_speak_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ result_tts_speak_ = GetMobileResultCode(
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt()));
is_active_tts_speak_ = false;
if (mobile_apis::Result::SUCCESS == result_tts_speak_) {
@@ -180,7 +193,8 @@ void PerformAudioPassThruRequest::on_event(const event_engine::Event& event) {
}
void PerformAudioPassThruRequest::SendSpeakRequest() {
- // crate HMI TTS speak request
+ LOG4CXX_AUTO_TRACE(logger_);
+
using namespace hmi_apis;
using namespace smart_objects;
@@ -205,12 +219,13 @@ void PerformAudioPassThruRequest::SendSpeakRequest() {
}
void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
smart_objects::SmartObject msg_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
msg_params[str::app_id] = connection_key();
- // duration
msg_params[hmi_request::max_duration] =
(*message_)[str::msg_params][str::max_duration];
@@ -248,6 +263,8 @@ void PerformAudioPassThruRequest::SendPerformAudioPassThruRequest() {
}
void PerformAudioPassThruRequest::SendRecordStartNotification() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
smart_objects::SmartObject msg_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
msg_params[strings::app_id] = connection_key();
@@ -256,6 +273,8 @@ void PerformAudioPassThruRequest::SendRecordStartNotification() {
}
void PerformAudioPassThruRequest::StartMicrophoneRecording() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
ApplicationManagerImpl::instance()->begin_audio_pass_thru();
ApplicationManagerImpl::instance()->StartAudioPassThruThread(
@@ -312,11 +331,43 @@ bool PerformAudioPassThruRequest::IsWhiteSpaceExist() {
return false;
}
-void PerformAudioPassThruRequest::FinishTTSSpeak(){
- if (is_active_tts_speak_) {
- is_active_tts_speak_ = false;
- SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL);
+void PerformAudioPassThruRequest::FinishTTSSpeak() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (ApplicationManagerImpl::instance()->end_audio_pass_thru()) {
+ LOG4CXX_DEBUG(logger_, "Stop AudioPassThru.");
+ ApplicationManagerImpl::instance()->
+ StopAudioPassThru(connection_key());
+ }
+ if (!is_active_tts_speak_) {
+ LOG4CXX_WARN(logger_, "TTS Speak is inactive.");
+ return;
}
+ is_active_tts_speak_ = false;
+ SendHMIRequest(hmi_apis::FunctionID::TTS_StopSpeaking, NULL);
+}
+
+bool PerformAudioPassThruRequest::WaitTTSSpeak() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ uint64_t default_timeout_msec =
+ profile::Profile::instance()->default_timeout();
+ const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
+
+ // Waiting for TTS_Speak
+ while (is_active_tts_speak_) {
+ uint64_t difference_between_start_current_time
+ = date_time::DateTime::calculateTimeSpan(start_time);
+ // Send GENERIC_ERROR after default timeout
+ if (difference_between_start_current_time > default_timeout_msec) {
+ LOG4CXX_WARN(logger_, "Expired timeout for TTS.Speak response");
+ // Don't use onTimeOut(), because default_timeout_ is bigger than
+ // Default time in *.ini file
+ FinishTTSSpeak();
+ SendResponse(false, mobile_apis::Result::eType::GENERIC_ERROR,
+ "Expired timeout for TTS.Speak response");
+ return false;
+ }
+ }
+ return true;
}
} // 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 54edc8e516..141cb44a09 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
@@ -1,6 +1,6 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -41,32 +41,36 @@
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
+#include "utils/custom_string.h"
namespace application_manager {
namespace commands {
+namespace custom_str = utils::custom_string;
+
uint32_t PerformInteractionRequest::pi_requests_count_ = 0;
PerformInteractionRequest::PerformInteractionRequest(
- const MessageSharedPtr& message)
-: CommandRequestImpl(message),
- vr_perform_interaction_code_(mobile_apis::Result::INVALID_ENUM),
- interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM),
- ui_response_recived_(false),
- vr_response_recived_(false),
- app_pi_was_active_before_(false) {
-
+ const MessageSharedPtr& message)
+ : CommandRequestImpl(message),
+ interaction_mode_(mobile_apis::InteractionMode::INVALID_ENUM),
+ ui_response_recived_(false),
+ vr_response_recived_(false),
+ ui_result_(false),
+ vr_result_(false),
+ app_pi_was_active_before_(false),
+ vr_resultCode_(mobile_apis::Result::INVALID_ENUM),
+ ui_resultCode_(mobile_apis::Result::INVALID_ENUM) {
subscribe_on_event(hmi_apis::FunctionID::UI_OnResetTimeout);
subscribe_on_event(hmi_apis::FunctionID::VR_OnCommand);
subscribe_on_event(hmi_apis::FunctionID::Buttons_OnButtonPress);
}
-PerformInteractionRequest::~PerformInteractionRequest() {
-}
+PerformInteractionRequest::~PerformInteractionRequest() {}
bool PerformInteractionRequest::Init() {
-
/* Timeout in milliseconds.
If omitted a standard value of 10000 milliseconds is used.*/
if ((*message_)[strings::msg_params].keyExists(strings::timeout)) {
@@ -97,7 +101,7 @@ void PerformInteractionRequest::Run() {
}
if (app->is_perform_interaction_active()) {
- LOG4CXX_INFO(logger_, "Application has active PerformInteraction");
+ LOG4CXX_DEBUG(logger_, "Application has active PerformInteraction");
app_pi_was_active_before_ = true;
}
@@ -112,8 +116,9 @@ void PerformInteractionRequest::Run() {
if ((mobile_apis::InteractionMode::VR_ONLY == interaction_mode_) &&
(mobile_apis::LayoutMode::KEYBOARD == interaction_layout)) {
- LOG4CXX_ERROR_EXT(logger_, "PerformInteraction contains InteractionMode"
- "=VR_ONLY and interactionLayout=KEYBOARD");
+ LOG4CXX_ERROR(logger_,
+ "PerformInteraction contains InteractionMode"
+ "=VR_ONLY and interactionLayout=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -124,38 +129,40 @@ void PerformInteractionRequest::Run() {
if (0 == choice_set_id_list_length) {
if (mobile_apis::LayoutMode::KEYBOARD == interaction_layout) {
if (mobile_apis::InteractionMode::BOTH == interaction_mode_) {
- LOG4CXX_ERROR_EXT(logger_,"interactionChoiceSetIDList is empty,"
- " InteractionMode=BOTH and"
- " interactionLayout=KEYBOARD");
+ LOG4CXX_ERROR(logger_,
+ "interactionChoiceSetIDList is empty,"
+ " InteractionMode=BOTH and"
+ " interactionLayout=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
} else {
- LOG4CXX_ERROR_EXT(logger_,"interactionChoiceSetIDList is empty"
- " and interactionLayout!=KEYBOARD");
+ LOG4CXX_ERROR(logger_,
+ "interactionChoiceSetIDList is empty"
+ " and interactionLayout!=KEYBOARD");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
- if (msg_params.keyExists(strings::vr_help)) {
- if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems(
- msg_params[strings::vr_help], app)) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "MessageHelper::VerifyImageVrHelpItems return INVALID_DATA!");
- SendResponse(false, mobile_apis::Result::INVALID_DATA);
- return;
- }
- }
+ if (choice_set_id_list_length &&
+ (!CheckChoiceIDFromRequest(
+ app, choice_set_id_list_length,
+ msg_params[strings::interaction_choice_set_id_list]))) {
- smart_objects::SmartObject& choice_list =
- 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");
+ SendResponse(false, mobile_apis::Result::INVALID_ID);
+ return;
+ }
- for (size_t i = 0; i < choice_list.length(); ++i) {
- if (!app->FindChoiceSet(choice_list[i].asInt())) {
- LOG4CXX_ERROR(logger_, "Invalid ID");
- SendResponse(false, mobile_apis::Result::INVALID_ID);
+ if (msg_params.keyExists(strings::vr_help)) {
+ if (mobile_apis::Result::SUCCESS !=
+ MessageHelper::VerifyImageVrHelpItems(msg_params[strings::vr_help],
+ app)) {
+ LOG4CXX_ERROR(logger_,
+ "Verification of " << strings::vr_help << " failed.");
+ SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
@@ -169,27 +176,24 @@ void PerformInteractionRequest::Run() {
switch (interaction_mode_) {
case mobile_apis::InteractionMode::BOTH: {
- LOG4CXX_INFO(logger_, "Interaction Mode: BOTH");
- if (!CheckChoiceSetVRSynonyms(app) ||
- !CheckChoiceSetMenuNames(app) ||
+ LOG4CXX_DEBUG(logger_, "Interaction Mode: BOTH");
+ if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
!CheckVrHelpItemPositions(app)) {
return;
}
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
- LOG4CXX_INFO(logger_, "Interaction Mode: MANUAL_ONLY");
- if (!CheckChoiceSetVRSynonyms(app) ||
- !CheckChoiceSetMenuNames(app) ||
+ LOG4CXX_DEBUG(logger_, "Interaction Mode: MANUAL_ONLY");
+ if (!CheckChoiceSetVRSynonyms(app) || !CheckChoiceSetMenuNames(app) ||
!CheckVrHelpItemPositions(app)) {
return;
}
break;
}
case mobile_apis::InteractionMode::VR_ONLY: {
- LOG4CXX_INFO(logger_, "Interaction Mode: VR_ONLY");
- if (!CheckChoiceSetVRSynonyms(app) ||
- !CheckVrHelpItemPositions(app)) {
+ LOG4CXX_DEBUG(logger_, "Interaction Mode: VR_ONLY");
+ if (!CheckChoiceSetVRSynonyms(app) || !CheckVrHelpItemPositions(app)) {
return;
}
break;
@@ -210,25 +214,33 @@ void PerformInteractionRequest::Run() {
void PerformInteractionRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ const smart_objects::SmartObject& message = event.smart_object();
+ smart_objects::SmartObject msg_param =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
switch (event.id()) {
case hmi_apis::FunctionID::UI_OnResetTimeout: {
- LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event");
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ LOG4CXX_DEBUG(logger_, "Received UI_OnResetTimeout event");
+ ApplicationManagerImpl::instance()->updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
break;
}
case hmi_apis::FunctionID::UI_PerformInteraction: {
- LOG4CXX_INFO(logger_, "Received UI_PerformInteraction event");
+ LOG4CXX_DEBUG(logger_, "Received UI_PerformInteraction event");
ui_response_recived_ = true;
- ProcessPerformInteractionResponse(event.smart_object());
+ unsubscribe_from_event(hmi_apis::FunctionID::UI_PerformInteraction);
+ ui_resultCode_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asUInt()));
+ ProcessPerformInteractionResponse(event.smart_object(), msg_param);
break;
}
case hmi_apis::FunctionID::VR_PerformInteraction: {
- LOG4CXX_INFO(logger_, "Received VR_PerformInteraction");
+ LOG4CXX_DEBUG(logger_, "Received VR_PerformInteraction");
vr_response_recived_ = true;
- ProcessVRResponse(event.smart_object());
+ unsubscribe_from_event(hmi_apis::FunctionID::VR_PerformInteraction);
+ vr_resultCode_ = GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asUInt()));
+ ProcessVRResponse(event.smart_object(), msg_param);
break;
}
default: {
@@ -236,6 +248,12 @@ void PerformInteractionRequest::on_event(const event_engine::Event& event) {
break;
}
}
+
+ if (mobile_apis::InteractionMode::BOTH == interaction_mode_ &&
+ !HasHMIResponsesToWait()) {
+ LOG4CXX_DEBUG(logger_, "Send response in BOTH iteraction mode");
+ SendBothModeResponse(msg_param);
+ }
}
void PerformInteractionRequest::onTimeOut() {
@@ -248,16 +266,14 @@ void PerformInteractionRequest::onTimeOut() {
DisablePerformInteraction();
CommandRequestImpl::onTimeOut();
} else {
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ ApplicationManagerImpl::instance()->updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
}
break;
}
case mobile_apis::InteractionMode::VR_ONLY: {
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ ApplicationManagerImpl::instance()->updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
break;
}
case mobile_apis::InteractionMode::MANUAL_ONLY: {
@@ -273,155 +289,170 @@ void PerformInteractionRequest::onTimeOut() {
};
}
-
void PerformInteractionRequest::ProcessVRResponse(
- const smart_objects::SmartObject& message) {
+ const smart_objects::SmartObject& message,
+ smart_objects::SmartObject& msg_params) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace mobile_apis;
using namespace mobile_apis::Result;
using namespace smart_objects;
+ using namespace helpers;
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
- if (!app.get()) {
+ if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- vr_perform_interaction_code_ = static_cast<eType>(
- message[strings::params][hmi_response::code].asInt());
- if (ABORTED == vr_perform_interaction_code_ ||
- TIMED_OUT == vr_perform_interaction_code_) {
- LOG4CXX_INFO(logger_, "VR response aborted");
+ CheckResponseResultCode();
+ msg_params[strings::trigger_source] =
+ static_cast<int32_t>(TriggerSource::TS_VR);
+
+ const bool is_vr_aborted_timeout =
+ Compare<Result::eType, EQ, ONE>(vr_resultCode_,
+ ABORTED,
+ TIMED_OUT);
+
+ if (is_vr_aborted_timeout) {
+ LOG4CXX_DEBUG(logger_, "VR response aborted");
if (InteractionMode::VR_ONLY == interaction_mode_) {
- LOG4CXX_INFO(logger_, "Aborted or Timeout Send Close Popup");
+ LOG4CXX_DEBUG(logger_, "Aborted or Timeout Send Close Popup");
TerminatePerformInteraction();
- SendResponse(false, vr_perform_interaction_code_);
- return;
- } else {
- LOG4CXX_INFO(logger_, "Update timeout for UI");
- ApplicationManagerImpl::instance()->
- updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ SendResponse(false, vr_resultCode_);
return;
}
- }
-
- if (REJECTED == vr_perform_interaction_code_) {
- LOG4CXX_INFO(logger_, "VR had been rejected.");
- TerminatePerformInteraction();
- SendResponse(false, vr_perform_interaction_code_);
+ LOG4CXX_DEBUG(logger_, "Update timeout for UI");
+ ApplicationManagerImpl::instance()->updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
return;
}
- if (SUCCESS == vr_perform_interaction_code_ &&
+ if (SUCCESS == vr_resultCode_ &&
InteractionMode::MANUAL_ONLY == interaction_mode_) {
- LOG4CXX_INFO(logger_, "VR response SUCCESS in MANUAL_ONLY mode " <<
- "Wait for UI response");
+ LOG4CXX_DEBUG(logger_,
+ "VR response SUCCESS in MANUAL_ONLY mode "
+ << "Wait for UI response");
// in case MANUAL_ONLY mode VR.PI SUCCESS just return
return;
}
- SmartObject msg_params = SmartObject(SmartType_Map);
- SmartObject* ptr_msg_params = NULL;
- if (message[strings::msg_params].keyExists(strings::choice_id)) {
- if (CheckChoiceIDFromResponse(
- app, message[strings::msg_params][strings::choice_id].asInt())) {
- msg_params[strings::choice_id] =
- message[strings::msg_params][strings::choice_id].asInt();
- ptr_msg_params = &msg_params;
- } else {
+ const SmartObject& hmi_msg_params = message[strings::msg_params];
+ if (hmi_msg_params.keyExists(strings::choice_id)) {
+ const int choise_id = hmi_msg_params[strings::choice_id].asInt();
+ if (!CheckChoiceIDFromResponse(app, choise_id)) {
LOG4CXX_ERROR(logger_, "Wrong choiceID was received from HMI");
TerminatePerformInteraction();
- SendResponse(false, GENERIC_ERROR,"Wrong choiceID was received from HMI");
+ SendResponse(
+ false, GENERIC_ERROR, "Wrong choiceID was received from HMI");
return;
}
+ msg_params[strings::choice_id] = choise_id;
}
- eType result_code = INVALID_ENUM;
+ vr_result_ = true;
- if (UNSUPPORTED_RESOURCE == vr_perform_interaction_code_) {
- LOG4CXX_INFO(logger_, "VR response WARNINGS");
- result_code = WARNINGS;
- } else {
- LOG4CXX_INFO(logger_, "VR response SUCCESS");
- result_code = SUCCESS;
- msg_params[strings::trigger_source] =
- static_cast<int32_t>(TriggerSource::TS_VR);
- ptr_msg_params = &msg_params;
+ if (mobile_apis::InteractionMode::BOTH == interaction_mode_ &&
+ mobile_apis::Result::SUCCESS != vr_resultCode_) {
+ LOG4CXX_DEBUG(logger_, "VR response isn't SUCCESS in BOTH mode");
+ return;
}
+
+ LOG4CXX_DEBUG(logger_, "VR response consider to be SUCCESS");
TerminatePerformInteraction();
- SendResponse(true, result_code, NULL, ptr_msg_params);
+ SendResponse(vr_result_, SUCCESS, NULL, &msg_params);
}
void PerformInteractionRequest::ProcessPerformInteractionResponse(
- const smart_objects::SmartObject& message) {
+ const smart_objects::SmartObject& message,
+ smart_objects::SmartObject& msg_params) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ using namespace smart_objects;
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
- if (!app.get()) {
+ if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- bool result = false;
- std::string info;
+ ui_result_ =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ ui_resultCode_,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
- smart_objects::SmartObject msg_params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ const bool is_pi_warning =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ ui_resultCode_,
+ mobile_apis::Result::WARNINGS);
- mobile_apis::Result::eType result_code =
- GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asUInt()));
-
- if (mobile_apis::Result::SUCCESS == result_code) {
- result = true;
- }
+ const bool is_pi_unsupported =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ ui_resultCode_,
+ mobile_apis::Result::UNSUPPORTED_RESOURCE);
- if (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) {
- result = true;
- result_code = mobile_apis::Result::WARNINGS;
- info = "Unsupported phoneme type was sent in an item";
- }
+ std::string info;
- if (result) {
+ if (ui_result_) {
+ if (is_pi_warning) {
+ ui_resultCode_ = mobile_apis::Result::WARNINGS;
+ info = "Unsupported phoneme type was sent in an item";
+ if (message.keyExists(strings::params)
+ && message[strings::params].keyExists(strings::data)) {
+ msg_params = message[strings::params][strings::data];
+ }
+ } else if (is_pi_unsupported) {
+ ui_resultCode_ = mobile_apis::Result::UNSUPPORTED_RESOURCE;
+ info = "Unsupported phoneme type was sent in an item";
+ } else if (message.keyExists(strings::msg_params)) {
+ msg_params = message[strings::msg_params];
+ }
// result code must be GENERIC_ERROR in case wrong choice_id
- if (message[strings::msg_params].keyExists(strings::choice_id)) {
- if (!CheckChoiceIDFromResponse(app, message[strings::msg_params]
- [strings::choice_id].asInt())) {
- result_code = mobile_apis::Result::GENERIC_ERROR;
+ if (msg_params.keyExists(strings::choice_id)) {
+ if (!CheckChoiceIDFromResponse(app,
+ msg_params[strings::choice_id].asInt())) {
+ ui_resultCode_ = mobile_apis::Result::GENERIC_ERROR;
info = "Wrong choiceID was received from HMI";
} else {
- msg_params = message[strings::msg_params];
- msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_MENU;
+ msg_params[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_MENU;
+ }
+ } else if (msg_params.keyExists(strings::manual_text_entry)) {
+ msg_params[strings::trigger_source] =
+ mobile_apis::TriggerSource::TS_KEYBOARD;
+ if (msg_params[strings::manual_text_entry].empty()) {
+ msg_params.erase(strings::manual_text_entry);
}
- } else if (message[strings::msg_params].keyExists(strings::manual_text_entry)) {
- msg_params = message[strings::msg_params];
- msg_params[strings::trigger_source] = mobile_apis::TriggerSource::TS_KEYBOARD;
}
}
- DisablePerformInteraction();
+ const SmartObject* response_params =
+ msg_params.empty()
+ ? NULL
+ : &msg_params;
- const char* return_info = (info.empty()) ? NULL : info.c_str();
- const smart_objects::SmartObject* response_params = (msg_params.empty()) ? NULL : &msg_params;
- SendResponse(result, result_code, return_info, response_params);
+ if (mobile_apis::InteractionMode::BOTH != interaction_mode_) {
+ DisablePerformInteraction();
+ SendResponse(ui_result_, ui_resultCode_, info.c_str(), response_params);
+ }
}
void PerformInteractionRequest::SendUIPerformInteractionRequest(
application_manager::ApplicationSharedPtr const app) {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject& choice_set_id_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
- mobile_apis::InteractionMode::eType mode =
+ mobile_apis::InteractionMode::eType mode =
static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt());
+ (*message_)[strings::msg_params][strings::interaction_mode].asInt());
if (mobile_apis::InteractionMode::VR_ONLY != mode) {
msg_params[hmi_request::initial_text][hmi_request::field_name] =
@@ -443,24 +474,23 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
if (mobile_apis::InteractionMode::BOTH == mode ||
mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- msg_params[strings::timeout] = default_timeout_/2;
+ msg_params[strings::timeout] = default_timeout_ / 2;
} else {
msg_params[strings::timeout] = default_timeout_;
}
msg_params[strings::app_id] = app->app_id();
if (mobile_apis::InteractionMode::VR_ONLY != mode) {
- msg_params[strings::choice_set] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ msg_params[strings::choice_set] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
}
int32_t index_array_of_vr_help = 0;
for (size_t i = 0; i < choice_set_id_list.length(); ++i) {
- smart_objects::SmartObject* choice_set = app->FindChoiceSet(
- choice_set_id_list[i].asInt());
+ smart_objects::SmartObject* choice_set =
+ app->FindChoiceSet(choice_set_id_list[i].asInt());
if (choice_set) {
// save perform interaction choice set
- app->AddPerformInteractionChoiceSet(correlation_id(),
- choice_set_id_list[i].asInt(),
- *choice_set);
+ app->AddPerformInteractionChoiceSet(
+ correlation_id(), choice_set_id_list[i].asInt(), *choice_set);
for (size_t j = 0; j < (*choice_set)[strings::choice_set].length(); ++j) {
if (mobile_apis::InteractionMode::VR_ONLY != mode) {
size_t index = msg_params[strings::choice_set].length();
@@ -469,8 +499,8 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
// vrCommands should be added via VR.AddCommand only
msg_params[strings::choice_set][index].erase(strings::vr_commands);
}
- if (mobile_apis::InteractionMode::MANUAL_ONLY !=
- mode && !is_vr_help_item) {
+ if (mobile_apis::InteractionMode::MANUAL_ONLY != mode &&
+ !is_vr_help_item) {
smart_objects::SmartObject& vr_commands =
(*choice_set)[strings::choice_set][j][strings::vr_commands];
if (0 < vr_commands.length()) {
@@ -484,32 +514,31 @@ void PerformInteractionRequest::SendUIPerformInteractionRequest(
}
}
}
- if ((*message_)[strings::msg_params]
- .keyExists(hmi_request::interaction_layout)
- && mobile_apis::InteractionMode::VR_ONLY != mode) {
+ if ((*message_)[strings::msg_params].keyExists(
+ hmi_request::interaction_layout) &&
+ mobile_apis::InteractionMode::VR_ONLY != mode) {
msg_params[hmi_request::interaction_layout] =
- (*message_)[strings::msg_params][hmi_request::interaction_layout].
- asInt();
+ (*message_)[strings::msg_params][hmi_request::interaction_layout]
+ .asInt();
}
- CreateUIPerformInteraction(msg_params, app);
-}
-
-void PerformInteractionRequest::CreateUIPerformInteraction(
- const smart_objects::SmartObject& msg_params,
- application_manager::ApplicationSharedPtr const app) {
- SendHMIRequest(hmi_apis::FunctionID::UI_PerformInteraction,
- &msg_params, true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::UI_PerformInteraction, &msg_params, true);
}
void PerformInteractionRequest::SendVRPerformInteractionRequest(
application_manager::ApplicationSharedPtr const app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
smart_objects::SmartObject msg_params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
+
smart_objects::SmartObject& choice_list =
- (*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
+ (*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
if (mobile_apis::InteractionMode::MANUAL_ONLY != interaction_mode_) {
- msg_params[strings::grammar_id] = smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[strings::grammar_id] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+
int32_t grammar_id_index = 0;
for (uint32_t i = 0; i < choice_list.length(); ++i) {
smart_objects::SmartObject* choice_set =
@@ -518,16 +547,14 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
LOG4CXX_WARN(logger_, "Couldn't found choiset");
continue;
}
- msg_params[strings::grammar_id][grammar_id_index++]=
+ msg_params[strings::grammar_id][grammar_id_index++] =
(*choice_set)[strings::grammar_id].asUInt();
}
}
if ((*message_)[strings::msg_params].keyExists(strings::help_prompt)) {
-
msg_params[strings::help_prompt] =
(*message_)[strings::msg_params][strings::help_prompt];
-
} else {
if (choice_list.length() != 0) {
msg_params[strings::help_prompt] =
@@ -539,9 +566,8 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
app->FindChoiceSet(choice_list[i].asInt());
if (choice_set) {
- for (uint32_t j = 0;
- j < (*choice_set)[strings::choice_set].length();
- ++j) {
+ for (uint32_t j = 0; j < (*choice_set)[strings::choice_set].length();
+ ++j) {
smart_objects::SmartObject& vr_commands =
(*choice_set)[strings::choice_set][j][strings::vr_commands];
if (0 < vr_commands.length()) {
@@ -563,7 +589,7 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
if ((*message_)[strings::msg_params].keyExists(strings::timeout_prompt)) {
msg_params[strings::timeout_prompt] =
- (*message_)[strings::msg_params][strings::timeout_prompt];
+ (*message_)[strings::msg_params][strings::timeout_prompt];
} else {
if (msg_params.keyExists(strings::help_prompt)) {
msg_params[strings::timeout_prompt] = msg_params[strings::help_prompt];
@@ -571,38 +597,40 @@ void PerformInteractionRequest::SendVRPerformInteractionRequest(
}
if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) {
- msg_params[strings::initial_prompt] =
- (*message_)[strings::msg_params][strings::initial_prompt];
+ msg_params[strings::initial_prompt] =
+ (*message_)[strings::msg_params][strings::initial_prompt];
}
mobile_apis::InteractionMode::eType mode =
static_cast<mobile_apis::InteractionMode::eType>(
- (*message_)[strings::msg_params][strings::interaction_mode].asInt());
+ (*message_)[strings::msg_params][strings::interaction_mode].asInt());
if (mobile_apis::InteractionMode::BOTH == mode ||
mobile_apis::InteractionMode::MANUAL_ONLY == mode) {
- msg_params[strings::timeout] = default_timeout_/2;
+ msg_params[strings::timeout] = default_timeout_ / 2;
} else {
msg_params[strings::timeout] = default_timeout_;
}
-
- SendHMIRequest(hmi_apis::FunctionID::VR_PerformInteraction, &msg_params,
- true);
+ msg_params[strings::app_id] = app->app_id();
+ SendHMIRequest(
+ hmi_apis::FunctionID::VR_PerformInteraction, &msg_params, true);
}
bool PerformInteractionRequest::CheckChoiceSetMenuNames(
application_manager::ApplicationSharedPtr const app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
smart_objects::SmartObject& choice_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
for (size_t i = 0; i < choice_list.length(); ++i) {
// choice_set contains SmartObject msg_params
- smart_objects::SmartObject* i_choice_set = app->FindChoiceSet(
- choice_list[i].asInt());
+ smart_objects::SmartObject* i_choice_set =
+ app->FindChoiceSet(choice_list[i].asInt());
for (size_t j = 0; j < choice_list.length(); ++j) {
- smart_objects::SmartObject* j_choice_set = app->FindChoiceSet(
- choice_list[j].asInt());
+ smart_objects::SmartObject* j_choice_set =
+ app->FindChoiceSet(choice_list[j].asInt());
if (i == j) {
// skip check the same element
@@ -619,16 +647,17 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames(
size_t jj = 0;
for (; ii < (*i_choice_set)[strings::choice_set].length(); ++ii) {
for (; jj < (*j_choice_set)[strings::choice_set].length(); ++jj) {
- std::string ii_menu_name =
+ const std::string& ii_menu_name =
(*i_choice_set)[strings::choice_set][ii][strings::menu_name]
.asString();
- std::string jj_menu_name =
+ const std::string& jj_menu_name =
(*j_choice_set)[strings::choice_set][jj][strings::menu_name]
.asString();
if (ii_menu_name == jj_menu_name) {
LOG4CXX_ERROR(logger_, "Choice set has duplicated menu name");
- SendResponse(false, mobile_apis::Result::DUPLICATE_NAME,
+ SendResponse(false,
+ mobile_apis::Result::DUPLICATE_NAME,
"Choice set has duplicated menu name");
return false;
}
@@ -642,17 +671,19 @@ bool PerformInteractionRequest::CheckChoiceSetMenuNames(
bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
application_manager::ApplicationSharedPtr const app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
smart_objects::SmartObject& choice_list =
(*message_)[strings::msg_params][strings::interaction_choice_set_id_list];
for (size_t i = 0; i < choice_list.length(); ++i) {
// choice_set contains SmartObject msg_params
- smart_objects::SmartObject* i_choice_set = app->FindChoiceSet(
- choice_list[i].asInt());
+ smart_objects::SmartObject* i_choice_set =
+ app->FindChoiceSet(choice_list[i].asInt());
for (size_t j = 0; j < choice_list.length(); ++j) {
- smart_objects::SmartObject* j_choice_set = app->FindChoiceSet(
- choice_list[j].asInt());
+ smart_objects::SmartObject* j_choice_set =
+ app->FindChoiceSet(choice_list[j].asInt());
if (i == j) {
// skip check the same element
@@ -678,11 +709,14 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
for (size_t iii = 0; iii < ii_vr_commands.length(); ++iii) {
for (size_t jjj = 0; jjj < jj_vr_commands.length(); ++jjj) {
- std::string vr_cmd_i = ii_vr_commands[iii].asString();
- std::string vr_cmd_j = jj_vr_commands[jjj].asString();
- if (0 == strcasecmp(vr_cmd_i.c_str(), vr_cmd_j.c_str())) {
+ const custom_str::CustomString& vr_cmd_i =
+ ii_vr_commands[iii].asCustomString();
+ const custom_str::CustomString& vr_cmd_j =
+ jj_vr_commands[jjj].asCustomString();
+ if (vr_cmd_i.CompareIgnoreCase(vr_cmd_j)) {
LOG4CXX_ERROR(logger_, "Choice set has duplicated VR synonym");
- SendResponse(false, mobile_apis::Result::DUPLICATE_NAME,
+ SendResponse(false,
+ mobile_apis::Result::DUPLICATE_NAME,
"Choice set has duplicated VR synonym");
return false;
}
@@ -698,10 +732,10 @@ bool PerformInteractionRequest::CheckChoiceSetVRSynonyms(
bool PerformInteractionRequest::CheckVrHelpItemPositions(
application_manager::ApplicationSharedPtr const app) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (!(*message_)[strings::msg_params].keyExists(strings::vr_help)) {
- LOG4CXX_INFO(logger_, ""
- "PerformInteractionRequest::CheckVrHelpItemPositions vr_help omitted");
+ LOG4CXX_DEBUG(logger_, strings::vr_help << " is omitted.");
return true;
}
@@ -712,7 +746,8 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions(
for (size_t i = 0; i < vr_help.length(); ++i) {
if (position != vr_help[i][strings::position].asInt()) {
LOG4CXX_ERROR(logger_, "Non-sequential vrHelp item position");
- SendResponse(false, mobile_apis::Result::REJECTED,
+ SendResponse(false,
+ mobile_apis::Result::REJECTED,
"Non-sequential vrHelp item position");
return false;
}
@@ -722,6 +757,8 @@ bool PerformInteractionRequest::CheckVrHelpItemPositions(
}
void PerformInteractionRequest::DisablePerformInteraction() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
@@ -750,7 +787,6 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
return true;
}
-
if ((*message_)[strings::msg_params].keyExists(strings::initial_prompt)) {
const smart_objects::SmartArray* ip_array =
(*message_)[strings::msg_params][strings::initial_prompt].asArray();
@@ -827,8 +863,10 @@ bool PerformInteractionRequest::IsWhiteSpaceExist() {
}
void PerformInteractionRequest::TerminatePerformInteraction() {
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[hmi_request::method_name] = "UI.PerformInteraction";
SendHMIRequest(hmi_apis::FunctionID::UI_ClosePopUp, &msg_params);
DisablePerformInteraction();
@@ -847,8 +885,8 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
const PerformChoice& choice = choice_set_map_it->second;
PerformChoice::const_iterator it = choice.begin();
for (; choice.end() != it; ++it) {
- const smart_objects::SmartObject& choice_set = (*it->second).getElement(
- strings::choice_set);
+ const smart_objects::SmartObject& choice_set =
+ (*it->second).getElement(strings::choice_set);
for (size_t j = 0; j < choice_set.length(); ++j) {
if (choice_id ==
choice_set.getElement(j).getElement(strings::choice_id).asInt()) {
@@ -860,6 +898,100 @@ bool PerformInteractionRequest::CheckChoiceIDFromResponse(
return false;
}
+bool PerformInteractionRequest::CheckChoiceIDFromRequest(
+ ApplicationSharedPtr app,
+ const size_t choice_set_id_list_length,
+ const smart_objects::SmartObject& choice_set_id_list) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ size_t choice_list_length = 0;
+ std::set<uint32_t> choice_id_set;
+ smart_objects::SmartObject* choice_set = 0;
+ std::pair<std::set<uint32_t>::iterator, bool> ins_res;
+
+ for (size_t i = 0; i < choice_set_id_list_length; ++i) {
+ choice_set = app->FindChoiceSet(choice_set_id_list[i].asInt());
+ if (!choice_set) {
+ LOG4CXX_ERROR(logger_, "Couldn't find choiset_id = "
+ <<choice_set_id_list[i].asInt());
+ return false;
+ }
+ choice_list_length = (*choice_set)[strings::choice_set].length();
+ const smart_objects::SmartObject& choices_list =
+ (*choice_set)[strings::choice_set];
+ for (size_t k = 0; k < choice_list_length; ++k) {
+ ins_res = choice_id_set.insert(choices_list[k][strings::choice_id].asInt());
+ if (!ins_res.second) {
+ LOG4CXX_ERROR(logger_, "Choise with ID "
+ << choices_list[k][strings::choice_id].asInt()
+ << " already exists");
+ return false;
+ }
+ }
+ }
+ return true;
+}
+
+const bool PerformInteractionRequest::HasHMIResponsesToWait() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return !ui_response_recived_ || !vr_response_recived_;
+}
+
+void PerformInteractionRequest::CheckResponseResultCode() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ mobile_apis::Result::eType resultCode = mobile_apis::Result::INVALID_ENUM;
+ bool result = false;
+ if (mobile_apis::Result::GENERIC_ERROR == vr_resultCode_) {
+ LOG4CXX_DEBUG(logger_, "VR response GENERIC_ERROR");
+ resultCode = mobile_apis::Result::GENERIC_ERROR;
+ } else if (mobile_apis::Result::REJECTED == vr_resultCode_) {
+ LOG4CXX_DEBUG(logger_, "VR had been rejected.");
+ resultCode = mobile_apis::Result::REJECTED;
+ } else if (mobile_apis::Result::WARNINGS == vr_resultCode_ ||
+ mobile_apis::Result::UNSUPPORTED_REQUEST == vr_resultCode_) {
+ LOG4CXX_DEBUG(logger_, "VR response WARNINGS");
+ resultCode = mobile_api::Result::WARNINGS;
+ result = true;
+ }
+
+ if (mobile_apis::Result::INVALID_ENUM != resultCode) {
+ TerminatePerformInteraction();
+ SendResponse(result, resultCode);
+ }
+}
+
+void PerformInteractionRequest::SendBothModeResponse(
+ const smart_objects::SmartObject& msg_param) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis::Result;
+
+ bool result = ui_result_ || vr_result_;
+ mobile_apis::Result::eType perform_interaction_result_code = ui_resultCode_;
+
+ if (UNSUPPORTED_RESOURCE == vr_resultCode_ &&
+ UNSUPPORTED_RESOURCE != ui_resultCode_) {
+ perform_interaction_result_code = vr_resultCode_;
+ } else if (UNSUPPORTED_RESOURCE == vr_resultCode_ &&
+ UNSUPPORTED_RESOURCE == ui_resultCode_) {
+ result = false;
+ }
+
+ const bool is_error_code = (SUCCESS != perform_interaction_result_code ||
+ WARNINGS != perform_interaction_result_code);
+
+ if (vr_resultCode_ == ui_resultCode_ && is_error_code) {
+ result = false;
+ }
+
+ const smart_objects::SmartObject* response_params =
+ msg_param.empty()
+ ? NULL
+ : &msg_param;
+
+ TerminatePerformInteraction();
+ SendResponse(result, perform_interaction_result_code, NULL, response_params);
+}
+
} // namespace commands
} // namespace application_manager
diff --git a/src/components/application_manager/src/commands/mobile/put_file_request.cc b/src/components/application_manager/src/commands/mobile/put_file_request.cc
index 88743e3668..624587d0ce 100644
--- a/src/components/application_manager/src/commands/mobile/put_file_request.cc
+++ b/src/components/application_manager/src/commands/mobile/put_file_request.cc
@@ -127,7 +127,7 @@ void PutFileRequest::Run() {
(*message_)[strings::msg_params].keyExists(strings::offset);
if (offset_exist) {
- offset_ = (*message_)[strings::msg_params][strings::offset].asInt64();
+ offset_ = (*message_)[strings::msg_params][strings::offset].asInt();
}
if ((*message_)[strings::msg_params].
@@ -185,7 +185,7 @@ void PutFileRequest::Run() {
sync_file_name_ = file_path + "/" + sync_file_name_;
switch (save_result) {
case mobile_apis::Result::SUCCESS: {
-
+ LOG4CXX_INFO(logger_, "PutFile is successful");
if (!is_system_file) {
AppFile file(sync_file_name_, is_persistent_file_,
is_download_compleate, file_type_);
@@ -200,7 +200,7 @@ void PutFileRequest::Run() {
/* It can be first part of new big file, so we need to update
information about it's downloading status and persistence */
if (!application->UpdateFile(file)) {
- LOG4CXX_INFO(logger_, "Couldn't update file");
+ LOG4CXX_ERROR(logger_, "Couldn't update file");
/* If it is impossible to update file, application doesn't
know about existing this file */
SendResponse(false, mobile_apis::Result::INVALID_DATA,
@@ -224,7 +224,7 @@ void PutFileRequest::Run() {
break;
}
default:
- LOG4CXX_WARN(logger_, "Save in unsuccessful. Result = " << save_result);
+ LOG4CXX_WARN(logger_, "PutFile is unsuccessful. Result = " << save_result);
SendResponse(false, save_result, "Can't save file", &response_params);
break;
}
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 18f43f12ca..8ee06d0b7a 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
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -31,6 +30,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string>
#include "application_manager/commands/mobile/read_did_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
@@ -59,7 +59,7 @@ void ReadDIDRequest::Run() {
.asUInt());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "An application is not registered.");
+ LOG4CXX_ERROR(logger_, "An application is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -73,7 +73,7 @@ void ReadDIDRequest::Run() {
}
if ((*message_)[strings::msg_params][strings::did_location].empty()) {
- LOG4CXX_ERROR_EXT(logger_, "INVALID_DATA");
+ LOG4CXX_ERROR(logger_, "INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -101,7 +101,11 @@ void ReadDIDRequest::on_event(const event_engine::Event& event) {
bool result = mobile_apis::Result::SUCCESS == result_code;
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ const std::string return_info =
+ message[strings::msg_params][hmi_response::message].asString();
+
+ SendResponse(result, result_code, return_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
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 36b2c27f7f..8678ea64c7 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
@@ -43,9 +43,12 @@
#include "application_manager/policies/policy_handler.h"
#include "config_profile/profile.h"
#include "interfaces/MOBILE_API.h"
+#include "utils/make_shared.h"
namespace {
+namespace custom_str = utils::custom_string;
+
mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) {
if ("DEFAULT" == str) {
return mobile_apis::AppHMIType::DEFAULT;
@@ -73,60 +76,54 @@ mobile_apis::AppHMIType::eType StringToAppHMIType(const std::string& str) {
}
struct AppHMITypeInserter {
- AppHMITypeInserter(smart_objects::SmartObject& so_array)
- : index_(0),
- so_array_(so_array) {
- }
+ AppHMITypeInserter(smart_objects::SmartObject& so_array)
+ : index_(0), so_array_(so_array) {}
- bool operator()(const std::string& app_hmi_type) {
- so_array_[index_] = StringToAppHMIType(app_hmi_type);
- ++index_;
- return true;
- }
+ bool operator()(const std::string& app_hmi_type) {
+ so_array_[index_] = StringToAppHMIType(app_hmi_type);
+ ++index_;
+ return true;
+ }
- private:
- uint32_t index_;
- smart_objects::SmartObject& so_array_;
+ private:
+ uint32_t index_;
+ smart_objects::SmartObject& so_array_;
};
struct CheckMissedTypes {
- CheckMissedTypes(const policy::StringArray& policy_app_types,
- std::string& log)
- : policy_app_types_(policy_app_types),
- log_(log) {
- }
-
- bool operator()(const smart_objects::SmartArray::value_type& value) {
- std::string app_type_str = value.asString();
- policy::StringArray::const_iterator it = policy_app_types_.begin();
- policy::StringArray::const_iterator it_end = policy_app_types_.end();
- for (; it != it_end; ++it) {
- if (app_type_str == *it) {
- return true;
- }
+ CheckMissedTypes(const policy::StringArray& policy_app_types,
+ std::string& log)
+ : policy_app_types_(policy_app_types), log_(log) {}
+
+ bool operator()(const smart_objects::SmartArray::value_type& value) {
+ const std::string app_type_str = value.asString();
+ policy::StringArray::const_iterator it = policy_app_types_.begin();
+ policy::StringArray::const_iterator it_end = policy_app_types_.end();
+ for (; it != it_end; ++it) {
+ if (app_type_str == *it) {
+ return true;
}
+ }
- log_ += app_type_str;
- log_ += ",";
+ log_ += app_type_str;
+ log_ += ",";
- return true;
- }
+ return true;
+ }
- private:
- const policy::StringArray& policy_app_types_;
- std::string& log_;
+ private:
+ const policy::StringArray& policy_app_types_;
+ std::string& log_;
};
struct IsSameNickname {
- IsSameNickname(const std::string& app_id):
- app_id_(app_id) {
- }
- bool operator()(const policy::StringArray::value_type nickname) const {
- return !strcasecmp(app_id_.c_str(), nickname.c_str());
+ IsSameNickname(const custom_str::CustomString& app_id) : app_id_(app_id) {}
+ bool operator()(const policy::StringArray::value_type& nickname) const {
+ return app_id_.CompareIgnoreCase(nickname.c_str());
}
-private:
- const std::string& app_id_;
+ private:
+ const custom_str::CustomString& app_id_;
};
}
@@ -135,13 +132,11 @@ namespace application_manager {
namespace commands {
RegisterAppInterfaceRequest::RegisterAppInterfaceRequest(
- const MessageSharedPtr& message)
- : CommandRequestImpl(message),
- result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {
-}
+ const MessageSharedPtr& message)
+ : CommandRequestImpl(message)
+ , result_checking_app_hmi_type_(mobile_apis::Result::INVALID_ENUM) {}
-RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {
-}
+RegisterAppInterfaceRequest::~RegisterAppInterfaceRequest() {}
bool RegisterAppInterfaceRequest::Init() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -149,10 +144,13 @@ bool RegisterAppInterfaceRequest::Init() {
}
void RegisterAppInterfaceRequest::Run() {
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::Run " << connection_key());
+ using namespace helpers;
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Connection key is " << connection_key());
// Fix problem with SDL and HMI HTML. This problem is not actual for HMI PASA.
- // Flag conditional compilation specific to customer is used in order to exclude hit code
+ // Flag conditional compilation specific to customer is used in order to
+ // exclude hit code
// to RTC
// FIXME(EZamakhov): on shutdown - get freez
@@ -160,13 +158,16 @@ void RegisterAppInterfaceRequest::Run() {
while (ApplicationManagerImpl::exists() &&
!ApplicationManagerImpl::instance()->IsStopping() &&
!ApplicationManagerImpl::instance()->IsHMICooperating()) {
- LOG4CXX_DEBUG(logger_, "Waiting for the HMI... conn_key="
- << connection_key() << ", correlation_id=" << correlation_id()
- << ", default_timeout=" << default_timeout()
- << ", thread=" << pthread_self());
- ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
- correlation_id(),
- default_timeout());
+ LOG4CXX_DEBUG(logger_,
+ "Waiting for the HMI... conn_key=" << connection_key()
+ << ", correlation_id="
+ << correlation_id()
+ << ", default_timeout="
+ << default_timeout()
+ << ", thread="
+ << pthread_self());
+ ApplicationManagerImpl::instance()->updateRequestTimeout(
+ connection_key(), correlation_id(), default_timeout());
sleep(1);
// TODO(DK): timer_->StartWait(1);
}
@@ -179,25 +180,35 @@ void RegisterAppInterfaceRequest::Run() {
return;
}
- const std::string mobile_app_id = (*message_)[strings::msg_params][strings::app_id]
- .asString();
-
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationManagerImpl::instance()->application(connection_key());
if (application) {
SendResponse(false, mobile_apis::Result::APPLICATION_REGISTERED_ALREADY);
return;
}
+ const smart_objects::SmartObject& msg_params =
+ (*message_)[strings::msg_params];
+
+ const std::string& policy_app_id = msg_params[strings::app_id].asString();
+
+ if (ApplicationManagerImpl::instance()->IsApplicationForbidden(
+ connection_key(), policy_app_id)) {
+ SendResponse(false, mobile_apis::Result::TOO_MANY_PENDING_REQUESTS);
+ return;
+ }
+
if (IsApplicationWithSameAppIdRegistered()) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
mobile_apis::Result::eType policy_result = CheckWithPolicyData();
- if (mobile_apis::Result::SUCCESS != policy_result
- && mobile_apis::Result::WARNINGS != policy_result) {
+ if (Compare<mobile_apis::Result::eType, NEQ, ALL>(
+ policy_result,
+ mobile_apis::Result::SUCCESS,
+ mobile_apis::Result::WARNINGS)) {
SendResponse(false, policy_result);
return;
}
@@ -205,11 +216,12 @@ void RegisterAppInterfaceRequest::Run() {
mobile_apis::Result::eType coincidence_result = CheckCoincidence();
if (mobile_apis::Result::SUCCESS != coincidence_result) {
- LOG4CXX_ERROR_EXT(logger_, "Coincidence check failed.");
+ LOG4CXX_ERROR(logger_, "Coincidence check failed.");
if (mobile_apis::Result::DUPLICATE_NAME == coincidence_result) {
usage_statistics::AppCounter count_of_rejections_duplicate_name(
- policy::PolicyHandler::instance()->GetStatisticManager(), mobile_app_id,
- usage_statistics::REJECTIONS_DUPLICATE_NAME);
+ policy::PolicyHandler::instance()->GetStatisticManager(),
+ policy_app_id,
+ usage_statistics::REJECTIONS_DUPLICATE_NAME);
++count_of_rejections_duplicate_name;
}
SendResponse(false, coincidence_result);
@@ -218,241 +230,263 @@ void RegisterAppInterfaceRequest::Run() {
if (IsWhiteSpaceExist()) {
LOG4CXX_INFO(logger_,
- "Incoming register app interface has contains \t\n \\t \\n");
+ "Incoming register app interface has contains \t\n \\t \\n");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
- const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ application =
+ ApplicationManagerImpl::instance()->RegisterApplication(message_);
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->RegisterApplication(message_);
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application hasn't been registered!");
+ return;
+ }
+ // For resuming application need to restore hmi_app_id from resumeCtrl
+ resumption::ResumeCtrl& resumer =
+ ApplicationManagerImpl::instance()->resume_controller();
- if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "Application " <<
- msg_params[strings::app_name].asString() <<
- " hasn't been registered!");
+ const std::string& device_mac = application->mac_address();
+
+ // there is side affect with 2 mobile app with the same mobile app_id
+ if (resumer.IsApplicationSaved(policy_app_id, device_mac)) {
+ application->set_hmi_application_id(
+ resumer.GetHMIApplicationID(policy_app_id, device_mac));
} else {
- app->set_is_media_application(
- msg_params[strings::is_media_application].asBool());
+ application->set_hmi_application_id(
+ ApplicationManagerImpl::instance()->GenerateNewHMIAppID());
+ }
- if (msg_params.keyExists(strings::vr_synonyms)) {
- app->set_vr_synonyms(msg_params[strings::vr_synonyms]);
- }
+ application->set_is_media_application(
+ msg_params[strings::is_media_application].asBool());
- if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
- app->set_ngn_media_screen_name(
- msg_params[strings::ngn_media_screen_app_name]);
- }
+ if (msg_params.keyExists(strings::vr_synonyms)) {
+ application->set_vr_synonyms(msg_params[strings::vr_synonyms]);
+ }
- if (msg_params.keyExists(strings::tts_name)) {
- app->set_tts_name(msg_params[strings::tts_name]);
- }
+ if (msg_params.keyExists(strings::ngn_media_screen_app_name)) {
+ application->set_ngn_media_screen_name(
+ msg_params[strings::ngn_media_screen_app_name]);
+ }
+
+ if (msg_params.keyExists(strings::tts_name)) {
+ application->set_tts_name(msg_params[strings::tts_name]);
+ }
- if (msg_params.keyExists(strings::app_hmi_type)) {
- app->set_app_types(msg_params[strings::app_hmi_type]);
+ if (msg_params.keyExists(strings::app_hmi_type)) {
+ application->set_app_types(msg_params[strings::app_hmi_type]);
- // check app type
- const smart_objects::SmartObject& app_type =
+ // check app type
+ const smart_objects::SmartObject& app_type =
msg_params.getElement(strings::app_hmi_type);
- for (size_t i = 0; i < app_type.length(); ++i) {
- if (mobile_apis::AppHMIType::NAVIGATION ==
- static_cast<mobile_apis::AppHMIType::eType>(
- app_type.getElement(i).asUInt())) {
- app->set_is_navi(true);
- }
- if (mobile_apis::AppHMIType::COMMUNICATION ==
- static_cast<mobile_apis::AppHMIType::eType>(
+ for (size_t i = 0; i < app_type.length(); ++i) {
+ if (mobile_apis::AppHMIType::NAVIGATION ==
+ static_cast<mobile_apis::AppHMIType::eType>(
app_type.getElement(i).asUInt())) {
- app->set_voice_communication_supported(true);
- }
+ application->set_is_navi(true);
+ }
+ if (mobile_apis::AppHMIType::COMMUNICATION ==
+ static_cast<mobile_apis::AppHMIType::eType>(
+ app_type.getElement(i).asUInt())) {
+ application->set_voice_communication_supported(true);
}
}
+ }
- const connection_handler::DeviceHandle handle = app->device();
- // Add device to policy table and set device info, if any
- std::string device_mac_address =
- application_manager::MessageHelper::GetDeviceMacAddressForHandle(handle);
- policy::DeviceParams dev_params;
- application_manager::MessageHelper::GetDeviceInfoForHandle(handle,
- &dev_params);
- policy::DeviceInfo device_info;
- device_info.AdoptDeviceType(dev_params.device_connection_type);
- if (msg_params.keyExists(strings::device_info)) {
- FillDeviceInfo(&device_info);
- }
+ // Add device to policy table and set device info, if any
+ policy::DeviceParams dev_params;
+ if (-1 ==
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer()
+ .GetDataOnDeviceID(application->device(),
+ &dev_params.device_name,
+ NULL,
+ &dev_params.device_mac_address,
+ &dev_params.device_connection_type)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to extract information for device "
+ << application->device());
+ }
- policy::PolicyHandler::instance()->SetDeviceInfo(device_mac_address,
- device_info);
+ policy::DeviceInfo device_info;
+ device_info.AdoptDeviceType(dev_params.device_connection_type);
+ if (msg_params.keyExists(strings::device_info)) {
+ FillDeviceInfo(&device_info);
+ }
- SendRegisterAppInterfaceResponseToMobile();
+ policy::PolicyHandler::instance()->SetDeviceInfo(
+ dev_params.device_mac_address,
+ device_info);
- MessageHelper::SendLockScreenIconUrlNotification(
- (*message_)[strings::params][strings::connection_key].asInt());
- }
+ SendRegisterAppInterfaceResponseToMobile();
}
-void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
- mobile_apis::Result::eType result) {
+void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile() {
+ LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObject response_params(smart_objects::SmartType_Map);
- ApplicationManagerImpl* app_manager = ApplicationManagerImpl::instance();
- const HMICapabilities& hmi_capabilities = app_manager->hmi_capabilities();
+ mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
+
+ const HMICapabilities& hmi_capabilities =
+ ApplicationManagerImpl::instance()->hmi_capabilities();
+
const uint32_t key = connection_key();
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(key);
+ ApplicationManagerImpl::instance()->application(key);
+ resumption::ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller();
if (!application) {
- LOG4CXX_ERROR(logger_, "There is no application for such connection key" <<
- key);
+ LOG4CXX_ERROR(logger_, "There is no application for such connection key" << key);
+ LOG4CXX_DEBUG(logger_, "Need to start resume data persistent timer");
+ resumer.OnAppRegistrationEnd();
return;
}
response_params[strings::sync_msg_version][strings::major_version] =
- APIVersion::kAPIV3;
+ APIVersion::kAPIV3;
response_params[strings::sync_msg_version][strings::minor_version] =
- APIVersion::kAPIV0;
+ APIVersion::kAPIV0;
response_params[strings::language] = hmi_capabilities.active_vr_language();
response_params[strings::hmi_display_language] =
- hmi_capabilities.active_ui_language();
+ hmi_capabilities.active_ui_language();
const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ (*message_)[strings::msg_params];
if (msg_params[strings::language_desired].asInt() !=
- hmi_capabilities.active_vr_language() ||
+ hmi_capabilities.active_vr_language() ||
msg_params[strings::hmi_display_language_desired].asInt() !=
- hmi_capabilities.active_ui_language()) {
+ hmi_capabilities.active_ui_language()) {
+ LOG4CXX_WARN(logger_,
+ "Wrong language on registering application "
+ << application->name().c_str());
- LOG4CXX_WARN_EXT(
+ LOG4CXX_ERROR(
logger_,
- "Wrong language on registering application " << application->name());
-
- LOG4CXX_ERROR_EXT(
- logger_,
- "vr "
+ "VR language desired code is "
<< msg_params[strings::language_desired].asInt()
- << " - "
+ << " , active VR language code is "
<< hmi_capabilities.active_vr_language()
- << "ui "
+ << ", UI language code is "
<< msg_params[strings::hmi_display_language_desired].asInt()
- << " - "
+ << " , active UI language code is "
<< hmi_capabilities.active_ui_language());
- result = mobile_apis::Result::WRONG_LANGUAGE;
+ result_code = mobile_apis::Result::WRONG_LANGUAGE;
}
if (hmi_capabilities.display_capabilities()) {
response_params[hmi_response::display_capabilities] =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& display_caps =
- response_params[hmi_response::display_capabilities];
+ response_params[hmi_response::display_capabilities];
display_caps[hmi_response::display_type] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::display_type);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::display_type);
display_caps[hmi_response::text_fields] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::text_fields);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::text_fields);
display_caps[hmi_response::image_fields] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::image_fields);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::image_fields);
display_caps[hmi_response::media_clock_formats] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::media_clock_formats);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::media_clock_formats);
display_caps[hmi_response::templates_available] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::templates_available);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::templates_available);
display_caps[hmi_response::screen_params] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::screen_params);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::screen_params);
display_caps[hmi_response::num_custom_presets_available] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::num_custom_presets_available);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::num_custom_presets_available);
- if (hmi_capabilities.display_capabilities()->getElement(
- hmi_response::image_capabilities).length() > 0) {
+ if (hmi_capabilities.display_capabilities()
+ ->getElement(hmi_response::image_capabilities)
+ .length() > 0) {
display_caps[hmi_response::graphic_supported] = true;
} else {
display_caps[hmi_response::graphic_supported] = false;
}
display_caps[hmi_response::templates_available] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::templates_available);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::templates_available);
display_caps[hmi_response::screen_params] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::screen_params);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::screen_params);
display_caps[hmi_response::num_custom_presets_available] =
- hmi_capabilities.display_capabilities()->getElement(
- hmi_response::num_custom_presets_available);
+ hmi_capabilities.display_capabilities()->getElement(
+ hmi_response::num_custom_presets_available);
}
if (hmi_capabilities.button_capabilities()) {
response_params[hmi_response::button_capabilities] =
- *hmi_capabilities.button_capabilities();
+ *hmi_capabilities.button_capabilities();
}
if (hmi_capabilities.soft_button_capabilities()) {
response_params[hmi_response::soft_button_capabilities] =
- *hmi_capabilities.soft_button_capabilities();
+ *hmi_capabilities.soft_button_capabilities();
}
if (hmi_capabilities.preset_bank_capabilities()) {
response_params[hmi_response::preset_bank_capabilities] =
- *hmi_capabilities.preset_bank_capabilities();
+ *hmi_capabilities.preset_bank_capabilities();
}
if (hmi_capabilities.hmi_zone_capabilities()) {
if (smart_objects::SmartType_Array ==
hmi_capabilities.hmi_zone_capabilities()->getType()) {
// hmi_capabilities json contains array and HMI response object
response_params[hmi_response::hmi_zone_capabilities] =
- *hmi_capabilities.hmi_zone_capabilities();
+ *hmi_capabilities.hmi_zone_capabilities();
} else {
response_params[hmi_response::hmi_zone_capabilities][0] =
- *hmi_capabilities.hmi_zone_capabilities();
+ *hmi_capabilities.hmi_zone_capabilities();
}
}
if (hmi_capabilities.speech_capabilities()) {
response_params[strings::speech_capabilities] =
- *hmi_capabilities.speech_capabilities();
+ *hmi_capabilities.speech_capabilities();
}
if (hmi_capabilities.vr_capabilities()) {
response_params[strings::vr_capabilities] =
- *hmi_capabilities.vr_capabilities();
+ *hmi_capabilities.vr_capabilities();
}
if (hmi_capabilities.audio_pass_thru_capabilities()) {
if (smart_objects::SmartType_Array ==
hmi_capabilities.audio_pass_thru_capabilities()->getType()) {
// hmi_capabilities json contains array and HMI response object
response_params[strings::audio_pass_thru_capabilities] =
- *hmi_capabilities.audio_pass_thru_capabilities();
+ *hmi_capabilities.audio_pass_thru_capabilities();
} else {
response_params[strings::audio_pass_thru_capabilities][0] =
- *hmi_capabilities.audio_pass_thru_capabilities();
+ *hmi_capabilities.audio_pass_thru_capabilities();
}
}
if (hmi_capabilities.vehicle_type()) {
response_params[hmi_response::vehicle_type] =
- *hmi_capabilities.vehicle_type();
+ *hmi_capabilities.vehicle_type();
}
if (hmi_capabilities.prerecorded_speech()) {
response_params[strings::prerecorded_speech] =
- *(hmi_capabilities.prerecorded_speech());
+ *(hmi_capabilities.prerecorded_speech());
}
const std::vector<uint32_t>& diag_modes =
- profile::Profile::instance()->supported_diag_modes();
+ profile::Profile::instance()->supported_diag_modes();
if (!diag_modes.empty()) {
std::vector<uint32_t>::const_iterator it = diag_modes.begin();
uint32_t index = 0;
@@ -473,78 +507,185 @@ void RegisterAppInterfaceRequest::SendRegisterAppInterfaceResponseToMobile(
response_params[strings::system_software_version] =
hmi_capabilities.ccpu_version();
- ResumeCtrl& resumer = ApplicationManagerImpl::instance()->resume_controller();
- std::string hash_id = "";
-
- std::string add_info("");
bool resumption = (*message_)[strings::msg_params].keyExists(strings::hash_id);
+
bool need_restore_vr = resumption;
+
+ std::string hash_id;
+ std::string add_info;
+
if (resumption) {
hash_id = (*message_)[strings::msg_params][strings::hash_id].asString();
if (!resumer.CheckApplicationHash(application, hash_id)) {
- LOG4CXX_WARN(logger_, "Hash does not match");
- result = mobile_apis::Result::RESUME_FAILED;
- add_info = "Hash does not match";
+ LOG4CXX_WARN(logger_,
+ "Hash from RAI does not match to saved resume data.");
+ result_code = mobile_apis::Result::RESUME_FAILED;
+ add_info = "Hash from RAI does not match to saved resume data.";
need_restore_vr = false;
} else if (!resumer.CheckPersistenceFilesForResumption(application)) {
- LOG4CXX_WARN(logger_, "Persistent data is missed");
- result = mobile_apis::Result::RESUME_FAILED;
- add_info = "Persistent data is missed";
+ LOG4CXX_WARN(logger_, "Persistent data is missing.");
+ result_code = mobile_apis::Result::RESUME_FAILED;
+ add_info = "Persistent data is missing.";
need_restore_vr = false;
} else {
- add_info = " Resume Succeed";
+ add_info = "Resume succeeded.";
}
}
- if ((mobile_apis::Result::SUCCESS == result) &&
+ if ((mobile_apis::Result::SUCCESS == result_code) &&
(mobile_apis::Result::INVALID_ENUM != result_checking_app_hmi_type_)) {
add_info += response_info_;
- result = result_checking_app_hmi_type_;
+ result_code = result_checking_app_hmi_type_;
}
- // in case application exist in resumption we need to send resumeVrgrammars
+ // In case application exist in resumption we need to send resumeVrgrammars
if (false == resumption) {
- resumption = resumer.IsApplicationSaved(application->mobile_app_id());
+ resumption = resumer.IsApplicationSaved(
+ application->mobile_app_id(),
+ application->mac_address());
}
+ SendOnAppRegisteredNotificationToHMI(
+ *(application.get()), resumption, need_restore_vr);
+ SendResponse(true, result_code, add_info.c_str(), &response_params);
- MessageHelper::SendOnAppRegisteredNotificationToHMI(*(application.get()),
- resumption,
- need_restore_vr);
-
- SendResponse(true, result, add_info.c_str(), &response_params);
-
- // Default HMI level should be set before any permissions validation, since it
- // relies on HMI level.
- resumer.SetupDefaultHMILevel(application);
-
- if (result != mobile_apis::Result::RESUME_FAILED) {
+ if (result_code != mobile_apis::Result::RESUME_FAILED) {
resumer.StartResumption(application, hash_id);
} else {
resumer.StartResumptionOnlyHMILevel(application);
}
// By default app subscribed to CUSTOM_BUTTON
- // Need to send notification to HMI
SendSubscribeCustomButtonNotification();
MessageHelper::SendChangeRegistrationRequestToHMI(application);
}
-mobile_apis::Result::eType
-RegisterAppInterfaceRequest::CheckCoincidence() {
+void RegisterAppInterfaceRequest::SendOnAppRegisteredNotificationToHMI(
+ const Application& application_impl,
+ bool resumption,
+ bool need_restore_vr) {
+ using namespace smart_objects;
+
+ SmartObjectSPtr notification = utils::MakeShared<SmartObject>(SmartType_Map);
+ if (!notification) {
+ LOG4CXX_ERROR(logger_, "Failed to create smart object");
+ return;
+ }
+
+ (*notification)[strings::params] = SmartObject(SmartType_Map);
+ smart_objects::SmartObject& params = (*notification)[strings::params];
+ params[strings::function_id] = static_cast<int32_t>(
+ hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
+ params[strings::message_type] = static_cast<int32_t>(kNotification);
+ params[strings::protocol_version] = commands::CommandImpl::protocol_version_;
+ params[strings::protocol_type] = commands::CommandImpl::hmi_protocol_type_;
+
+ (*notification)[strings::msg_params] = SmartObject(SmartType_Map);
+ smart_objects::SmartObject& msg_params = (*notification)[strings::msg_params];
+ // Due to current requirements in case when we're in resumption mode
+ // we have to always send resumeVRGrammar field.
+ if (resumption) {
+ msg_params[strings::resume_vr_grammars] = need_restore_vr;
+ }
+
+ if (application_impl.vr_synonyms()) {
+ msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms());
+ }
+
+ if (application_impl.tts_name()) {
+ msg_params[strings::tts_name] = *(application_impl.tts_name());
+ }
+
+ std::string priority;
+ policy::PolicyHandler::instance()->GetPriority(
+ application_impl.mobile_app_id(), &priority);
+ if (!priority.empty()) {
+ msg_params[strings::priority] = MessageHelper::GetPriorityCode(priority);
+ }
+
+ msg_params[strings::msg_params] = SmartObject(SmartType_Map);
+ smart_objects::SmartObject& application = msg_params[strings::application];
+ application[strings::app_name] = application_impl.name();
+ application[strings::app_id] = application_impl.app_id();
+ application[hmi_response::policy_app_id] = application_impl.mobile_app_id();
+ application[strings::icon] = application_impl.app_icon_path();
+
+ const smart_objects::SmartObject* ngn_media_screen_name =
+ application_impl.ngn_media_screen_name();
+ if (ngn_media_screen_name) {
+ application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name;
+ }
+
+ application[strings::hmi_display_language_desired] =
+ static_cast<int32_t>(application_impl.ui_language());
+
+ application[strings::is_media_application] =
+ application_impl.is_media_application();
+
+ const smart_objects::SmartObject* app_type = application_impl.app_types();
+ if (app_type) {
+ application[strings::app_type] = *app_type;
+ }
+
+ std::vector<std::string> request_types =
+ policy::PolicyHandler::instance()->GetAppRequestTypes(
+ application_impl.mobile_app_id());
+
+ application[strings::request_type] = SmartObject(SmartType_Array);
+ smart_objects::SmartObject& request_array =
+ application[strings::request_type];
+
+ uint32_t index = 0;
+ std::vector<std::string>::const_iterator it = request_types.begin();
+ for (; request_types.end() != it; ++it) {
+ request_array[index] = *it;
+ ++index;
+ }
+
+ application[strings::device_info] = SmartObject(SmartType_Map);
+ smart_objects::SmartObject& device_info = application[strings::device_info];
+ const protocol_handler::SessionObserver& session_observer =
+ application_manager::ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer();
+ std::string device_name;
+ std::string mac_address;
+ std::string transport_type;
+ const connection_handler::DeviceHandle handle = application_impl.device();
+ if (-1 ==
+ session_observer.GetDataOnDeviceID(
+ handle, &device_name, NULL, &mac_address, &transport_type)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to extract information for device " << handle);
+ }
+
+ device_info[strings::name] = device_name;
+ device_info[strings::id] = mac_address;
+
+ const policy::DeviceConsent device_consent =
+ policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address);
+ device_info[strings::isSDLAllowed] =
+ policy::DeviceConsent::kDeviceAllowed == device_consent;
+
+ device_info[strings::transport_type] =
+ ApplicationManagerImpl::instance()->GetDeviceTransportType(
+ transport_type);
+
+ DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(notification));
+}
+
+mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckCoincidence() {
LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ (*message_)[strings::msg_params];
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetConstIt it =
- accessor.begin();
- const std::string app_name = msg_params[strings::app_name].asString();
+ ApplicationSetConstIt it = accessor.begin();
+ const custom_str::CustomString app_name = msg_params[strings::app_name].asCustomString();
for (; accessor.end() != it; ++it) {
-
// name check
- const std::string& cur_name = (*it)->name();
+ const custom_str::CustomString& cur_name = (*it)->name();
if (!strcasecmp(app_name.c_str(), cur_name.c_str())) {
LOG4CXX_ERROR(logger_, "Application name is known already.");
return mobile_apis::Result::DUPLICATE_NAME;
@@ -580,7 +721,7 @@ RegisterAppInterfaceRequest::CheckCoincidence() {
} // method end
mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
- LOG4CXX_INFO(logger_, "CheckWithPolicyData");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(AOleynik): Check is necessary to allow register application in case
// of disabled policy
// Remove this check, when HMI will support policy
@@ -592,9 +733,10 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
policy::StringArray app_nicknames;
policy::StringArray app_hmi_types;
- std::string mobile_app_id = message[strings::msg_params][strings::app_id].asString();
+ std::string mobile_app_id =
+ message[strings::msg_params][strings::app_id].asString();
const bool init_result = policy::PolicyHandler::instance()->GetInitialAppData(
- mobile_app_id, &app_nicknames, &app_hmi_types);
+ mobile_app_id, &app_nicknames, &app_hmi_types);
if (!init_result) {
LOG4CXX_ERROR(logger_, "Error during initial application data check.");
@@ -603,16 +745,18 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
if (!app_nicknames.empty()) {
IsSameNickname compare(
- message[strings::msg_params][strings::app_name].asString());
- policy::StringArray::const_iterator it = std::find_if(
- app_nicknames.begin(), app_nicknames.end(), compare);
+ message[strings::msg_params][strings::app_name].asCustomString());
+ policy::StringArray::const_iterator it =
+ std::find_if(app_nicknames.begin(), app_nicknames.end(), compare);
if (app_nicknames.end() == it) {
LOG4CXX_WARN(logger_,
"Application name was not found in nicknames list.");
- //App should be unregistered, if its name is not present in nicknames list
+ // App should be unregistered, if its name is not present in nicknames
+ // list
usage_statistics::AppCounter count_of_rejections_nickname_mismatch(
- policy::PolicyHandler::instance()->GetStatisticManager(), mobile_app_id,
- usage_statistics::REJECTIONS_NICKNAME_MISMATCH);
+ policy::PolicyHandler::instance()->GetStatisticManager(),
+ mobile_app_id,
+ usage_statistics::REJECTIONS_NICKNAME_MISMATCH);
++count_of_rejections_nickname_mismatch;
return mobile_apis::Result::DISALLOWED;
}
@@ -626,23 +770,25 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
// If AppHMITypes are partially same, the system should allow those listed
// in the policy table and send warning info on missed values
smart_objects::SmartArray app_types =
- *(message[strings::msg_params][strings::app_hmi_type].asArray());
+ *(message[strings::msg_params][strings::app_hmi_type].asArray());
std::string log;
CheckMissedTypes checker(app_hmi_types, log);
std::for_each(app_types.begin(), app_types.end(), checker);
if (!log.empty()) {
- response_info_ = "Following AppHMITypes are not present in policy "
- "table:" + log;
+ response_info_ =
+ "Following AppHMITypes are not present in policy "
+ "table:" +
+ log;
result_checking_app_hmi_type_ = mobile_apis::Result::WARNINGS;
}
}
// Replace AppHMITypes in request with values allowed by policy table
message[strings::msg_params][strings::app_hmi_type] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& app_hmi_type =
- message[strings::msg_params][strings::app_hmi_type];
+ message[strings::msg_params][strings::app_hmi_type];
AppHMITypeInserter inserter(app_hmi_type);
std::for_each(app_hmi_types.begin(), app_hmi_types.end(), inserter);
@@ -652,7 +798,7 @@ mobile_apis::Result::eType RegisterAppInterfaceRequest::CheckWithPolicyData() {
}
void RegisterAppInterfaceRequest::FillDeviceInfo(
- policy::DeviceInfo* device_info) {
+ policy::DeviceInfo* device_info) {
const std::string hardware = "hardware";
const std::string firmware_rev = "firmwareRev";
const std::string os = "os";
@@ -661,16 +807,18 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
const std::string max_number_rfcom_ports = "maxNumberRFCOMMPorts";
const smart_objects::SmartObject& msg_params =
- (*message_)[strings::msg_params];
+ (*message_)[strings::msg_params];
const smart_objects::SmartObject& device_info_so =
- msg_params[strings::device_info];
+ msg_params[strings::device_info];
if (device_info_so.keyExists(hardware)) {
- device_info->hardware = msg_params[strings::device_info][hardware].asString();
+ device_info->hardware =
+ msg_params[strings::device_info][hardware].asString();
}
if (device_info_so.keyExists(firmware_rev)) {
- device_info->firmware_rev = msg_params[strings::device_info][firmware_rev].asString();
+ device_info->firmware_rev =
+ msg_params[strings::device_info][firmware_rev].asString();
}
if (device_info_so.keyExists(os)) {
device_info->os = device_info_so[os].asString();
@@ -683,26 +831,26 @@ void RegisterAppInterfaceRequest::FillDeviceInfo(
}
if (device_info_so.keyExists(max_number_rfcom_ports)) {
device_info->max_number_rfcom_ports =
- device_info_so[max_number_rfcom_ports].asInt();
+ device_info_so[max_number_rfcom_ports].asInt();
}
}
bool RegisterAppInterfaceRequest::IsApplicationWithSameAppIdRegistered() {
-
- LOG4CXX_INFO(logger_, "RegisterAppInterfaceRequest::"
+ LOG4CXX_INFO(logger_,
+ "RegisterAppInterfaceRequest::"
"IsApplicationWithSameAppIdRegistered");
- const std::string mobile_app_id = (*message_)[strings::msg_params]
- [strings::app_id].asString();
+ const custom_string::CustomString mobile_app_id =
+ (*message_)[strings::msg_params][strings::app_id].asCustomString();
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationManagerImpl::ApplictionSet applications = accessor.applications();
+ const ApplicationSet applications = accessor.applications();
- ApplicationManagerImpl::ApplictionSetConstIt it = applications.begin();
- ApplicationManagerImpl::ApplictionSetConstIt it_end = applications.end();
+ ApplicationSetConstIt it = applications.begin();
+ ApplicationSetConstIt it_end = applications.end();
for (; it != it_end; ++it) {
- if (!strcasecmp(mobile_app_id.c_str(),(*it)->mobile_app_id().c_str())) {
+ if (mobile_app_id.CompareIgnoreCase((*it)->mobile_app_id().c_str())) {
return true;
}
}
@@ -720,7 +868,6 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
return true;
}
-
if ((*message_)[strings::msg_params].keyExists(strings::tts_name)) {
const smart_objects::SmartArray* tn_array =
(*message_)[strings::msg_params][strings::tts_name].asArray();
@@ -737,10 +884,10 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params].
- keyExists(strings::ngn_media_screen_app_name)) {
- str = (*message_)[strings::msg_params]
- [strings::ngn_media_screen_app_name].asCharArray();
+ if ((*message_)[strings::msg_params].keyExists(
+ strings::ngn_media_screen_app_name)) {
+ str = (*message_)[strings::msg_params][strings::ngn_media_screen_app_name]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid ngn_media_screen_app_name syntax check failed");
@@ -773,11 +920,11 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
if ((*message_)[strings::msg_params].keyExists(strings::device_info)) {
-
- if ((*message_)[strings::msg_params][strings::device_info].
- keyExists(strings::hardware)) {
- str = (*message_)[strings::msg_params]
- [strings::device_info][strings::hardware].asCharArray();
+ if ((*message_)[strings::msg_params][strings::device_info].keyExists(
+ strings::hardware)) {
+ str = (*message_)[strings::msg_params][strings::device_info]
+ [strings::hardware]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info hardware syntax check failed");
@@ -785,10 +932,11 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params][strings::device_info].
- keyExists(strings::firmware_rev)) {
- str = (*message_)[strings::msg_params]
- [strings::device_info][strings::firmware_rev].asCharArray();
+ if ((*message_)[strings::msg_params][strings::device_info].keyExists(
+ strings::firmware_rev)) {
+ str = (*message_)[strings::msg_params][strings::device_info]
+ [strings::firmware_rev]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info firmware_rev syntax check failed");
@@ -796,21 +944,21 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params][strings::device_info].
- keyExists(strings::os)) {
- str = (*message_)[strings::msg_params]
- [strings::device_info][strings::os].asCharArray();
+ if ((*message_)[strings::msg_params][strings::device_info].keyExists(
+ strings::os)) {
+ str = (*message_)[strings::msg_params][strings::device_info][strings::os]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid device_info os syntax check failed");
+ LOG4CXX_ERROR(logger_, "Invalid device_info os syntax check failed");
return true;
}
}
- if ((*message_)[strings::msg_params][strings::device_info].
- keyExists(strings::os_version)) {
- str = (*message_)[strings::msg_params]
- [strings::device_info][strings::os_version].asCharArray();
+ if ((*message_)[strings::msg_params][strings::device_info].keyExists(
+ strings::os_version)) {
+ str = (*message_)[strings::msg_params][strings::device_info]
+ [strings::os_version]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info os_version syntax check failed");
@@ -818,17 +966,17 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
}
}
- if ((*message_)[strings::msg_params][strings::device_info].
- keyExists(strings::carrier)) {
- str = (*message_)[strings::msg_params]
- [strings::device_info][strings::carrier].asCharArray();
+ if ((*message_)[strings::msg_params][strings::device_info].keyExists(
+ strings::carrier)) {
+ str = (*message_)[strings::msg_params][strings::device_info]
+ [strings::carrier]
+ .asCharArray();
if (strlen(str) && !CheckSyntax(str)) {
LOG4CXX_ERROR(logger_,
"Invalid device_info carrier syntax check failed");
return true;
}
}
-
}
if ((*message_)[strings::msg_params].keyExists(strings::app_id)) {
@@ -838,6 +986,7 @@ bool RegisterAppInterfaceRequest::IsWhiteSpaceExist() {
return true;
}
}
+
return false;
}
@@ -846,11 +995,11 @@ void RegisterAppInterfaceRequest::CheckResponseVehicleTypeParam(
const std::string& param,
const std::string& backup_value) {
using namespace hmi_response;
- if (!vehicle_type.keyExists(param) ||
- vehicle_type[param].empty()) {
+ if (!vehicle_type.keyExists(param) || vehicle_type[param].empty()) {
if (!backup_value.empty()) {
- LOG4CXX_DEBUG(logger_, param << " is missing."
- "Will be replaced with policy table value.");
+ LOG4CXX_DEBUG(logger_,
+ param << " is missing."
+ "Will be replaced with policy table value.");
vehicle_type[param] = backup_value;
} else {
vehicle_type.erase(param);
@@ -866,8 +1015,7 @@ void RegisterAppInterfaceRequest::SendSubscribeCustomButtonNotification() {
msg_params[strings::app_id] = connection_key();
msg_params[strings::name] = Common_ButtonName::CUSTOM_BUTTON;
msg_params[strings::is_suscribed] = true;
- CreateHMINotification(FunctionID::Buttons_OnButtonSubscription,
- msg_params);
+ CreateHMINotification(FunctionID::Buttons_OnButtonSubscription, msg_params);
}
} // namespace commands
diff --git a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc
index b318795859..65b6ff071a 100644
--- a/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc
+++ b/src/components/application_manager/src/commands/mobile/register_app_interface_response.cc
@@ -44,7 +44,7 @@ namespace commands {
void RegisterAppInterfaceResponse::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+ mobile_apis::Result::eType result_code = mobile_apis::Result::SUCCESS;
bool success = (*message_)[strings::msg_params][strings::success].asBool();
bool last_message = !success;
// Do not close connection in case of APPLICATION_NOT_REGISTERED despite it is an error
@@ -58,17 +58,29 @@ void RegisterAppInterfaceResponse::Run() {
SendResponse(success, result_code, last_message);
+ if (mobile_apis::Result::SUCCESS != result_code) { return; }
+
// Add registered application to the policy db right after response sent to
// mobile to be able to check all other API according to app permissions
- application_manager::ApplicationConstSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->
- application(connection_key());
- if (app.valid()) {
- policy::PolicyHandler *policy_handler = policy::PolicyHandler::instance();
- std::string mobile_app_id = app->mobile_app_id();
- policy_handler->AddApplication(mobile_app_id);
- SetHeartBeatTimeout(connection_key(), mobile_app_id);
+ application_manager::ApplicationSharedPtr application =
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "Application with connection key "
+ << connection_key() << " is not registered.");
+ return;
}
+
+ SetHeartBeatTimeout(connection_key(), application->mobile_app_id());
+
+ // Default HMI level should be set before any permissions validation, since it
+ // relies on HMI level.
+ ApplicationManagerImpl::instance()->OnApplicationRegistered(application);
+
+ // Sends OnPermissionChange notification to mobile right after RAI response
+ // and HMI level set-up
+ policy::PolicyHandler::instance()->OnAppRegisteredOnMobile(
+ application->mobile_app_id());
}
void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
@@ -76,11 +88,10 @@ void RegisterAppInterfaceResponse::SetHeartBeatTimeout(
LOG4CXX_AUTO_TRACE(logger_);
policy::PolicyHandler *policy_handler = policy::PolicyHandler::instance();
if (policy_handler->PolicyEnabled()) {
- const int32_t timeout = policy_handler->HeartBeatTimeout(mobile_app_id) /
- date_time::DateTime::MILLISECONDS_IN_SECOND;
+ const uint32_t timeout = policy_handler->HeartBeatTimeout(mobile_app_id);
if (timeout > 0) {
application_manager::ApplicationManagerImpl::instance()->
- connection_handler()->SetHeartBeatTimeout(connection_key, timeout);
+ connection_handler().SetHeartBeatTimeout(connection_key, timeout);
}
} else {
LOG4CXX_INFO(logger_, "Policy is turn off");
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 2e1483eff6..4118114822 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
@@ -64,7 +64,7 @@ void ResetGlobalPropertiesRequest::Run() {
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "No application associated with session key");
+ LOG4CXX_ERROR(logger_, "No application associated with session key");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -185,7 +185,7 @@ void ResetGlobalPropertiesRequest::Run() {
bool ResetGlobalPropertiesRequest::ResetHelpPromt(
application_manager::ApplicationSharedPtr app) {
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "Null pointer");
+ LOG4CXX_ERROR(logger_, "Null pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -198,7 +198,7 @@ bool ResetGlobalPropertiesRequest::ResetHelpPromt(
bool ResetGlobalPropertiesRequest::ResetTimeoutPromt(
application_manager::ApplicationSharedPtr const app) {
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "Null pointer");
+ LOG4CXX_ERROR(logger_, "Null pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -225,7 +225,7 @@ bool ResetGlobalPropertiesRequest::ResetTimeoutPromt(
bool ResetGlobalPropertiesRequest::ResetVrHelpTitleItems(
application_manager::ApplicationSharedPtr const app) {
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "Null pointer");
+ LOG4CXX_ERROR(logger_, "Null pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return false;
}
@@ -292,7 +292,7 @@ void ResetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
return_info, &(message[strings::msg_params]));
if (!application) {
- LOG4CXX_DEBUG(logger_, "NULL pointer");
+ LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
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 10f080e0e7..1859261e33 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
@@ -38,6 +38,7 @@
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -70,8 +71,9 @@ bool ScrollableMessageRequest::Init() {
void ScrollableMessageRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
- ->application((*message_)[strings::params][strings::connection_key].asUInt());
+ ApplicationSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()
+ ->application(connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "Application is not registered");
@@ -90,8 +92,6 @@ void ScrollableMessageRequest::Run() {
return;
}
-
-
smart_objects::SmartObject msg_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
@@ -114,6 +114,7 @@ void ScrollableMessageRequest::Run() {
void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -130,15 +131,21 @@ void ScrollableMessageRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code =
static_cast<mobile_apis::Result::eType>
(message[strings::params][hmi_response::code].asInt());
+
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
- bool result = false;
- if (mobile_apis::Result::SUCCESS == result_code) {
- result = true;
- } else if ((mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) &&
+
+ bool result =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
+
+ if (mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code &&
hmi_capabilities.is_ui_cooperating()) {
result = true;
}
+
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
break;
}
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 b1c96ebb98..4a30b7c50c 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
@@ -53,7 +53,7 @@ void SendLocationRequest::Run() {
->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_,
+ LOG4CXX_ERROR(logger_,
"An application with connection key " << connection_key()
<< " is not registered.");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
@@ -109,7 +109,7 @@ void SendLocationRequest::Run() {
}
void SendLocationRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SendLocationRquest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::Navigation_SendLocation: {
@@ -132,7 +132,7 @@ void SendLocationRequest::on_event(const event_engine::Event& event) {
}
bool SendLocationRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "SendLocationRquest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str;
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
@@ -202,7 +202,7 @@ bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFi
ApplicationManagerImpl* instance = ApplicationManagerImpl::instance();
const HMICapabilities& hmi_capabilities = instance->hmi_capabilities();
if (!hmi_capabilities.is_ui_cooperating()) {
- LOG4CXX_ERROR_EXT(logger_, "UI is not supported.");
+ LOG4CXX_ERROR(logger_, "UI is not supported.");
return false;
}
@@ -223,7 +223,7 @@ bool SendLocationRequest::CheckHMICapabilities(std::list<hmi_apis::Common_TextFi
}
if (!fields_names.empty()) {
- LOG4CXX_ERROR_EXT(logger_, "Some fields are not supported by capabilities");
+ LOG4CXX_ERROR(logger_, "Some fields are not supported by capabilities");
return false;
}
return true;
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 bd9c9fa0cb..5c9a4f80e7 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
@@ -38,6 +38,7 @@
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "utils/file_system.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -49,14 +50,12 @@ SetAppIconRequest::SetAppIconRequest(const MessageSharedPtr& message)
: CommandRequestImpl(message) {
if (-1 == is_icons_saving_enabled_) {
const std::string path = profile::Profile::instance()->app_icons_folder();
- is_icons_saving_enabled_ =
- file_system::IsWritingAllowed(path) &&
- file_system::IsReadingAllowed(path);
+ is_icons_saving_enabled_ = file_system::IsWritingAllowed(path) &&
+ file_system::IsReadingAllowed(path);
}
}
-SetAppIconRequest::~SetAppIconRequest() {
-}
+SetAppIconRequest::~SetAppIconRequest() {}
void SetAppIconRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -89,22 +88,22 @@ void SetAppIconRequest::Run() {
CopyToIconStorage(full_file_path);
}
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app->app_id();
- msg_params[strings::sync_file_name] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ msg_params[strings::sync_file_name] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
-// Panasonic requres unchanged path value without encoded special characters
- const std::string full_file_path_for_hmi = file_system::ConvertPathForURL(
- full_file_path);
+ // Panasonic requres unchanged path value without encoded special characters
+ const std::string full_file_path_for_hmi =
+ file_system::ConvertPathForURL(full_file_path);
msg_params[strings::sync_file_name][strings::value] = full_file_path_for_hmi;
// TODO(VS): research why is image_type hardcoded
msg_params[strings::sync_file_name][strings::image_type] =
- static_cast<int32_t> (SetAppIconRequest::ImageType::DYNAMIC);
+ static_cast<int32_t>(SetAppIconRequest::ImageType::DYNAMIC);
// for further use in on_event function
(*message_)[strings::msg_params][strings::sync_file_name] =
@@ -114,7 +113,7 @@ void SetAppIconRequest::Run() {
}
void SetAppIconRequest::CopyToIconStorage(
- const std::string& path_to_file) const {
+ const std::string& path_to_file) const {
if (!profile::Profile::instance()->enable_protocol_4()) {
LOG4CXX_WARN(logger_,
"Icon copying skipped, since protocol ver. 4 is not enabled.");
@@ -122,27 +121,29 @@ void SetAppIconRequest::CopyToIconStorage(
}
std::vector<uint8_t> file_content;
- if(!file_system::ReadBinaryFile(path_to_file, file_content)) {
+ if (!file_system::ReadBinaryFile(path_to_file, file_content)) {
LOG4CXX_ERROR(logger_, "Can't read icon file: " << path_to_file);
return;
}
const std::string icon_storage =
- profile::Profile::instance()->app_icons_folder();
- const uint64_t storage_max_size =
- static_cast<uint64_t>(
- profile::Profile::instance()->app_icons_folder_max_size());
+ profile::Profile::instance()->app_icons_folder();
+ const uint64_t storage_max_size = static_cast<uint64_t>(
+ profile::Profile::instance()->app_icons_folder_max_size());
const uint64_t file_size = file_system::FileSize(path_to_file);
if (storage_max_size < file_size) {
- LOG4CXX_ERROR(logger_, "Icon size (" << file_size << ") is bigger, than "
- " icons storage maximum size (" << storage_max_size << ")."
- "Copying skipped.");
+ LOG4CXX_ERROR(logger_,
+ "Icon size (" << file_size << ") is bigger, than "
+ " icons storage maximum size ("
+ << storage_max_size
+ << ")."
+ "Copying skipped.");
return;
}
- const uint64_t storage_size = static_cast<uint64_t>(
- file_system::DirectorySize(icon_storage));
+ const uint64_t storage_size =
+ static_cast<uint64_t>(file_system::DirectorySize(icon_storage));
if (storage_max_size < (file_size + storage_size)) {
const uint32_t icons_amount =
profile::Profile::instance()->app_icons_amount_to_remove();
@@ -159,17 +160,17 @@ void SetAppIconRequest::CopyToIconStorage(
}
}
ApplicationConstSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()->
- application(connection_key());
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
if (!app) {
- LOG4CXX_ERROR(logger_, "Can't get application for connection key: "
- << connection_key());
+ LOG4CXX_ERROR(
+ logger_,
+ "Can't get application for connection key: " << connection_key());
return;
}
- const std::string icon_path =
- icon_storage + "/" + app->mobile_app_id();
+ const std::string icon_path = icon_storage + "/" + app->mobile_app_id();
if (!file_system::CreateFile(icon_path)) {
LOG4CXX_ERROR(logger_, "Can't create icon: " << icon_path);
return;
@@ -180,8 +181,9 @@ void SetAppIconRequest::CopyToIconStorage(
return;
}
- LOG4CXX_DEBUG(logger_, "Icon was successfully copied from :" << path_to_file
- << " to " << icon_path);
+ LOG4CXX_DEBUG(logger_,
+ "Icon was successfully copied from :" << path_to_file << " to "
+ << icon_path);
return;
}
@@ -191,7 +193,7 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage,
const std::vector<std::string> icons_list = file_system::ListFiles(storage);
std::map<uint64_t, std::string> icon_modification_time;
std::vector<std::string>::const_iterator it = icons_list.begin();
- for (;it != icons_list.end(); ++it) {
+ for (; it != icons_list.end(); ++it) {
const std::string file_name = *it;
const std::string file_path = storage + "/" + file_name;
if (!file_system::FileExists(file_path)) {
@@ -212,53 +214,57 @@ void SetAppIconRequest::RemoveOldestIcons(const std::string& storage,
LOG4CXX_DEBUG(logger_, "Error while deleting icon " << file_path);
}
icon_modification_time.erase(icon_modification_time.begin());
- LOG4CXX_DEBUG(logger_, "Old icon " << file_path
- << " was deleted successfully.");
+ LOG4CXX_DEBUG(logger_,
+ "Old icon " << file_path << " was deleted successfully.");
}
}
bool SetAppIconRequest::IsEnoughSpaceForIcon(const uint64_t icon_size) const {
const std::string icon_storage =
- profile::Profile::instance()->app_icons_folder();
- const uint64_t storage_max_size =
- static_cast<uint64_t>(
- profile::Profile::instance()->app_icons_folder_max_size());
- const uint64_t storage_size = static_cast<uint64_t>(
- file_system::DirectorySize(icon_storage));
+ profile::Profile::instance()->app_icons_folder();
+ const uint64_t storage_max_size = static_cast<uint64_t>(
+ profile::Profile::instance()->app_icons_folder_max_size());
+ const uint64_t storage_size =
+ static_cast<uint64_t>(file_system::DirectorySize(icon_storage));
return storage_max_size >= (icon_size + storage_size);
}
void SetAppIconRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& event_message = event.smart_object();
+ using namespace helpers;
+ const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetAppIcon: {
mobile_apis::Result::eType result_code =
static_cast<mobile_apis::Result::eType>(
- event_message[strings::params][hmi_response::code].asInt());
+ message[strings::params][hmi_response::code].asInt());
- bool result = mobile_apis::Result::SUCCESS == result_code;
+ const bool result = Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
if (result) {
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
if (!message_.valid() || !app.valid()) {
- LOG4CXX_ERROR(logger_, "NULL pointer.");
- return;
+ LOG4CXX_ERROR(logger_, "NULL pointer.");
+ return;
}
- const std::string path = (*message_)[strings::msg_params]
- [strings::sync_file_name]
- [strings::value].asString();
+ const std::string& path =
+ (*message_)[strings::msg_params][strings::sync_file_name]
+ [strings::value]
+ .asString();
app->set_app_icon_path(path);
LOG4CXX_INFO(logger_,
"Icon path was set to '" << app->app_icon_path() << "'");
}
- SendResponse(result, result_code, NULL, &(event_message[strings::msg_params]));
+ SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
break;
}
default: {
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 1c0948d07e..ef4e18eef3 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
@@ -1,6 +1,5 @@
/*
-
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2015, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,10 +34,10 @@
#include <algorithm>
#include "application_manager/commands/mobile/set_global_properties_request.h"
#include "application_manager/application_manager_impl.h"
-#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -64,13 +63,12 @@ void SetGlobalPropertiesRequest::Run() {
const smart_objects::SmartObject& msg_params =
(*message_)[strings::msg_params];
- uint32_t app_id =
- (*message_)[strings::params][strings::connection_key].asUInt();
-
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(app_id);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "No application associated with session key");
+ LOG4CXX_ERROR(logger_, "No application associated with connection key "
+ << connection_key());
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -88,9 +86,8 @@ void SetGlobalPropertiesRequest::Run() {
verification_result = MessageHelper::VerifyImage(
(*message_)[strings::msg_params][strings::menu_icon], app);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "MessageHelper::VerifyImage return " << verification_result);
+ LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return "
+ << verification_result);
SendResponse(false, verification_result);
return;
}
@@ -99,163 +96,83 @@ void SetGlobalPropertiesRequest::Run() {
if ((*message_)[strings::msg_params].keyExists(strings::vr_help)) {
if (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImageVrHelpItems(
(*message_)[strings::msg_params][strings::vr_help], app)) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "MessageHelper::VerifyImage return INVALID_DATA!" );
+ LOG4CXX_ERROR(logger_, "MessageHelper::VerifyImage return INVALID_DATA!");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
if (IsWhiteSpaceExist()) {
+ LOG4CXX_ERROR(logger_, "White spaces found");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
//if application waits for sending ttsGlobalProperties need to remove this
//application from tts_global_properties_app_list_
- LOG4CXX_INFO(logger_, "RemoveAppFromTTSGlobalPropertiesList");
ApplicationManagerImpl::instance()->RemoveAppFromTTSGlobalPropertiesList(
- app_id);
+ connection_key());
bool is_help_prompt_present = msg_params.keyExists(strings::help_prompt);
bool is_timeout_prompt_present = msg_params.keyExists(
strings::timeout_prompt);
bool is_vr_help_title_present = msg_params.keyExists(strings::vr_help_title);
bool is_vr_help_present = msg_params.keyExists(strings::vr_help);
- bool is_menu_title_present = msg_params.keyExists(hmi_request::menu_title);
- bool is_menu_icon_present = msg_params.keyExists(hmi_request::menu_icon);
- bool is_keyboard_props_present =
- msg_params.keyExists(hmi_request::keyboard_properties);
- // Media-only applications support API v2.1 with less parameters
- // Code deleted according to APPLINK-6119 APPLINK-6133
- // Not sure that it is right
-
-// if (!app->allowed_support_navigation() &&
-// (is_keyboard_props_present ||
-// is_menu_icon_present ||
-// is_menu_title_present)
-// ) {
-// const std::string app_type =
-// app->is_media_application() ? "media" : "non-media";
-
-// const std::string message =
-// "There are too many parameters for "+app_type+" application.";
-// SendResponse(false,
-// mobile_apis::Result::INVALID_DATA,
-// message.c_str());
-// return;
-// }
-
- if ((is_vr_help_title_present && is_vr_help_present) ||
- (!is_vr_help_title_present && !is_vr_help_present)) {
- is_ui_send_ = true;
- }
-
- if (is_help_prompt_present || is_timeout_prompt_present) {
- is_tts_send_ = true;
+ // check VR params
+ if (is_vr_help_title_present ^ is_vr_help_present) {
+ LOG4CXX_ERROR(logger_, "Reject because of vr_help or vr_help_title only provided");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
}
-
if (is_vr_help_title_present && is_vr_help_present) {
- // check vrhelpitem position index
- if (!CheckVrHelpItemsOrder()) {
- LOG4CXX_ERROR(logger_, "Request rejected");
+ LOG4CXX_DEBUG(logger_, "VRHelp params presents");
+
+ if (!CheckVrHelpItemsOrder(msg_params[strings::vr_help])) {
+ LOG4CXX_ERROR(logger_,
+ "VR Help Items contains nonsequential positions" <<
+ " (e.g. [1,2,4]) or not started from 1");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
- app->set_vr_help_title(
- msg_params.getElement(strings::vr_help_title));
- app->set_vr_help(
- msg_params.getElement(strings::vr_help));
-
smart_objects::SmartObject params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
- params[strings::vr_help_title] = (*app->vr_help_title());
- params[strings::vr_help] = (*app->vr_help());
- params[strings::app_id] = app->app_id();
- if (is_menu_title_present) {
-
- params[hmi_request::menu_title] =
- msg_params[hmi_request::menu_title].asString();
- app->set_menu_title(msg_params[hmi_request::menu_title]);
- }
- if (is_menu_icon_present) {
+ PrepareUIRequestVRHelpData(app, msg_params, params);
+ PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
- params[hmi_request::menu_icon] =
- msg_params[hmi_request::menu_icon];
- app->set_menu_icon(msg_params[hmi_request::menu_icon]);
- }
- if (is_keyboard_props_present) {
+ params[strings::app_id] = app->app_id();
+ SendUIRequest(params, true);
+ } else {
+ LOG4CXX_DEBUG(logger_, "VRHelp params does not present");
+ DCHECK_OR_RETURN_VOID(!is_vr_help_title_present && !is_vr_help_present);
- params[hmi_request::keyboard_properties] =
- msg_params[hmi_request::keyboard_properties];
- app->set_keyboard_props(msg_params[hmi_request::keyboard_properties]);
- }
+ smart_objects::SmartObject params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
- SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties,
- &params, true);
- } else if (!is_vr_help_title_present && !is_vr_help_present) {
- const DataAccessor<CommandsMap> accessor = app->commands_map();
- const CommandsMap& cmdMap = accessor.GetData();
- CommandsMap::const_iterator command_it = cmdMap.begin();
-
- int32_t index = 0;
- smart_objects::SmartObject vr_help_items;
- for (; cmdMap.end() != command_it; ++command_it) {
- if (false == (*command_it->second).keyExists(strings::vr_commands)) {
- LOG4CXX_ERROR(logger_, "VR synonyms are empty");
+ if (ValidateVRHelpTitle(app->vr_help_title())) {
+ LOG4CXX_DEBUG(logger_, "App already contains VRHelp data");
+ } else {
+ if (!PrepareUIRequestDefaultVRHelpData(app, params)) {
+ LOG4CXX_ERROR(logger_, "default VRHElp data could not be generated");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
- // use only first
- vr_help_items[index][strings::position] = (index + 1);
- vr_help_items[index++][strings::text] =
- (*command_it->second)[strings::vr_commands][0];
}
+ PrepareUIRequestMenuAndKeyboardData(app, msg_params, params);
- app->set_vr_help_title(smart_objects::SmartObject(app->name()));
-
- smart_objects::SmartObject params =
- smart_objects::SmartObject(smart_objects::SmartType_Map);
-
- params[strings::vr_help_title] = (*app->vr_help_title());
- if (vr_help_items.length() > 0) {
- app->set_vr_help(vr_help_items);
- params[strings::vr_help] = (*app->vr_help());
- }
- params[strings::app_id] = app->app_id();
- if (is_menu_title_present) {
-
- params[hmi_request::menu_title] =
- msg_params[hmi_request::menu_title].asString();
- app->set_menu_title(msg_params[hmi_request::menu_title]);
- }
- if (is_menu_icon_present) {
-
- params[hmi_request::menu_icon] =
- msg_params[hmi_request::menu_icon];
- app->set_menu_icon(msg_params[hmi_request::menu_icon]);
- }
- if (is_keyboard_props_present) {
-
- params[hmi_request::keyboard_properties] =
- msg_params[hmi_request::keyboard_properties];
- app->set_keyboard_props(msg_params[hmi_request::keyboard_properties]);
+ // Preparing data
+ if (params.empty()) {
+ LOG4CXX_DEBUG(logger_, "No UI info provided");
+ } else {
+ params[strings::app_id] = app->app_id();
+ SendUIRequest(params, true);
}
-
- SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties,
- &params, true);
- } else {
- LOG4CXX_ERROR(logger_, "Request rejected");
- SendResponse(false, mobile_apis::Result::REJECTED);
- return;
}
-
// check TTS params
if (is_help_prompt_present || is_timeout_prompt_present) {
+ LOG4CXX_DEBUG(logger_, "TTS params presents");
smart_objects::SmartObject params =
smart_objects::SmartObject(smart_objects::SmartType_Map);
@@ -272,44 +189,34 @@ void SetGlobalPropertiesRequest::Run() {
}
params[strings::app_id] = app->app_id();
-
- SendHMIRequest(hmi_apis::FunctionID::TTS_SetGlobalProperties,
- &params, true);
+ SendTTSRequest(params, true);
}
}
-bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder() {
- const smart_objects::SmartObject vr_help = (*message_)[strings::msg_params]
- .getElement(strings::vr_help);
-
- // vr help item start position must be 1
- const uint32_t vr_help_item_start_position = 1;
-
- if (vr_help_item_start_position !=
- vr_help.getElement(0).getElement(strings::position).asUInt()) {
- LOG4CXX_ERROR(logger_, "VR help items start position is wrong");
- return false;
- }
-
- // Check if VR Help Items contains sequential positionss
- size_t i = 0;
- for (size_t j = 1; j < vr_help.length(); ++i, ++j) {
- if ((vr_help.getElement(i).getElement(strings::position).asInt() + 1)
- != vr_help.getElement(j).getElement(strings::position).asInt()) {
- LOG4CXX_ERROR(logger_, "VR help items order is wrong");
+bool SetGlobalPropertiesRequest::CheckVrHelpItemsOrder(
+ const smart_objects::SmartObject& vr_help) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(vr_help.getType() == smart_objects::SmartType_Array, false);
+ const size_t vr_help_length = vr_help.length();
+ DCHECK_OR_RETURN(vr_help_length > 0, false);
+
+ for (size_t j = 0; j < vr_help_length; ++j) {
+ const size_t position = vr_help.getElement(j).getElement(strings::position).asUInt();
+ // Elements shall start from 1 and increment one by one
+ if (position != (j + 1)) {
+ LOG4CXX_ERROR(logger_, "VR help items order is wrong" <<
+ " at " << j << ", position value:" << position);
return false;
}
}
-
return true;
}
void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(CommandRequestImpl::connection_key());
-
switch (event.id()) {
case hmi_apis::FunctionID::UI_SetGlobalProperties: {
LOG4CXX_INFO(logger_, "Received UI_SetGlobalProperties event");
@@ -331,59 +238,188 @@ void SetGlobalPropertiesRequest::on_event(const event_engine::Event& event) {
}
}
- if (!IsPendingResponseExist()) {
- bool result = ((hmi_apis::Common_Result::SUCCESS == ui_result_)
- && (hmi_apis::Common_Result::SUCCESS == tts_result_ ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_))
- || ((hmi_apis::Common_Result::SUCCESS == ui_result_ ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_)
- && (hmi_apis::Common_Result::INVALID_ENUM == tts_result_))
- || ((hmi_apis::Common_Result::INVALID_ENUM == ui_result_ ||
- hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == ui_result_)
- && (hmi_apis::Common_Result::SUCCESS == tts_result_));
-
- mobile_apis::Result::eType result_code;
- const char* return_info = NULL;
-
- if (result) {
- if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_) {
- result_code = mobile_apis::Result::WARNINGS;
- return_info =
- std::string("Unsupported phoneme type sent in a prompt").c_str();
- } else {
- result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, tts_result_));
- }
- } else {
- result_code = static_cast<mobile_apis::Result::eType>(
- std::max(ui_result_, tts_result_));
- }
+ if (IsPendingResponseExist()) {
+ LOG4CXX_DEBUG(logger_, "Continue waiting for response");
+ return;
+ }
- // TODO(AOleynik): APPLINK-15858
- ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ const bool is_tts_succeeded =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ tts_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_ui_succeeded =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE,
+ hmi_apis::Common_Result::WARNINGS);
+
+ const bool is_ui_invalid_unsupported =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ ui_result_,
+ hmi_apis::Common_Result::INVALID_ENUM,
+ hmi_apis::Common_Result::UNSUPPORTED_RESOURCE);
+
+ bool result =
+ (is_tts_succeeded && is_ui_succeeded) ||
+ (is_ui_succeeded &&
+ hmi_apis::Common_Result::INVALID_ENUM == tts_result_) ||
+ (is_ui_invalid_unsupported && is_tts_succeeded);
+
+ mobile_apis::Result::eType result_code = mobile_apis::Result::INVALID_ENUM;
+ const char* return_info = NULL;
+
+ const bool is_ui_or_tts_warning =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_apis::Common_Result::WARNINGS,
+ tts_result_,
+ ui_result_);
+
+ if (result &&
+ (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE == tts_result_ ||
+ is_ui_or_tts_warning)) {
+ result_code = mobile_apis::Result::WARNINGS;
+ return_info =
+ std::string("Unsupported phoneme type sent in a prompt").c_str();
+ } else {
+ result_code = MessageHelper::HMIToMobileResult(
+ std::max(ui_result_, tts_result_));
+ }
- SendResponse(result, result_code, return_info,
- &(message[strings::msg_params]));
+ //TODO{ALeshin} APPLINK-15858. connection_key removed during SendResponse
+ const uint32_t stashedConnectionKey = connection_key();
- if (!application) {
- LOG4CXX_DEBUG(logger_, "NULL pointer.");
- return;
- }
+ SendResponse(result, result_code, return_info,
+ &(message[strings::msg_params]));
+
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(stashedConnectionKey);
+
+ if (!application) {
+ LOG4CXX_DEBUG(logger_, "NULL pointer.");
+ return;
+ }
+
+ if (result) {
+ application->UpdateHash();
+ }
+}
+
+bool SetGlobalPropertiesRequest::ValidateVRHelpTitle(
+ const smart_objects::SmartObject* const vr_help_so_ptr) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (vr_help_so_ptr) {
+ const std::string& vr_help = vr_help_so_ptr->asString();
+ LOG4CXX_TRACE(logger_, "App contains vr_help_title: \"" << vr_help << '"');
+ return !vr_help.empty();
+ }
+ return false;
+}
- if (result) {
- application->UpdateHash();
+void SetGlobalPropertiesRequest::PrepareUIRequestVRHelpData(
+ const ApplicationSharedPtr app, const smart_objects::SmartObject &msg_params,
+ smart_objects::SmartObject &out_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(app);
+
+ app->set_vr_help_title(
+ msg_params.getElement(strings::vr_help_title));
+ app->set_vr_help(
+ msg_params.getElement(strings::vr_help));
+
+ out_params[strings::vr_help_title] = (*app->vr_help_title());
+ out_params[strings::vr_help] = (*app->vr_help());
+}
+
+bool SetGlobalPropertiesRequest::PrepareUIRequestDefaultVRHelpData(
+ const ApplicationSharedPtr app,
+ smart_objects::SmartObject &out_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(app, false);
+
+ LOG4CXX_DEBUG(logger_, "Generate default VRHelp data");
+ const DataAccessor<CommandsMap> accessor = app->commands_map();
+ const CommandsMap& cmdMap = accessor.GetData();
+
+ int32_t index = 0;
+ smart_objects::SmartObject vr_help_items;
+ for (CommandsMap::const_iterator command_it = cmdMap.begin();
+ cmdMap.end() != command_it; ++command_it) {
+ const smart_objects::SmartObject& command = *command_it->second;
+ if (!command.keyExists(strings::vr_commands)) {
+ LOG4CXX_ERROR(logger_, "VR synonyms are empty");
+ return false;
}
+ // use only first
+ vr_help_items[index][strings::position] = (index + 1);
+ vr_help_items[index++][strings::text] =
+ (*command_it->second)[strings::vr_commands][0];
+ }
+
+ app->set_vr_help_title(smart_objects::SmartObject(app->name()));
+
+ out_params[strings::vr_help_title] = (*app->vr_help_title());
+ if (vr_help_items.length() > 0) {
+ app->set_vr_help(vr_help_items);
+ out_params[strings::vr_help] = (*app->vr_help());
}
+ return true;
}
-bool SetGlobalPropertiesRequest::IsPendingResponseExist() {
+void SetGlobalPropertiesRequest::PrepareUIRequestMenuAndKeyboardData(
+ const ApplicationSharedPtr app, const smart_objects::SmartObject &msg_params,
+ smart_objects::SmartObject &out_params) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(app);
+
+ const bool is_menu_title_present = msg_params.keyExists(hmi_request::menu_title);
+ const bool is_menu_icon_present = msg_params.keyExists(hmi_request::menu_icon);
+ const bool is_keyboard_props_present =
+ msg_params.keyExists(hmi_request::keyboard_properties);
+
+ if (is_menu_title_present) {
+ out_params[hmi_request::menu_title] =
+ msg_params[hmi_request::menu_title].asString();
+ app->set_menu_title(msg_params[hmi_request::menu_title]);
+ }
+ if (is_menu_icon_present) {
+ out_params[hmi_request::menu_icon] =
+ msg_params[hmi_request::menu_icon];
+ app->set_menu_icon(msg_params[hmi_request::menu_icon]);
+ }
+ if (is_keyboard_props_present) {
+ out_params[hmi_request::keyboard_properties] =
+ msg_params[hmi_request::keyboard_properties];
+ app->set_keyboard_props(msg_params[hmi_request::keyboard_properties]);
+ }
+}
+
+void SetGlobalPropertiesRequest::SendTTSRequest(
+ const smart_objects::SmartObject &params, bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendHMIRequest(hmi_apis::FunctionID::TTS_SetGlobalProperties,
+ &params, use_events);
+ is_tts_send_ = true;
+}
+void SetGlobalPropertiesRequest::SendUIRequest(
+ const smart_objects::SmartObject &params, bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SendHMIRequest(hmi_apis::FunctionID::UI_SetGlobalProperties,
+ &params, use_events);
+ is_ui_send_ = true;
+}
+
+bool SetGlobalPropertiesRequest::IsPendingResponseExist() {
return is_ui_send_ != is_ui_received_ || is_tts_send_ != is_tts_received_;
}
bool SetGlobalPropertiesRequest::ValidateConditionalMandatoryParameters(
const smart_objects::SmartObject& params) {
+ LOG4CXX_AUTO_TRACE(logger_);
return params.keyExists(strings::help_prompt)
|| params.keyExists(strings::timeout_prompt)
|| params.keyExists(strings::vr_help_title)
@@ -453,9 +489,8 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
"Invalid vr_help image value syntax check failed");
return true;
}
- }
-
- }
+ } // if image exists
+ } // for - vh_array iteration
}
if (msg_params.keyExists(strings::menu_icon)) {
@@ -486,7 +521,6 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
if (msg_params.keyExists(strings::keyboard_properties)) {
if (msg_params[strings::keyboard_properties].
keyExists(strings::limited_character_list)) {
-
const smart_objects::SmartArray* lcl_array =
msg_params[strings::keyboard_properties]
[strings::limited_character_list].asArray();
@@ -506,7 +540,6 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
if (msg_params[strings::keyboard_properties].
keyExists(strings::auto_complete_text)) {
-
str = msg_params[strings::keyboard_properties]
[strings::auto_complete_text].asCharArray();
@@ -516,11 +549,9 @@ bool SetGlobalPropertiesRequest::IsWhiteSpaceExist() {
return true;
}
}
-
}
return false;
}
} // namespace commands
-
} // namespace application_manager
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 4b06730752..c9875475d7 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
@@ -51,7 +51,7 @@ SetIconRequest::~SetIconRequest() {
}
void SetIconRequest::Run() {
- LOG4CXX_INFO(logger_, "SetIconRequest::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
ApplicationManagerImpl::instance()->application(connection_key());
@@ -102,7 +102,7 @@ void SetIconRequest::Run() {
}
void SetIconRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "SetIconRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
diff --git a/src/components/application_manager/src/commands/mobile/set_icon_response.cc b/src/components/application_manager/src/commands/mobile/set_icon_response.cc
index f1580823d1..632677a4fc 100644
--- a/src/components/application_manager/src/commands/mobile/set_icon_response.cc
+++ b/src/components/application_manager/src/commands/mobile/set_icon_response.cc
@@ -46,7 +46,7 @@ SetIconResponse::~SetIconResponse() {
}
void SetIconResponse::Run() {
- LOG4CXX_INFO(logger_, "SetIconResponse::Run");
+ LOG4CXX_AUTO_TRACE(logger_);
ApplicationManagerImpl::instance()->SendMessageToMobile(message_);
}
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 1e861d14ce..9a73da49e6 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
@@ -31,7 +31,7 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include <string.h>
+#include <cstring>
#include "application_manager/commands/mobile/show_constant_tbt_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
@@ -181,6 +181,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");
+ std::string return_info;
mobile_apis::Result::eType result_code =
GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
@@ -190,12 +191,16 @@ void ShowConstantTBTRequest::on_event(const event_engine::Event& event) {
bool result = false;
if (mobile_apis::Result::SUCCESS == result_code) {
result = true;
+ return_info =
+ message[strings::msg_params][hmi_response::message].asString();
} else if ((mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) &&
hmi_capabilities.is_ui_cooperating()) {
result = true;
}
- SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
+ SendResponse(result, result_code,
+ return_info.empty() ? 0 : return_info.c_str(),
+ &(message[strings::msg_params]));
break;
}
default: {
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 0a136e0ac2..2b31cf8f38 100644
--- a/src/components/application_manager/src/commands/mobile/show_request.cc
+++ b/src/components/application_manager/src/commands/mobile/show_request.cc
@@ -30,13 +30,13 @@
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string.h>
#include "application_manager/commands/mobile/show_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application.h"
#include "application_manager/message_helper.h"
#include "utils/file_system.h"
-
-#include <string.h>
+#include "utils/helpers.h"
namespace application_manager {
@@ -52,19 +52,18 @@ ShowRequest::~ShowRequest() {
void ShowRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
- ->application(
- (*message_)[strings::params][strings::connection_key].asInt());
+ ApplicationSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(
- logger_, "Application is not registered");
+ LOG4CXX_ERROR(logger_, "Application is not registered");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
//SDLAQ-CRS-494, VC3.1
if ((*message_)[strings::msg_params].empty()) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, strings::msg_params << " is empty.");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
@@ -81,11 +80,12 @@ void ShowRequest::Run() {
if(((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) &&
((*message_)[strings::msg_params][strings::soft_buttons].length() > 0)) {
processing_result =
- MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app);
+ MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params],
+ app);
}
if (mobile_apis::Result::SUCCESS != processing_result) {
- LOG4CXX_ERROR(logger_, "INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, "Processing of soft buttons failed.");
SendResponse(false, processing_result);
return;
}
@@ -98,7 +98,7 @@ void ShowRequest::Run() {
verification_result = MessageHelper::VerifyImage(
(*message_)[strings::msg_params][strings::graphic], app);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -108,7 +108,7 @@ void ShowRequest::Run() {
verification_result = MessageHelper::VerifyImage(
(*message_)[strings::msg_params][strings::secondary_graphic], app);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_ERROR(logger_, "VerifyImage INVALID_DATA!");
+ LOG4CXX_ERROR(logger_, "Image verification failed.");
SendResponse(false, verification_result);
return;
}
@@ -217,34 +217,37 @@ void ShowRequest::Run() {
void ShowRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
case hmi_apis::FunctionID::UI_Show: {
- LOG4CXX_INFO(logger_, "Received UI_Show event");
- std::string response_info("");
+ LOG4CXX_DEBUG(logger_, "Received UI_Show event.");
+ std::string response_info;
mobile_apis::Result::eType result_code =
static_cast<mobile_apis::Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result = false;
+ const bool result =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
- if (mobile_apis::Result::SUCCESS == result_code) {
- result = true;
- } else if (mobile_apis::Result::WARNINGS == result_code) {
- result = true;
- if (message[strings::params].keyExists(hmi_response::message)) {
- response_info = message[strings::params][hmi_response::message].asString();
- }
+ if (mobile_apis::Result::WARNINGS == result_code &&
+ message[strings::params].keyExists(hmi_response::message)) {
+ response_info =
+ message[strings::params][hmi_response::message].asString();
}
SendResponse(result, result_code,
response_info.empty() ? NULL : response_info.c_str(),
- &(message[strings::msg_params]));
+ &(message[strings::msg_params]));
break;
}
default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
+ LOG4CXX_ERROR(logger_,"Received unknown event " << event.id());
break;
}
}
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 cef2bed1fc..80eb6336ce 100644
--- a/src/components/application_manager/src/commands/mobile/slider_request.cc
+++ b/src/components/application_manager/src/commands/mobile/slider_request.cc
@@ -34,6 +34,8 @@
#include "application_manager/commands/mobile/slider_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
#include "config_profile/profile.h"
namespace application_manager {
@@ -73,8 +75,8 @@ void SliderRequest::Run() {
return;
}
- if ((*message_)[strings::msg_params][strings::num_ticks].asInt()
- < (*message_)[strings::msg_params][strings::position].asInt()) {
+ if ((*message_)[strings::msg_params][strings::num_ticks].asInt() <
+ (*message_)[strings::msg_params][strings::position].asInt()) {
LOG4CXX_ERROR(logger_, "INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
@@ -112,45 +114,66 @@ void SliderRequest::Run() {
void SliderRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
- const smart_objects::SmartObject& message = event.smart_object();
+ using namespace helpers;
+ using namespace smart_objects;
+ using namespace hmi_apis;
+
+ const SmartObject& message = event.smart_object();
const event_engine::Event::EventID event_id = event.id();
- if (event_id == hmi_apis::FunctionID::UI_OnResetTimeout) {
+ if (event_id == FunctionID::UI_OnResetTimeout) {
LOG4CXX_INFO(logger_, "Received UI_OnResetTimeout event");
ApplicationManagerImpl::instance()->updateRequestTimeout(connection_key(),
correlation_id(),
default_timeout());
return;
}
- if (event_id != hmi_apis::FunctionID::UI_Slider) {
+
+ if (event_id != FunctionID::UI_Slider) {
LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
return;
}
- //event_id == hmi_apis::FunctionID::UI_Slider:
- LOG4CXX_INFO(logger_, "Received UI_Slider event");
-
- const int response_code =
- message[strings::params][hmi_response::code].asInt();
- smart_objects::SmartObject response_msg_params = message[strings::msg_params];
- if (response_code == hmi_apis::Common_Result::ABORTED &&
- message[strings::params][strings::data].keyExists(strings::slider_position)) {
- //Copy slider_position info to msg_params section
- response_msg_params[strings::slider_position] =
- message[strings::params][strings::data][strings::slider_position];
+ LOG4CXX_DEBUG(logger_, "Received UI_Slider event");
+
+ const Common_Result::eType response_code = static_cast<Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
+
+ SmartObject response_msg_params = message[strings::msg_params];
+
+ const bool is_timeout_aborted =
+ Compare<Common_Result::eType, EQ, ONE>(
+ response_code,
+ Common_Result::TIMED_OUT,
+ Common_Result::ABORTED);
+
+ if (is_timeout_aborted) {
+ if (message[strings::params][strings::data]
+ .keyExists(strings::slider_position)) {
+ //Copy slider_position info to msg_params section
+ response_msg_params[strings::slider_position] =
+ message[strings::params][strings::data][strings::slider_position];
+ } else {
+ LOG4CXX_ERROR(logger_, strings::slider_position << " field is absent"
+ " in response.");
+ response_msg_params[strings::slider_position] = 0;
+ }
}
const bool is_response_success =
- (mobile_apis::Result::SUCCESS == response_code);
+ Compare<Common_Result::eType, EQ, ONE>(
+ response_code,
+ Common_Result::SUCCESS,
+ Common_Result::WARNINGS);
SendResponse(is_response_success,
- mobile_apis::Result::eType(response_code),
+ MessageHelper::HMIToMobileResult(response_code),
0,
&response_msg_params);
}
bool SliderRequest::IsWhiteSpaceExist() {
- LOG4CXX_INFO(logger_, "PerformAudioPassThruRequest::IsWhiteSpaceExist");
+ LOG4CXX_AUTO_TRACE(logger_);
const char* str = NULL;
str = (*message_)[strings::msg_params][strings::slider_header].asCharArray();
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 b2f112a64a..7b0bc785e1 100644
--- a/src/components/application_manager/src/commands/mobile/speak_request.cc
+++ b/src/components/application_manager/src/commands/mobile/speak_request.cc
@@ -35,6 +35,7 @@
#include "application_manager/commands/mobile/speak_request.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -51,11 +52,12 @@ SpeakRequest::~SpeakRequest() {
void SpeakRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr app = application_manager::ApplicationManagerImpl::instance()
- ->application(connection_key());
+ ApplicationSharedPtr app =
+ application_manager::ApplicationManagerImpl::instance()->application(
+ connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "NULL pointer");
+ LOG4CXX_ERROR(logger_, "NULL pointer");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -101,36 +103,48 @@ void SpeakRequest::on_event(const event_engine::Event& event) {
void SpeakRequest::ProcessTTSSpeakResponse(
const smart_objects::SmartObject& message) {
LOG4CXX_AUTO_TRACE(logger_);
- ApplicationSharedPtr application = ApplicationManagerImpl::instance()->application(
- connection_key());
+ using namespace helpers;
+
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!application) {
LOG4CXX_ERROR(logger_, "NULL pointer");
return;
}
- bool result = false;
- mobile_apis::Result::eType result_code =
- static_cast<mobile_apis::Result::eType>(
+ hmi_apis::Common_Result::eType hmi_result_code =
+ static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- if (hmi_apis::Common_Result::SUCCESS ==
- static_cast<hmi_apis::Common_Result::eType>(result_code)) {
- result = true;
- }
+
+ mobile_apis::Result::eType result_code =
+ MessageHelper::HMIToMobileResult(hmi_result_code);
+
+ const bool result =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
+
(*message_)[strings::params][strings::function_id] =
- mobile_apis::FunctionID::SpeakID;
+ mobile_apis::FunctionID::SpeakID;
const char* return_info = NULL;
- if (hmi_apis::Common_Result::UNSUPPORTED_RESOURCE ==
- static_cast<hmi_apis::Common_Result::eType>(result_code)) {
+ const bool is_result_ok =
+ Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::UNSUPPORTED_RESOURCE,
+ mobile_api::Result::WARNINGS);
+
+ if (is_result_ok) {
result_code = mobile_apis::Result::WARNINGS;
return_info = std::string(
"Unsupported phoneme type sent in a prompt").c_str();
}
- SendResponse(result, static_cast<mobile_apis::Result::eType>(result_code),
- return_info, &(message[strings::msg_params]));
+ SendResponse(result, result_code, return_info,
+ &(message[strings::msg_params]));
}
bool SpeakRequest::IsWhiteSpaceExist() {
diff --git a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
index 22bc57620a..9be2251a67 100644
--- a/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
+++ b/src/components/application_manager/src/commands/mobile/subscribe_button_request.cc
@@ -54,7 +54,7 @@ void SubscribeButtonRequest::Run() {
ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "APPLICATION_NOT_REGISTERED");
+ LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -64,21 +64,21 @@ void SubscribeButtonRequest::Run() {
(*message_)[str::msg_params][str::button_name].asUInt());
if (!IsSubscriptionAllowed(app, btn_id)) {
- LOG4CXX_ERROR_EXT(logger_, "Subscribe on button " << btn_id
+ LOG4CXX_ERROR(logger_, "Subscribe on button " << btn_id
<< " isn't allowed");
SendResponse(false, mobile_apis::Result::REJECTED);
return;
}
if (!CheckHMICapabilities(btn_id)) {
- LOG4CXX_ERROR_EXT(logger_, "Subscribe on button " << btn_id
+ LOG4CXX_ERROR(logger_, "Subscribe on button " << btn_id
<< " isn't allowed by HMI capabilities");
SendResponse(false, mobile_apis::Result::UNSUPPORTED_RESOURCE);
return;
}
if (app->IsSubscribedToButton(btn_id)) {
- LOG4CXX_ERROR_EXT(logger_, "Already subscribed to button " << btn_id);
+ LOG4CXX_ERROR(logger_, "Already subscribed to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
@@ -119,7 +119,7 @@ bool SubscribeButtonRequest::CheckHMICapabilities(
const HMICapabilities& hmi_caps = app_mgr->hmi_capabilities();
if (!hmi_caps.is_ui_cooperating()) {
- LOG4CXX_ERROR_EXT(logger_, "UI is not supported by HMI.");
+ LOG4CXX_ERROR(logger_, "UI is not supported by HMI.");
return false;
}
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 f00527037e..0e6e726f75 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
@@ -35,6 +35,7 @@
#include "application_manager/application_manager_impl.h"
#include "application_manager/application_impl.h"
#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
@@ -87,7 +88,7 @@ void SubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- CommandRequestImpl::connection_key());
+ connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -109,28 +110,62 @@ void SubscribeVehicleDataRequest::Run() {
smart_objects::SmartObject response_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
- msg_params[strings::app_id] = app->app_id();
-
for (; vehicle_data.end() != it; ++it) {
- std::string key_name = it->first;
+ const std::string& key_name = it->first;
if ((*message_)[strings::msg_params].keyExists(key_name)) {
bool is_key_enabled = (*message_)[strings::msg_params][key_name].asBool();
if (is_key_enabled) {
++items_to_subscribe;
- msg_params[key_name] = is_key_enabled;
VehicleDataType key_type = it->second;
- if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) {
+ if (app->IsSubscribedToIVI(key_type)) {
+ LOG4CXX_DEBUG(logger_, "App with connection key " << connection_key()
+ << " is subscribed already for VehicleDataType: "
+ << key_type);
++subscribed_items;
- } else {
+ vi_already_subscribed_by_this_app_.insert(key_type);
response_params[key_name][strings::data_type] = key_type;
response_params[key_name][strings::result_code] =
mobile_apis::VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED;
+ continue;
+ }
+
+ if (IsSomeoneSubscribedFor(key_type)) {
+ LOG4CXX_DEBUG(logger_, "There are apps subscribed already for "
+ "VehicleDataType: " << key_type);
+ if (!app->SubscribeToIVI(static_cast<uint32_t>(key_type))) {
+ LOG4CXX_ERROR(logger_, "Unable to subscribe for VehicleDataType: "
+ << key_type);
+ continue;
+ }
+ LOG4CXX_DEBUG(logger_, "App with connection key " << connection_key()
+ << " have been subscribed for VehicleDataType: "
+ << key_type);
+ ++subscribed_items;
+ vi_already_subscribed_by_another_apps_.insert(key_type);
+ response_params[key_name][strings::data_type] = key_type;
+ response_params[key_name][strings::result_code] =
+ mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
+ continue;
+ }
+
+ msg_params[key_name] = is_key_enabled;
+
+ if (app->SubscribeToIVI(static_cast<uint32_t>(key_type))) {
+ LOG4CXX_DEBUG(logger_, "App with connection key " << connection_key()
+ << " have been subscribed for VehicleDataType: "
+ << key_type);
+ ++subscribed_items;
}
}
}
}
+ bool is_everything_already_subscribed =
+ static_cast<uint32_t>(items_to_subscribe) ==
+ vi_already_subscribed_by_another_apps_.size() +
+ vi_already_subscribed_by_this_app_.size();
+
if (0 == items_to_subscribe) {
if (HasDisallowedParams()) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
@@ -139,7 +174,9 @@ void SubscribeVehicleDataRequest::Run() {
"No data in the request");
}
return;
- } else if (0 == subscribed_items) {
+ }
+
+ if (0 == subscribed_items) {
SendResponse(false,
mobile_apis::Result::IGNORED,
"Already subscribed on provided VehicleData.",
@@ -147,6 +184,24 @@ void SubscribeVehicleDataRequest::Run() {
return;
}
+ if (is_everything_already_subscribed) {
+ mobile_apis::Result::eType result_code =
+ vi_already_subscribed_by_this_app_.size()
+ ? mobile_apis::Result::IGNORED
+ : mobile_apis::Result::SUCCESS;
+
+ const char* info =
+ vi_already_subscribed_by_this_app_.size()
+ ? "Already subscribed on some provided VehicleData."
+ : NULL;
+
+ SendResponse(true,
+ result_code,
+ info,
+ &response_params);
+ return;
+ }
+
#ifdef HMI_DBUS_API
//Generate list of subrequests
for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
@@ -160,10 +215,12 @@ void SubscribeVehicleDataRequest::Run() {
hmi_requests_.push_back(hmi_request);
}
}
- LOG4CXX_INFO(logger_, hmi_requests_.size() << " requests are going to be sent to HMI");
+ LOG4CXX_DEBUG(logger_, hmi_requests_.size() <<
+ " requests are going to be sent to HMI");
//Send subrequests
- for (HmiRequests::const_iterator it = hmi_requests_.begin(); it != hmi_requests_.end(); ++it)
+ for (HmiRequests::const_iterator it = hmi_requests_.begin();
+ it != hmi_requests_.end(); ++it)
SendHMIRequest(it->func_id, &msg_params, true);
#else
SendHMIRequest(hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData,
@@ -173,9 +230,15 @@ void SubscribeVehicleDataRequest::Run() {
void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
+ if (hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event.");
+ return;
+ }
+
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
CommandRequestImpl::connection_key());
@@ -190,8 +253,8 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
HmiRequest & hmi_request = *it;
if (hmi_request.func_id == event.id()) {
hmi_request.status =
- static_cast<hmi_apis::Common_Result::eType>(message[strings::params][hmi_response::code]
- .asInt());
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == hmi_request.status)
hmi_request.value = message[strings::msg_params][hmi_request.str];
hmi_request.complete = true;
@@ -241,54 +304,96 @@ void SubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result =
- hmi_result == hmi_apis::Common_Result::SUCCESS;
+ const bool is_result_no_error =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_result,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
+
+ bool is_succeeded = is_result_no_error ||
+ !vi_already_subscribed_by_another_apps_.empty();
mobile_apis::Result::eType result_code =
- hmi_result == hmi_apis::Common_Result::SUCCESS
- ? mobile_apis::Result::SUCCESS
- : static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
+ MessageHelper::HMIToMobileResult(hmi_result);
const char* return_info = NULL;
- if (result) {
- if (IsAnythingAlreadySubscribed(message[strings::msg_params])) {
+ if (is_succeeded) {
+ if (!vi_already_subscribed_by_this_app_.empty()) {
result_code = mobile_apis::Result::IGNORED;
- return_info =
- std::string("Already subscribed on some provided VehicleData.").c_str();
+ return_info = "Already subscribed on some provided VehicleData.";
}
}
- SendResponse(result,
+ UnsubscribeFailedSubscriptions(app, message[strings::msg_params]);
+
+ if (!vi_already_subscribed_by_another_apps_.empty() ||
+ !vi_already_subscribed_by_this_app_.empty()) {
+ AddAlreadySubscribedVI(const_cast<smart_objects::SmartObject&>(
+ message[strings::msg_params]));
+ }
+
+ SendResponse(is_succeeded,
result_code,
return_info,
&(message[strings::msg_params]));
- if (result) {
+ if (is_succeeded) {
app->UpdateHash();
}
#endif // #ifdef HMI_DBUS_API
}
-bool SubscribeVehicleDataRequest::IsAnythingAlreadySubscribed(
- const smart_objects::SmartObject& msg_params) const {
- LOG4CXX_INFO(logger_, "IsAnythingAlreadySubscribed");
+void SubscribeVehicleDataRequest::AddAlreadySubscribedVI(
+ smart_objects::SmartObject& msg_params) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+ 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] =
+ VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED;
+ }
+
+ 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] =
+ VehicleDataResultCode::VDRC_SUCCESS;
+ }
+}
+void SubscribeVehicleDataRequest::UnsubscribeFailedSubscriptions(
+ ApplicationSharedPtr app,
+ const smart_objects::SmartObject& msg_params) const {
+ LOG4CXX_AUTO_TRACE(logger_);
const VehicleData& vehicle_data = MessageHelper::vehicle_data();
VehicleData::const_iterator it = vehicle_data.begin();
for (; vehicle_data.end() != it; ++it) {
if (msg_params.keyExists(it->first)) {
- if (msg_params[it->first][strings::result_code].asInt() ==
- hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_ALREADY_SUBSCRIBED) {
- return true;
+ if (msg_params[it->first][strings::result_code].asInt() !=
+ hmi_apis::Common_VehicleDataResultCode::VDRC_SUCCESS) {
+ LOG4CXX_DEBUG(logger_, "Subscription for VehicleDataType "
+ << it->first
+ << " is unsuccessfull. "
+ "Unsubscribing app with connection key "
+ << connection_key()
+ << " from it.");
+ app->UnsubscribeFromIVI(it->second);
}
}
}
-
- return false;
}
+bool SubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
+ const uint32_t param_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationManagerImpl::SubscribedToIVIPredicate finder(param_id);
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ return !accessor.FindAll(finder).empty();
+}
} // namespace commands
} // namespace application_manager
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 ec66f325df..c4c81a837e 100644
--- a/src/components/application_manager/src/commands/mobile/system_request.cc
+++ b/src/components/application_manager/src/commands/mobile/system_request.cc
@@ -41,8 +41,9 @@ Copyright (c) 2013, Ford Motor Company
#include "interfaces/MOBILE_API.h"
#include "config_profile/profile.h"
#include "utils/file_system.h"
-#include "formatters/CFormatterJsonBase.hpp"
+#include "formatters/CFormatterJsonBase.h"
#include "json/json.h"
+#include "utils/helpers.h"
namespace application_manager {
@@ -54,11 +55,9 @@ const std::string kSYNC = "SYNC";
const std::string kIVSU = "IVSU";
SystemRequest::SystemRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ : CommandRequestImpl(message) {}
-SystemRequest::~SystemRequest() {
-}
+SystemRequest::~SystemRequest() {}
void SystemRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -77,7 +76,7 @@ void SystemRequest::Run() {
(*message_)[strings::msg_params][strings::request_type].asInt());
if (!policy::PolicyHandler::instance()->IsRequestTypeAllowed(
- application->mobile_app_id(), request_type)) {
+ application->mobile_app_id(), request_type)) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
return;
}
@@ -89,15 +88,14 @@ void SystemRequest::Run() {
file_name = kSYNC;
}
- bool is_system_file =
- std::string::npos != file_name.find(kSYNC) ||
- std::string::npos != file_name.find(kIVSU);
+ bool is_system_file = std::string::npos != file_name.find(kSYNC) ||
+ std::string::npos != file_name.find(kIVSU);
// to avoid override existing file
if (is_system_file) {
const uint8_t max_size = 255;
char buf[max_size] = {'\0'};
- snprintf(buf, sizeof(buf)/sizeof(buf[0]), "%d%s", index++, file_name.c_str());
+ snprintf(buf, max_size - 1, "%d%s", index++, file_name.c_str());
file_name = buf;
}
@@ -118,9 +116,10 @@ void SystemRequest::Run() {
file_dst_path += file_name;
if ((*message_)[strings::params].keyExists(strings::binary_data)) {
- LOG4CXX_DEBUG(logger_, "Binary data is present. Trying to save it to: "
- << binary_data_folder);
- if (mobile_apis::Result::SUCCESS !=
+ LOG4CXX_DEBUG(
+ logger_,
+ "Binary data is present. Trying to save it to: " << binary_data_folder);
+ if (mobile_apis::Result::SUCCESS !=
(ApplicationManagerImpl::instance()->SaveBinary(
binary_data, binary_data_folder, file_name, 0))) {
LOG4CXX_DEBUG(logger_, "Binary data can't be saved.");
@@ -131,16 +130,29 @@ void SystemRequest::Run() {
std::string app_full_file_path = binary_data_folder;
app_full_file_path += file_name;
- LOG4CXX_DEBUG(logger_, "Binary data is not present. Trying to find file "
- << file_name << " within previously saved app file in "
- << binary_data_folder);
+ LOG4CXX_DEBUG(logger_,
+ "Binary data is not present. Trying to find file "
+ << file_name
+ << " within previously saved app file in "
+ << binary_data_folder);
const AppFile* file = application->GetFile(app_full_file_path);
if (!file || !file->is_download_complete ||
!file_system::MoveFile(app_full_file_path, file_dst_path)) {
LOG4CXX_DEBUG(logger_, "Binary data not found.");
- SendResponse(false, mobile_apis::Result::REJECTED);
- return;
+
+ 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. Reject");
+ SendResponse(false, mobile_apis::Result::REJECTED);
+ return;
+ }
+ LOG4CXX_DEBUG(logger_, "IVSU does not require binary data. Continue");
}
processing_file_ = file_dst_path;
}
@@ -172,10 +184,10 @@ void SystemRequest::Run() {
return;
}
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if (std::string::npos != file_name.find(kIVSU)) {
- msg_params[strings::file_name] = file_name.c_str();
+ msg_params[strings::file_name] = file_name;
} else {
msg_params[strings::file_name] = file_dst_path;
}
@@ -186,12 +198,14 @@ void SystemRequest::Run() {
msg_params[strings::request_type] =
(*message_)[strings::msg_params][strings::request_type];
SendHMIRequest(hmi_apis::FunctionID::BasicCommunication_SystemRequest,
- &msg_params, true);
-
+ &msg_params,
+ true);
}
void SystemRequest::on_event(const event_engine::Event& event) {
- LOG4CXX_INFO(logger_, "AddSubMenuRequest::on_event");
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+
const smart_objects::SmartObject& message = event.smart_object();
switch (event.id()) {
@@ -199,10 +213,14 @@ void SystemRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code =
GetMobileResultCode(static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asUInt()));
- bool result = mobile_apis::Result::SUCCESS == result_code;
+
+ const bool result = Compare<mobile_api::Result::eType, EQ, ONE>(
+ result_code,
+ mobile_api::Result::SUCCESS,
+ mobile_api::Result::WARNINGS);
ApplicationSharedPtr application =
- ApplicationManagerImpl::instance()->application(connection_key());
+ ApplicationManagerImpl::instance()->application(connection_key());
if (!(application.valid())) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -224,15 +242,15 @@ void SystemRequest::on_event(const event_engine::Event& event) {
}
bool SystemRequest::ValidateQueryAppData(
- const smart_objects::SmartObject& data) const {
+ const smart_objects::SmartObject& data) const {
if (!data.isValid()) {
LOG4CXX_ERROR(logger_, "QueryApps response is not valid.");
return false;
}
if (!data.keyExists(json::response)) {
LOG4CXX_ERROR(logger_,
- "QueryApps response does not contain '"
- << json::response << "' parameter.");
+ "QueryApps response does not contain '" << json::response
+ << "' parameter.");
return false;
}
smart_objects::SmartArray* obj_array = data[json::response].asArray();
diff --git a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
index a2958342ea..ef0b9a9a73 100644
--- a/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
+++ b/src/components/application_manager/src/commands/mobile/unsubscribe_button_request.cc
@@ -56,7 +56,7 @@ void UnsubscribeButtonRequest::Run() {
ApplicationManagerImpl::instance()->application(connection_key());
if (!app) {
- LOG4CXX_ERROR_EXT(logger_, "APPLICATION_NOT_REGISTERED");
+ LOG4CXX_ERROR(logger_, "APPLICATION_NOT_REGISTERED");
SendResponse(false, mobile_apis::Result::APPLICATION_NOT_REGISTERED);
return;
}
@@ -65,7 +65,7 @@ void UnsubscribeButtonRequest::Run() {
(*message_)[str::msg_params][str::button_name].asUInt();
if (!app->IsSubscribedToButton(static_cast<mobile_apis::ButtonName::eType>(btn_id))) {
- LOG4CXX_ERROR_EXT(logger_, "App doesn't subscibe to button " << btn_id);
+ LOG4CXX_ERROR(logger_, "App doesn't subscibe to button " << btn_id);
SendResponse(false, mobile_apis::Result::IGNORED);
return;
}
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 7d05ce328f..1c4f3ff280 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
@@ -39,6 +39,7 @@
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
#include "application_manager/smart_object_keys.h"
+#include "utils/helpers.h"
namespace application_manager {
namespace commands {
@@ -91,7 +92,7 @@ void UnsubscribeVehicleDataRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- CommandRequestImpl::connection_key());
+ connection_key());
if (!app) {
LOG4CXX_ERROR(logger_, "NULL pointer");
@@ -99,9 +100,7 @@ void UnsubscribeVehicleDataRequest::Run() {
return;
}
- // counter for items to subscribe
int32_t items_to_unsubscribe = 0;
- // counter for subscribed items by application
int32_t unsubscribed_items = 0;
const VehicleData& vehicle_data = MessageHelper::vehicle_data();
@@ -113,28 +112,57 @@ void UnsubscribeVehicleDataRequest::Run() {
smart_objects::SmartObject response_params = smart_objects::SmartObject(
smart_objects::SmartType_Map);
- msg_params[strings::app_id] = app->app_id();
-
for (; vehicle_data.end() != it; ++it) {
- std::string key_name = it->first;
+ const std::string& key_name = it->first;
if ((*message_)[strings::msg_params].keyExists(key_name)) {
bool is_key_enabled = (*message_)[strings::msg_params][key_name].asBool();
if (is_key_enabled) {
++items_to_unsubscribe;
- msg_params[key_name] = is_key_enabled;
VehicleDataType key_type = it->second;
- if (app->UnsubscribeFromIVI(static_cast<uint32_t>(key_type))) {
+ if (!app->IsSubscribedToIVI(key_type)) {
++unsubscribed_items;
- } else {
+ vi_already_unsubscribed_by_this_app_.insert(key_type);
response_params[key_name][strings::data_type] = key_type;
response_params[key_name][strings::result_code] =
mobile_apis::VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
+ continue;
+ }
+
+ if (!app->UnsubscribeFromIVI(static_cast<uint32_t>(key_type))) {
+ LOG4CXX_ERROR(logger_, "Unable to unsubscribe from "
+ "VehicleDataType: " << key_type);
+ continue;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Unsubscribed app with connection key "
+ << connection_key()
+ << " from VehicleDataType: "
+ << key_type);
+
+ ++unsubscribed_items;
+
+ if (IsSomeoneSubscribedFor(key_type)) {
+ LOG4CXX_DEBUG(logger_, "There are another apps still subscribed for "
+ "VehicleDataType: " << key_type);
+
+ vi_still_subscribed_by_another_apps_.insert(key_type);
+ response_params[key_name][strings::data_type] = key_type;
+ response_params[key_name][strings::result_code] =
+ mobile_apis::VehicleDataResultCode::VDRC_SUCCESS;
+ continue;
}
+
+ msg_params[key_name] = is_key_enabled;
}
}
}
+ bool is_everything_already_unsubscribed =
+ static_cast<uint32_t>(items_to_unsubscribe) ==
+ vi_still_subscribed_by_another_apps_.size() +
+ vi_already_unsubscribed_by_this_app_.size();
+
if (0 == items_to_unsubscribe) {
if (HasDisallowedParams()) {
SendResponse(false, mobile_apis::Result::DISALLOWED);
@@ -143,12 +171,32 @@ void UnsubscribeVehicleDataRequest::Run() {
"No data in the request.");
}
return;
- } else if (0 == unsubscribed_items) {
+ }
+
+ if (0 == unsubscribed_items) {
SendResponse(false, mobile_apis::Result::IGNORED,
"Was not subscribed on any VehicleData.", &response_params);
return;
}
+ if (is_everything_already_unsubscribed) {
+ mobile_apis::Result::eType result_code =
+ vi_already_unsubscribed_by_this_app_.size()
+ ? mobile_apis::Result::IGNORED
+ : mobile_apis::Result::SUCCESS;
+
+ const char* info =
+ vi_already_unsubscribed_by_this_app_.size()
+ ? "Already subscribed on some provided VehicleData."
+ : NULL;
+
+ SendResponse(true,
+ result_code,
+ info,
+ &response_params);
+ return;
+ }
+
#ifdef HMI_DBUS_API
//Generate list of subrequests
for (size_t i = 0; i < sizeof(subrequests) / sizeof(subrequests[0]); ++i) {
@@ -177,24 +225,30 @@ void UnsubscribeVehicleDataRequest::Run() {
void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
const smart_objects::SmartObject& message = event.smart_object();
+ if (hmi_apis::FunctionID::VehicleInfo_UnsubscribeVehicleData != event.id()) {
+ LOG4CXX_ERROR(logger_, "Received unknown event.");
+ return;
+ }
+
#ifdef HMI_DBUS_API
for (HmiRequests::iterator it = hmi_requests_.begin();
it != hmi_requests_.end(); ++it) {
HmiRequest & hmi_request = *it;
if (hmi_request.func_id == event.id()) {
hmi_request.status =
- static_cast<hmi_apis::Common_Result::eType>(message[strings::params][hmi_response::code]
- .asInt());
+ static_cast<hmi_apis::Common_Result::eType>(
+ message[strings::params][hmi_response::code].asInt());
if (hmi_apis::Common_Result::SUCCESS == hmi_request.status)
hmi_request.value = message[strings::msg_params][hmi_request.str];
hmi_request.complete = true;
break;
}
}
- bool all_complete = true;
+ bool all_complete = true;
bool any_arg_success = false;
mobile_api::Result::eType status = mobile_api::Result::eType::SUCCESS;
for (HmiRequests::const_iterator it = hmi_requests_.begin();
@@ -223,55 +277,97 @@ void UnsubscribeVehicleDataRequest::on_event(const event_engine::Event& event) {
response_params[it->str] = it->value;
}
}
+
LOG4CXX_INFO(logger_, "All HMI requests are complete");
+ if (true == any_arg_success) {
+ SetAllowedToTerminate(false);
+ }
SendResponse(any_arg_success, status, NULL, &response_params);
- }
+ if (true == any_arg_success) {
+ UpdateHash();
+ }
+ }
#else
hmi_apis::Common_Result::eType hmi_result =
static_cast<hmi_apis::Common_Result::eType>(
message[strings::params][hmi_response::code].asInt());
- bool result =
- hmi_result == hmi_apis::Common_Result::SUCCESS;
+ bool is_succeeded =
+ Compare<hmi_apis::Common_Result::eType, EQ, ONE>(
+ hmi_result,
+ hmi_apis::Common_Result::SUCCESS,
+ hmi_apis::Common_Result::WARNINGS);
mobile_apis::Result::eType result_code =
- hmi_result == hmi_apis::Common_Result::SUCCESS
- ? mobile_apis::Result::SUCCESS
- : static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
+ MessageHelper::HMIToMobileResult(hmi_result);
const char* return_info = NULL;
- if (result) {
- if (IsAnythingAlreadyUnsubscribed(message[strings::msg_params])) {
+ if (is_succeeded) {
+ if (vi_already_unsubscribed_by_this_app_.size()) {
result_code = mobile_apis::Result::IGNORED;
- return_info =
- std::string("Some provided VehicleData was not subscribed.").c_str();
+ return_info = "Some provided VehicleData was not subscribed.";
}
}
- SendResponse(result, result_code, return_info,
- &(message[strings::msg_params]));
+ if (!vi_still_subscribed_by_another_apps_.empty() ||
+ !vi_already_unsubscribed_by_this_app_.empty()) {
+ AddAlreadyUnsubscribedVI(const_cast<smart_objects::SmartObject&>(
+ message[strings::msg_params]));
+ }
+
+ if (is_succeeded) {
+ SetAllowedToTerminate(false);
+ }
+ SendResponse(is_succeeded, result_code, return_info,
+ &(message[strings::msg_params]));
+ if (is_succeeded) {
+ UpdateHash();
+ }
#endif // #ifdef HMI_DBUS_API
}
-bool UnsubscribeVehicleDataRequest::IsAnythingAlreadyUnsubscribed(
- const smart_objects::SmartObject& msg_params) const {
- LOG4CXX_INFO(logger_, "IsAnythingAlreadyUnsubscribed");
+bool UnsubscribeVehicleDataRequest::IsSomeoneSubscribedFor(
+ const uint32_t param_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationManagerImpl::SubscribedToIVIPredicate finder(param_id);
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ return !accessor.FindAll(finder).empty();
+}
- const VehicleData& vehicle_data = MessageHelper::vehicle_data();
- VehicleData::const_iterator it = vehicle_data.begin();
+void UnsubscribeVehicleDataRequest::AddAlreadyUnsubscribedVI(
+ smart_objects::SmartObject& response) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+ VehicleInfoSubscriptions::const_iterator it_same_app =
+ vi_already_unsubscribed_by_this_app_.begin();
+ for (;vi_already_unsubscribed_by_this_app_.end() != it_same_app;
+ ++it_same_app) {
+ response[*it_same_app][strings::result_code] =
+ VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED;
+ }
- for (; vehicle_data.end() != it; ++it) {
- if (msg_params.keyExists(it->first)) {
- if (msg_params[it->first][strings::result_code].asInt() ==
- hmi_apis::Common_VehicleDataResultCode::VDRC_DATA_NOT_SUBSCRIBED) {
- return true;
- }
- }
+ VehicleInfoSubscriptions::const_iterator it_another_app =
+ vi_still_subscribed_by_another_apps_.begin();
+ for (;vi_still_subscribed_by_another_apps_.end() != it_another_app;
+ ++it_another_app) {
+ response[*it_another_app][strings::result_code] =
+ VehicleDataResultCode::VDRC_SUCCESS;
}
+}
- return false;
+void UnsubscribeVehicleDataRequest::UpdateHash() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationSharedPtr application =
+ ApplicationManagerImpl::instance()->application(connection_key());
+ if (application) {
+ application->UpdateHash();
+ } else {
+ LOG4CXX_ERROR(logger_, "Application with connection_key = "
+ << connection_key() <<" doesn't exist.");
+ }
+ ApplicationManagerImpl::instance()->TerminateRequest(connection_key(),
+ correlation_id());
}
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 650e698bf4..482e9d7b42 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
@@ -38,17 +38,18 @@
#include "application_manager/message_helper.h"
#include "interfaces/MOBILE_API.h"
#include "interfaces/HMI_API.h"
+#include "utils/custom_string.h"
namespace application_manager {
namespace commands {
+namespace custom_str = utils::custom_string;
+
UpdateTurnListRequest::UpdateTurnListRequest(const MessageSharedPtr& message)
- : CommandRequestImpl(message) {
-}
+ : CommandRequestImpl(message) {}
-UpdateTurnListRequest::~UpdateTurnListRequest() {
-}
+UpdateTurnListRequest::~UpdateTurnListRequest() {}
void UpdateTurnListRequest::Run() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -69,7 +70,7 @@ void UpdateTurnListRequest::Run() {
return;
}
- //ProcessSoftButtons checks strings on the contents incorrect character
+ // ProcessSoftButtons checks strings on the contents incorrect character
mobile_apis::Result::eType processing_result =
MessageHelper::ProcessSoftButtons((*message_)[strings::msg_params], app);
@@ -84,20 +85,20 @@ void UpdateTurnListRequest::Run() {
smart_objects::SmartObject& turn_list_array =
((*message_)[strings::msg_params][strings::turn_list]);
for (uint32_t i = 0; i < turn_list_array.length(); ++i) {
- if((turn_list_array[i].keyExists(strings::turn_icon)) &&
- (mobile_apis::Result::SUCCESS != MessageHelper::VerifyImage(
- turn_list_array[i][strings::turn_icon], app))) {
- LOG4CXX_ERROR_EXT(
- logger_,
- "MessageHelper::VerifyImage return INVALID_DATA");
+ if ((turn_list_array[i].keyExists(strings::turn_icon)) &&
+ (mobile_apis::Result::SUCCESS !=
+ MessageHelper::VerifyImage(turn_list_array[i][strings::turn_icon],
+ app))) {
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifyImage return INVALID_DATA");
SendResponse(false, mobile_apis::Result::INVALID_DATA);
return;
}
}
}
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params = (*message_)[strings::msg_params];
if ((*message_)[strings::msg_params].keyExists(strings::turn_list)) {
@@ -109,15 +110,15 @@ void UpdateTurnListRequest::Run() {
for (uint32_t i = 0; i < msg_params[strings::turn_list].length(); ++i) {
if (msg_params[strings::turn_list][i].keyExists(hmi_request::navi_text)) {
- std::string navigation_text =
- msg_params[strings::turn_list][i][hmi_request::navi_text].asString();
+ const custom_str::CustomString& navigation_text =
+ msg_params[strings::turn_list][i][hmi_request::navi_text]
+ .asCustomString();
msg_params[strings::turn_list][i].erase(hmi_request::navi_text);
- msg_params[strings::turn_list]
- [i][hmi_request::navi_text][hmi_request::field_name] =
- static_cast<int>(hmi_apis::Common_TextFieldName::turnText);
- msg_params[strings::turn_list]
- [i][hmi_request::navi_text][hmi_request::field_text] =
- navigation_text;
+ msg_params[strings::turn_list][i][hmi_request::navi_text]
+ [hmi_request::field_name] = static_cast<int>(
+ hmi_apis::Common_TextFieldName::turnText);
+ msg_params[strings::turn_list][i][hmi_request::navi_text]
+ [hmi_request::field_text] = navigation_text;
}
}
}
@@ -125,14 +126,14 @@ void UpdateTurnListRequest::Run() {
msg_params[strings::app_id] = app->app_id();
if ((*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
- MessageHelper::SubscribeApplicationToSoftButton((*message_)[strings::msg_params],
- app, function_id());
+ MessageHelper::SubscribeApplicationToSoftButton(
+ (*message_)[strings::msg_params], app, function_id());
}
if ((*message_)[strings::msg_params].keyExists(strings::turn_list) ||
(*message_)[strings::msg_params].keyExists(strings::soft_buttons)) {
- SendHMIRequest(hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params,
- true);
+ SendHMIRequest(
+ hmi_apis::FunctionID::Navigation_UpdateTurnList, &msg_params, true);
} else {
// conditional mandatory
LOG4CXX_ERROR(logger_, "INVALID_DATA!");
@@ -150,20 +151,20 @@ void UpdateTurnListRequest::on_event(const event_engine::Event& event) {
mobile_apis::Result::eType result_code =
static_cast<mobile_apis::Result::eType>(
- message[strings::params][hmi_response::code].asInt());
+ message[strings::params][hmi_response::code].asInt());
HMICapabilities& hmi_capabilities =
ApplicationManagerImpl::instance()->hmi_capabilities();
- bool result = (mobile_apis::Result::SUCCESS == result_code) ||
+ bool result =
+ (mobile_apis::Result::SUCCESS == result_code) ||
((mobile_apis::Result::UNSUPPORTED_RESOURCE == result_code) &&
- (hmi_capabilities.is_ui_cooperating()));
-
+ (hmi_capabilities.is_ui_cooperating()));
SendResponse(result, result_code, NULL, &(message[strings::msg_params]));
break;
}
default: {
- LOG4CXX_ERROR(logger_,"Received unknown event" << event.id());
+ LOG4CXX_ERROR(logger_, "Received unknown event" << event.id());
break;
}
}
@@ -177,10 +178,10 @@ bool UpdateTurnListRequest::CheckTurnListArray() {
}
for (int32_t i = 0; i < length; ++i) {
- if (!((*message_)[strings::msg_params][strings::turn_list][i].
- keyExists(hmi_request::navi_text)) &&
- !((*message_)[strings::msg_params][strings::turn_list][i].
- keyExists(strings::turn_icon))) {
+ if (!((*message_)[strings::msg_params][strings::turn_list][i].keyExists(
+ hmi_request::navi_text)) &&
+ !((*message_)[strings::msg_params][strings::turn_list][i].keyExists(
+ strings::turn_icon))) {
return false;
}
}
@@ -202,7 +203,8 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() {
if ((*it_tl).keyExists(strings::navigation_text)) {
str = (*it_tl)[strings::navigation_text].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
+ LOG4CXX_ERROR(
+ logger_,
"Invalid turn_list navigation_text text syntax check failed");
return true;
}
@@ -211,12 +213,11 @@ bool UpdateTurnListRequest::IsWhiteSpaceExist() {
if ((*it_tl).keyExists(strings::turn_icon)) {
str = (*it_tl)[strings::turn_icon][strings::value].asCharArray();
if (!CheckSyntax(str)) {
- LOG4CXX_ERROR(logger_,
- "Invalid turn_list turn_icon value syntax check failed");
+ LOG4CXX_ERROR(
+ logger_, "Invalid turn_list turn_icon value syntax check failed");
return true;
}
}
-
}
}
return false;
diff --git a/src/components/application_manager/src/event_engine/event.cc b/src/components/application_manager/src/event_engine/event.cc
index 561e8a841f..874716cc9c 100644
--- a/src/components/application_manager/src/event_engine/event.cc
+++ b/src/components/application_manager/src/event_engine/event.cc
@@ -31,7 +31,7 @@
*/
#include "application_manager/event_engine/event.h"
-#include "application_manager/event_engine/event_dispatcher.h"
+#include "application_manager/event_engine/event_dispatcher_impl.h"
namespace application_manager {
namespace event_engine {
@@ -45,12 +45,12 @@ Event::~Event() {
}
void Event::raise() {
- EventDispatcher::instance()->raise_event(*this);
+ EventDispatcherImpl::instance()->raise_event(*this);
}
void Event::set_smart_object(const smart_objects::SmartObject& so) {
response_so_ = so;
}
-}
-}
+} // namespace event_engine
+} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_dispatcher.cc b/src/components/application_manager/src/event_engine/event_dispatcher.cc
deleted file mode 100644
index bac94431f0..0000000000
--- a/src/components/application_manager/src/event_engine/event_dispatcher.cc
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- Copyright (c) 2013, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "interfaces/HMI_API.h"
-#include "application_manager/event_engine/event_observer.h"
-#include "application_manager/event_engine/event_dispatcher.h"
-
-namespace application_manager {
-namespace event_engine {
-using namespace sync_primitives;
-
-EventDispatcher::EventDispatcher()
- : observer_list_lock_(true),
- observers_() {
-}
-
-EventDispatcher::~EventDispatcher() {
-}
-
-void EventDispatcher::raise_event(const Event& event) {
- {
- AutoLock auto_lock(state_lock_);
- // check if event is notification
- if (hmi_apis::messageType::notification == event.smart_object_type()) {
- const uint32_t notification_correlation_id = 0;
- observers_list_ = observers_[event.id()][notification_correlation_id];
- }
-
- if (hmi_apis::messageType::response == event.smart_object_type()
- || hmi_apis::messageType::error_response == event.smart_object_type()) {
- observers_list_ = observers_[event.id()][event.smart_object_correlation_id()];
- }
- }
-
- // Call observers
- EventObserver* temp;
- while (observers_list_.size() > 0) {
- observer_list_lock_.Acquire();
- if (!observers_list_.empty()) {
- temp = observers_list_.front();
- observers_list_.pop_front();
- temp->on_event(event);
- }
- observer_list_lock_.Release();
- }
-}
-
-void EventDispatcher::add_observer(const Event::EventID& event_id,
- int32_t hmi_correlation_id,
- EventObserver* const observer) {
- AutoLock auto_lock(state_lock_);
- observers_[event_id][hmi_correlation_id].push_back(observer);
-}
-
-void EventDispatcher::remove_observer(const Event::EventID& event_id,
- EventObserver* const observer) {
- remove_observer_from_list(observer);
- AutoLock auto_lock(state_lock_);
- ObserversMap::iterator it = observers_[event_id].begin();
- for (; observers_[event_id].end() != it; ++it) {
-
- //ObserverList iterator
- ObserverList::iterator observer_it = it->second.begin();
- while (it->second.end() != observer_it) {
- if (observer->id() == (*observer_it)->id()) {
- observer_it = it->second.erase(observer_it);
- } else {
- ++observer_it;
- }
- }
- }
-}
-
-void EventDispatcher::remove_observer(EventObserver* const observer) {
- remove_observer_from_list(observer);
- AutoLock auto_lock(state_lock_);
- EventObserverMap::iterator event_map = observers_.begin();
- for (; observers_.end() != event_map; ++event_map) {
- ObserversMap::iterator it = event_map->second.begin();
- for (; event_map->second.end() != it; ++it) {
-
- //ObserverList iterator
- ObserverList::iterator observer_it = it->second.begin();
- while (it->second.end() != observer_it) {
- if (observer->id() == (*observer_it)->id()) {
- observer_it = it->second.erase(observer_it);
- } else {
- ++observer_it;
- }
- }
- }
- }
-}
-
-void EventDispatcher::remove_observer_from_list(EventObserver* const observer) {
- AutoLock auto_lock(observer_list_lock_);
- if (!observers_list_.empty()) {
- ObserverList::iterator it_begin = observers_list_.begin();
- for(; it_begin != observers_list_.end(); ++it_begin) {
- if ((*it_begin)->id() == observer->id()) {
- it_begin = observers_list_.erase(it_begin);
- }
- }
- }
-}
-
-} // namespace event_engine
-
-}// namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
new file mode 100644
index 0000000000..cb7b822246
--- /dev/null
+++ b/src/components/application_manager/src/event_engine/event_dispatcher_impl.cc
@@ -0,0 +1,126 @@
+/*
+ Copyright (c) 2016, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/event_engine/event_dispatcher_impl.h"
+#include "interfaces/HMI_API.h"
+#include "application_manager/event_engine/event_observer.h"
+#include <algorithm>
+
+namespace application_manager {
+namespace event_engine {
+using namespace sync_primitives;
+
+EventDispatcherImpl::EventDispatcherImpl()
+ : state_lock_(false), observer_lock_(true), observers_event_() {}
+
+EventDispatcherImpl::~EventDispatcherImpl() {}
+
+void EventDispatcherImpl::raise_event(const Event& event) {
+ {
+ AutoLock auto_lock(state_lock_);
+ // check if event is notification
+ if (hmi_apis::messageType::notification == event.smart_object_type()) {
+ const uint32_t notification_correlation_id = 0;
+ observers_ = observers_event_[event.id()][notification_correlation_id];
+ }
+
+ if (hmi_apis::messageType::response == event.smart_object_type() ||
+ hmi_apis::messageType::error_response == event.smart_object_type()) {
+ observers_ =
+ observers_event_[event.id()][event.smart_object_correlation_id()];
+ }
+ }
+
+ // Call observers
+ EventObserver* temp;
+ while (!observers_.empty()) {
+ AutoLock auto_lock(observer_lock_);
+ temp = *observers_.begin();
+ observers_.erase(observers_.begin());
+ temp->on_event(event);
+ }
+}
+
+void EventDispatcherImpl::add_observer(const Event::EventID& event_id,
+ int32_t hmi_correlation_id,
+ EventObserver* const observer) {
+ AutoLock auto_lock(state_lock_);
+ observers_event_[event_id][hmi_correlation_id].push_back(observer);
+}
+
+struct IdCheckFunctor {
+ IdCheckFunctor(const unsigned long id) : target_id(id) {}
+
+ bool operator()(const EventObserver* obs) const {
+ return (obs->id() == target_id);
+ }
+
+ private:
+ const unsigned long target_id;
+};
+
+void EventDispatcherImpl::remove_observer(const Event::EventID& event_id,
+ EventObserver* const observer) {
+ remove_observer_from_vector(observer);
+ AutoLock auto_lock(state_lock_);
+ ObserversMap::iterator it = observers_event_[event_id].begin();
+
+ for (; observers_event_[event_id].end() != it; ++it) {
+ ObserverVector& obs_vec = it->second;
+ const ObserverVector::iterator obs_vec_it = obs_vec.end();
+ obs_vec.erase(
+ std::remove_if(obs_vec.begin(), obs_vec_it, IdCheckFunctor(observer->id())),
+ obs_vec_it);
+ }
+}
+
+void EventDispatcherImpl::remove_observer(EventObserver* const observer) {
+ remove_observer_from_vector(observer);
+ EventObserverMap::iterator event_map = observers_event_.begin();
+
+ for (; observers_event_.end() != event_map; ++event_map) {
+ remove_observer(event_map->first, observer);
+ }
+}
+
+void EventDispatcherImpl::remove_observer_from_vector(
+ EventObserver* const observer) {
+ AutoLock auto_lock(observer_lock_);
+
+ observers_.erase(
+ std::remove_if(observers_.begin(), observers_.end(),
+ IdCheckFunctor(observer->id())),
+ observers_.end());
+}
+
+} // namespace event_engine
+} // namespace application_manager
diff --git a/src/components/application_manager/src/event_engine/event_observer.cc b/src/components/application_manager/src/event_engine/event_observer.cc
index c6d81529f9..bb29eea3b2 100644
--- a/src/components/application_manager/src/event_engine/event_observer.cc
+++ b/src/components/application_manager/src/event_engine/event_observer.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -30,8 +30,8 @@
POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager/event_engine/event.h"
#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/event_engine/event.h"
namespace application_manager {
namespace event_engine {
@@ -48,16 +48,16 @@ EventObserver::~EventObserver() {
void EventObserver::subscribe_on_event(const Event::EventID& event_id,
int32_t hmi_correlation_id) {
- EventDispatcher::instance()->add_observer(event_id, hmi_correlation_id, this);
+ EventDispatcherImpl::instance()->add_observer(event_id, hmi_correlation_id, this);
}
void EventObserver::unsubscribe_from_event(const Event::EventID& event_id) {
- EventDispatcher::instance()->remove_observer(event_id, this);
+ EventDispatcherImpl::instance()->remove_observer(event_id, this);
}
void EventObserver::unsubscribe_from_all_events() {
- EventDispatcher::instance()->remove_observer(this);
+ EventDispatcherImpl::instance()->remove_observer(this);
}
-}
-}
+} // namespace event_engine
+} // namespace application_manager
diff --git a/src/components/application_manager/src/hmi_capabilities.cc b/src/components/application_manager/src/hmi_capabilities.cc
index 5c7f3f0b5d..96d4a39aeb 100644
--- a/src/components/application_manager/src/hmi_capabilities.cc
+++ b/src/components/application_manager/src/hmi_capabilities.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -42,13 +42,14 @@
#include "application_manager/smart_object_keys.h"
#include "application_manager/message_helper.h"
#include "application_manager/application_manager_impl.h"
-#include "formatters/CFormatterJsonBase.hpp"
+#include "application_manager/message_helper.h"
+#include "formatters/CFormatterJsonBase.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
namespace application_manager {
namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-CREATE_LOGGERPTR_GLOBAL(logger_, "HMICapabilities")
-
std::map<std::string, hmi_apis::Common_VrCapabilities::eType> vr_enum_capabilities =
{
{"TEXT", hmi_apis::Common_VrCapabilities::VR_TEXT}
@@ -76,103 +77,102 @@ std::map<std::string, hmi_apis::Common_ButtonName::eType> button_enum_name =
};
-std::map<std::string, hmi_apis::Common_TextFieldName::eType> text_fields_enum_name =
-{
+std::map<std::string,
+ hmi_apis::Common_TextFieldName::eType> text_fields_enum_name = {
{"mainField1", hmi_apis::Common_TextFieldName::mainField1},
{"mainField2", hmi_apis::Common_TextFieldName::mainField2},
{"mainField3", hmi_apis::Common_TextFieldName::mainField3},
{"mainField4", hmi_apis::Common_TextFieldName::mainField4},
- {"statusBar" , hmi_apis::Common_TextFieldName::statusBar},
+ {"statusBar", hmi_apis::Common_TextFieldName::statusBar},
{"mediaClock", hmi_apis::Common_TextFieldName::mediaClock},
{"mediaTrack", hmi_apis::Common_TextFieldName::mediaTrack},
{"alertText1", hmi_apis::Common_TextFieldName::alertText1},
{"alertText2", hmi_apis::Common_TextFieldName::alertText2},
{"alertText3", hmi_apis::Common_TextFieldName::alertText3},
- {"scrollableMessageBody" , hmi_apis::Common_TextFieldName::scrollableMessageBody},
- {"initialInteractionText", hmi_apis::Common_TextFieldName::initialInteractionText},
- {"navigationText1" , hmi_apis::Common_TextFieldName::navigationText1},
- {"navigationText2" , hmi_apis::Common_TextFieldName::navigationText2},
- {"ETA" , hmi_apis::Common_TextFieldName::ETA},
- {"totalDistance" , hmi_apis::Common_TextFieldName::totalDistance},
- {"audioPassThruDisplayText1", hmi_apis::Common_TextFieldName::audioPassThruDisplayText1},
- {"audioPassThruDisplayText2", hmi_apis::Common_TextFieldName::audioPassThruDisplayText2},
- {"sliderHeader" , hmi_apis::Common_TextFieldName::sliderHeader},
- {"sliderFooter" , hmi_apis::Common_TextFieldName::sliderFooter},
- {"notificationText" , hmi_apis::Common_TextFieldName::notificationText},
- {"menuName" , hmi_apis::Common_TextFieldName::menuName},
- {"secondaryText" , hmi_apis::Common_TextFieldName::secondaryText},
- {"tertiaryText" , hmi_apis::Common_TextFieldName::tertiaryText},
+ {"scrollableMessageBody",
+ hmi_apis::Common_TextFieldName::scrollableMessageBody},
+ {"initialInteractionText",
+ hmi_apis::Common_TextFieldName::initialInteractionText},
+ {"navigationText1", hmi_apis::Common_TextFieldName::navigationText1},
+ {"navigationText2", hmi_apis::Common_TextFieldName::navigationText2},
+ {"ETA", hmi_apis::Common_TextFieldName::ETA},
+ {"totalDistance", hmi_apis::Common_TextFieldName::totalDistance},
+ {"audioPassThruDisplayText1",
+ hmi_apis::Common_TextFieldName::audioPassThruDisplayText1},
+ {"audioPassThruDisplayText2",
+ hmi_apis::Common_TextFieldName::audioPassThruDisplayText2},
+ {"sliderHeader", hmi_apis::Common_TextFieldName::sliderHeader},
+ {"sliderFooter", hmi_apis::Common_TextFieldName::sliderFooter},
+ {"notificationText", hmi_apis::Common_TextFieldName::notificationText},
+ {"menuName", hmi_apis::Common_TextFieldName::menuName},
+ {"secondaryText", hmi_apis::Common_TextFieldName::secondaryText},
+ {"tertiaryText", hmi_apis::Common_TextFieldName::tertiaryText},
{"timeToDestination", hmi_apis::Common_TextFieldName::timeToDestination},
- {"locationName" , hmi_apis::Common_TextFieldName::locationName},
- {"locationDescription", hmi_apis::Common_TextFieldName::locationDescription},
- {"addressLines" , hmi_apis::Common_TextFieldName::turnText},
- {"turnText" , hmi_apis::Common_TextFieldName::addressLines},
- {"phoneNumber" , hmi_apis::Common_TextFieldName::phoneNumber},
- {"turnText" , hmi_apis::Common_TextFieldName::turnText},
- {"menuTitle" , hmi_apis::Common_TextFieldName::menuTitle},
+ {"locationName", hmi_apis::Common_TextFieldName::locationName},
+ {"locationDescription",
+ hmi_apis::Common_TextFieldName::locationDescription},
+ {"addressLines", hmi_apis::Common_TextFieldName::turnText},
+ {"turnText", hmi_apis::Common_TextFieldName::addressLines},
+ {"phoneNumber", hmi_apis::Common_TextFieldName::phoneNumber},
+ {"turnText", hmi_apis::Common_TextFieldName::turnText},
+ {"menuTitle", hmi_apis::Common_TextFieldName::menuTitle},
+ {"navigationText", hmi_apis::Common_TextFieldName::navigationText},
};
-std::map<std::string, hmi_apis::Common_MediaClockFormat::eType> media_clock_enum_name =
-{
- {"CLOCK1" , hmi_apis::Common_MediaClockFormat::CLOCK1},
- {"CLOCK2" , hmi_apis::Common_MediaClockFormat::CLOCK2},
- {"CLOCK3" , hmi_apis::Common_MediaClockFormat::CLOCK3},
- {"CLOCKTEXT1", hmi_apis::Common_MediaClockFormat::CLOCKTEXT1},
- {"CLOCKTEXT2", hmi_apis::Common_MediaClockFormat::CLOCKTEXT2},
- {"CLOCKTEXT3", hmi_apis::Common_MediaClockFormat::CLOCKTEXT3},
- {"CLOCKTEXT4", hmi_apis::Common_MediaClockFormat::CLOCKTEXT4},
+std::map<std::string, hmi_apis::Common_MediaClockFormat::eType>
+ media_clock_enum_name = {
+ {"CLOCK1", hmi_apis::Common_MediaClockFormat::CLOCK1},
+ {"CLOCK2", hmi_apis::Common_MediaClockFormat::CLOCK2},
+ {"CLOCK3", hmi_apis::Common_MediaClockFormat::CLOCK3},
+ {"CLOCKTEXT1", hmi_apis::Common_MediaClockFormat::CLOCKTEXT1},
+ {"CLOCKTEXT2", hmi_apis::Common_MediaClockFormat::CLOCKTEXT2},
+ {"CLOCKTEXT3", hmi_apis::Common_MediaClockFormat::CLOCKTEXT3},
+ {"CLOCKTEXT4", hmi_apis::Common_MediaClockFormat::CLOCKTEXT4},
};
-std::map<std::string, hmi_apis::Common_ImageType::eType> image_type_enum =
-{
- {"STATIC" , hmi_apis::Common_ImageType::STATIC},
- {"DYNAMIC", hmi_apis::Common_ImageType::DYNAMIC}
-};
+std::map<std::string, hmi_apis::Common_ImageType::eType> image_type_enum = {
+ {"STATIC", hmi_apis::Common_ImageType::STATIC},
+ {"DYNAMIC", hmi_apis::Common_ImageType::DYNAMIC}};
std::map<std::string, hmi_apis::Common_SamplingRate::eType> sampling_rate_enum =
-{
- {"8KHZ" , hmi_apis::Common_SamplingRate::RATE_8KHZ},
- {"16KHZ", hmi_apis::Common_SamplingRate::RATE_16KHZ},
- {"22KHZ", hmi_apis::Common_SamplingRate::RATE_22KHZ},
- {"44KHZ", hmi_apis::Common_SamplingRate::RATE_44KHZ}
-};
-
-std::map<std::string, hmi_apis::Common_BitsPerSample::eType> bit_per_sample_enum =
-{
- {"RATE_8_BIT", hmi_apis::Common_BitsPerSample::RATE_8_BIT},
- {"RATE_16_BIT", hmi_apis::Common_BitsPerSample::RATE_16_BIT}
-};
-
-std::map<std::string, hmi_apis::Common_AudioType::eType> audio_type_enum =
-{
- {"PCM", hmi_apis::Common_AudioType::PCM}
-};
-
-std::map<std::string, hmi_apis::Common_HmiZoneCapabilities::eType> hmi_zone_enum =
-{
- {"FRONT", hmi_apis::Common_HmiZoneCapabilities::FRONT},
- {"BACK", hmi_apis::Common_HmiZoneCapabilities::BACK},
+ {{"8KHZ", hmi_apis::Common_SamplingRate::RATE_8KHZ},
+ {"16KHZ", hmi_apis::Common_SamplingRate::RATE_16KHZ},
+ {"22KHZ", hmi_apis::Common_SamplingRate::RATE_22KHZ},
+ {"44KHZ", hmi_apis::Common_SamplingRate::RATE_44KHZ}};
+
+std::map<std::string, hmi_apis::Common_BitsPerSample::eType>
+ bit_per_sample_enum = {
+ {"RATE_8_BIT", hmi_apis::Common_BitsPerSample::RATE_8_BIT},
+ {"RATE_16_BIT", hmi_apis::Common_BitsPerSample::RATE_16_BIT}};
+
+std::map<std::string, hmi_apis::Common_AudioType::eType> audio_type_enum = {
+ {"PCM", hmi_apis::Common_AudioType::PCM}};
+
+std::map<std::string, hmi_apis::Common_HmiZoneCapabilities::eType>
+ hmi_zone_enum = {
+ {"FRONT", hmi_apis::Common_HmiZoneCapabilities::FRONT},
+ {"BACK", hmi_apis::Common_HmiZoneCapabilities::BACK},
};
const std::map<std::string, hmi_apis::Common_ImageFieldName::eType>
-image_field_name_enum =
-{
- {"softButtonImage", hmi_apis::Common_ImageFieldName::softButtonImage},
- {"choiceImage", hmi_apis::Common_ImageFieldName::choiceImage},
- {"choiceSecondaryImage", hmi_apis::Common_ImageFieldName::choiceSecondaryImage},
- {"vrHelpItem", hmi_apis::Common_ImageFieldName::vrHelpItem},
- {"turnIcon", hmi_apis::Common_ImageFieldName::turnIcon},
- {"menuIcon", hmi_apis::Common_ImageFieldName::menuIcon},
- {"cmdIcon", hmi_apis::Common_ImageFieldName::cmdIcon},
- {"appIcon", hmi_apis::Common_ImageFieldName::appIcon},
- {"graphic", hmi_apis::Common_ImageFieldName::graphic},
- {"showConstantTBTIcon", hmi_apis::Common_ImageFieldName::showConstantTBTIcon},
- {"showConstantTBTNextTurnIcon",
- hmi_apis::Common_ImageFieldName::showConstantTBTNextTurnIcon}
-};
-
-const std::map<std::string, hmi_apis::Common_FileType::eType> file_type_enum =
-{
+ image_field_name_enum = {
+ {"softButtonImage", hmi_apis::Common_ImageFieldName::softButtonImage},
+ {"choiceImage", hmi_apis::Common_ImageFieldName::choiceImage},
+ {"choiceSecondaryImage",
+ hmi_apis::Common_ImageFieldName::choiceSecondaryImage},
+ {"vrHelpItem", hmi_apis::Common_ImageFieldName::vrHelpItem},
+ {"turnIcon", hmi_apis::Common_ImageFieldName::turnIcon},
+ {"menuIcon", hmi_apis::Common_ImageFieldName::menuIcon},
+ {"cmdIcon", hmi_apis::Common_ImageFieldName::cmdIcon},
+ {"appIcon", hmi_apis::Common_ImageFieldName::appIcon},
+ {"graphic", hmi_apis::Common_ImageFieldName::graphic},
+ {"showConstantTBTIcon",
+ hmi_apis::Common_ImageFieldName::showConstantTBTIcon},
+ {"showConstantTBTNextTurnIcon",
+ hmi_apis::Common_ImageFieldName::showConstantTBTNextTurnIcon},
+ {"locationImage", hmi_apis::Common_ImageFieldName::locationImage}};
+
+const std::map<std::string, hmi_apis::Common_FileType::eType> file_type_enum = {
{"GRAPHIC_BMP", hmi_apis::Common_FileType::GRAPHIC_BMP},
{"GRAPHIC_JPEG", hmi_apis::Common_FileType::GRAPHIC_JPEG},
{"GRAPHIC_PNG", hmi_apis::Common_FileType::GRAPHIC_PNG},
@@ -180,63 +180,58 @@ const std::map<std::string, hmi_apis::Common_FileType::eType> file_type_enum =
{"AUDIO_MP3", hmi_apis::Common_FileType::AUDIO_MP3},
{"AUDIO_AAC", hmi_apis::Common_FileType::AUDIO_AAC},
{"BINARY", hmi_apis::Common_FileType::BINARY},
- {"JSON", hmi_apis::Common_FileType::JSON}
-};
-
-const std::map<std::string, hmi_apis::Common_DisplayType::eType> display_type_enum =
-{
- {"CID", hmi_apis::Common_DisplayType::CID},
- {"TYPE2", hmi_apis::Common_DisplayType::TYPE2},
- {"TYPE5", hmi_apis::Common_DisplayType::TYPE5},
- {"NGN", hmi_apis::Common_DisplayType::NGN},
- {"GEN2_8_DMA", hmi_apis::Common_DisplayType::GEN2_8_DMA},
- {"GEN2_6_DMA", hmi_apis::Common_DisplayType::GEN2_6_DMA},
- {"MFD3", hmi_apis::Common_DisplayType::MFD3},
- {"MFD4", hmi_apis::Common_DisplayType::MFD4},
- {"MFD5", hmi_apis::Common_DisplayType::MFD5},
- {"GEN3_8_INCH", hmi_apis::Common_DisplayType::GEN3_8_INCH}
-};
-
-const std::map<std::string, hmi_apis::Common_CharacterSet::eType> character_set_enum =
-{
- {"TYPE2SET" , hmi_apis::Common_CharacterSet::TYPE2SET},
- {"TYPE5SET" , hmi_apis::Common_CharacterSet::TYPE5SET},
- {"CID1SET" , hmi_apis::Common_CharacterSet::CID1SET},
- {"CID2SET" , hmi_apis::Common_CharacterSet::CID2SET}
-};
+ {"JSON", hmi_apis::Common_FileType::JSON}};
+
+const std::map<std::string, hmi_apis::Common_DisplayType::eType>
+ display_type_enum = {
+ {"CID", hmi_apis::Common_DisplayType::CID},
+ {"TYPE2", hmi_apis::Common_DisplayType::TYPE2},
+ {"TYPE5", hmi_apis::Common_DisplayType::TYPE5},
+ {"NGN", hmi_apis::Common_DisplayType::NGN},
+ {"GEN2_8_DMA", hmi_apis::Common_DisplayType::GEN2_8_DMA},
+ {"GEN2_6_DMA", hmi_apis::Common_DisplayType::GEN2_6_DMA},
+ {"MFD3", hmi_apis::Common_DisplayType::MFD3},
+ {"MFD4", hmi_apis::Common_DisplayType::MFD4},
+ {"MFD5", hmi_apis::Common_DisplayType::MFD5},
+ {"GEN3_8_INCH", hmi_apis::Common_DisplayType::GEN3_8_INCH}};
+
+const std::map<std::string, hmi_apis::Common_CharacterSet::eType>
+ character_set_enum = {{"TYPE2SET", hmi_apis::Common_CharacterSet::TYPE2SET},
+ {"TYPE5SET", hmi_apis::Common_CharacterSet::TYPE5SET},
+ {"CID1SET", hmi_apis::Common_CharacterSet::CID1SET},
+ {"CID2SET", hmi_apis::Common_CharacterSet::CID2SET}};
HMICapabilities::HMICapabilities(ApplicationManagerImpl* const app_mngr)
- : is_vr_cooperating_(false),
- is_tts_cooperating_(false),
- is_ui_cooperating_(false),
- is_navi_cooperating_(false),
- is_ivi_cooperating_(false),
- is_vr_ready_response_recieved_(false),
- is_tts_ready_response_recieved_(false),
- is_ui_ready_response_recieved_(false),
- is_navi_ready_response_recieved_(false),
- is_ivi_ready_response_recieved_(false),
- attenuated_supported_(false),
- ui_language_(hmi_apis::Common_Language::INVALID_ENUM),
- vr_language_(hmi_apis::Common_Language::INVALID_ENUM),
- tts_language_(hmi_apis::Common_Language::INVALID_ENUM),
- vehicle_type_(NULL),
- ui_supported_languages_(NULL),
- tts_supported_languages_(NULL),
- vr_supported_languages_(NULL),
- display_capabilities_(NULL),
- hmi_zone_capabilities_(NULL),
- soft_buttons_capabilities_(NULL),
- button_capabilities_(NULL),
- preset_bank_capabilities_(NULL),
- vr_capabilities_(NULL),
- speech_capabilities_(NULL),
- audio_pass_thru_capabilities_(NULL),
- prerecorded_speech_(NULL),
- is_navigation_supported_(false),
- is_phone_call_supported_(false),
- app_mngr_(app_mngr) {
-
+ : is_vr_cooperating_(false)
+ , is_tts_cooperating_(false)
+ , is_ui_cooperating_(false)
+ , is_navi_cooperating_(false)
+ , is_ivi_cooperating_(false)
+ , is_vr_ready_response_recieved_(false)
+ , is_tts_ready_response_recieved_(false)
+ , is_ui_ready_response_recieved_(false)
+ , is_navi_ready_response_recieved_(false)
+ , is_ivi_ready_response_recieved_(false)
+ , attenuated_supported_(false)
+ , ui_language_(hmi_apis::Common_Language::INVALID_ENUM)
+ , vr_language_(hmi_apis::Common_Language::INVALID_ENUM)
+ , tts_language_(hmi_apis::Common_Language::INVALID_ENUM)
+ , vehicle_type_(NULL)
+ , ui_supported_languages_(NULL)
+ , tts_supported_languages_(NULL)
+ , vr_supported_languages_(NULL)
+ , display_capabilities_(NULL)
+ , hmi_zone_capabilities_(NULL)
+ , soft_buttons_capabilities_(NULL)
+ , button_capabilities_(NULL)
+ , preset_bank_capabilities_(NULL)
+ , vr_capabilities_(NULL)
+ , speech_capabilities_(NULL)
+ , audio_pass_thru_capabilities_(NULL)
+ , prerecorded_speech_(NULL)
+ , is_navigation_supported_(false)
+ , is_phone_call_supported_(false)
+ , app_mngr_(app_mngr) {
if (false == load_capabilities_from_file()) {
LOG4CXX_ERROR(logger_, "file hmi_capabilities.json was not loaded");
} else {
@@ -255,6 +250,9 @@ HMICapabilities::HMICapabilities(ApplicationManagerImpl* const app_mngr)
is_navi_cooperating_ = true;
is_ivi_cooperating_ = true;
}
+
+ hmi_language_handler_.set_default_capabilities_languages(
+ ui_language_, vr_language_, tts_language_);
}
HMICapabilities::~HMICapabilities() {
@@ -277,9 +275,9 @@ HMICapabilities::~HMICapabilities() {
bool HMICapabilities::is_hmi_capabilities_initialized() const {
bool result = true;
- if (is_vr_ready_response_recieved_ && is_tts_ready_response_recieved_
- && is_ui_ready_response_recieved_ && is_navi_ready_response_recieved_
- && is_ivi_ready_response_recieved_) {
+ if (is_vr_ready_response_recieved_ && is_tts_ready_response_recieved_ &&
+ is_ui_ready_response_recieved_ && is_navi_ready_response_recieved_ &&
+ is_ivi_ready_response_recieved_) {
if (is_vr_cooperating_) {
if ((!vr_supported_languages_) ||
(hmi_apis::Common_Language::INVALID_ENUM == vr_language_)) {
@@ -295,9 +293,9 @@ bool HMICapabilities::is_hmi_capabilities_initialized() const {
}
if (is_ui_cooperating_) {
- if ((!ui_supported_languages_) ||
+ if ((!ui_supported_languages_) ||
(hmi_apis::Common_Language::INVALID_ENUM == ui_language_)) {
- result = false;
+ result = false;
}
}
@@ -319,8 +317,8 @@ bool HMICapabilities::VerifyImageType(int32_t image_type) const {
}
if (display_capabilities_->keyExists(hmi_response::image_capabilities)) {
- const smart_objects::SmartObject& image_caps = display_capabilities_
- ->getElement(hmi_response::image_capabilities);
+ const smart_objects::SmartObject& image_caps =
+ display_capabilities_->getElement(hmi_response::image_capabilities);
for (uint32_t i = 0; i < image_caps.length(); ++i) {
if (image_caps.getElement(i).asInt() == image_type) {
return true;
@@ -337,12 +335,15 @@ void HMICapabilities::set_is_vr_cooperating(bool value) {
if (is_vr_cooperating_) {
utils::SharedPtr<smart_objects::SmartObject> get_language(
MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetLanguage));
+ hmi_language_handler_.set_handle_response_for(*get_language);
app_mngr_->ManageHMICommand(get_language);
utils::SharedPtr<smart_objects::SmartObject> get_all_languages(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetSupportedLanguages));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VR_GetSupportedLanguages));
app_mngr_->ManageHMICommand(get_all_languages);
utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(hmi_apis::FunctionID::VR_GetCapabilities));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VR_GetCapabilities));
app_mngr_->ManageHMICommand(get_capabilities);
}
}
@@ -354,14 +355,15 @@ void HMICapabilities::set_is_tts_cooperating(bool value) {
utils::SharedPtr<smart_objects::SmartObject> get_language(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::TTS_GetLanguage));
+ hmi_language_handler_.set_handle_response_for(*get_language);
app_mngr_->ManageHMICommand(get_language);
utils::SharedPtr<smart_objects::SmartObject> get_all_languages(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::TTS_GetSupportedLanguages));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::TTS_GetSupportedLanguages));
app_mngr_->ManageHMICommand(get_all_languages);
utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::TTS_GetCapabilities));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::TTS_GetCapabilities));
app_mngr_->ManageHMICommand(get_capabilities);
}
}
@@ -373,14 +375,15 @@ void HMICapabilities::set_is_ui_cooperating(bool value) {
utils::SharedPtr<smart_objects::SmartObject> get_language(
MessageHelper::CreateModuleInfoSO(
hmi_apis::FunctionID::UI_GetLanguage));
+ hmi_language_handler_.set_handle_response_for(*get_language);
app_mngr_->ManageHMICommand(get_language);
utils::SharedPtr<smart_objects::SmartObject> get_all_languages(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::UI_GetSupportedLanguages));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::UI_GetSupportedLanguages));
app_mngr_->ManageHMICommand(get_all_languages);
utils::SharedPtr<smart_objects::SmartObject> get_capabilities(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::UI_GetCapabilities));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::UI_GetCapabilities));
app_mngr_->ManageHMICommand(get_capabilities);
}
}
@@ -395,8 +398,8 @@ void HMICapabilities::set_is_ivi_cooperating(bool value) {
is_ivi_cooperating_ = value;
if (is_ivi_cooperating_) {
utils::SharedPtr<smart_objects::SmartObject> get_type(
- MessageHelper::CreateModuleInfoSO(
- hmi_apis::FunctionID::VehicleInfo_GetVehicleType));
+ MessageHelper::CreateModuleInfoSO(
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleType));
app_mngr_->ManageHMICommand(get_type);
}
}
@@ -406,18 +409,48 @@ void HMICapabilities::set_attenuated_supported(bool state) {
}
void HMICapabilities::set_active_ui_language(
- const hmi_apis::Common_Language::eType& language) {
+ const hmi_apis::Common_Language::eType& language) {
ui_language_ = language;
+ hmi_language_handler_.set_language_for(HMILanguageHandler::INTERFACE_UI,
+ language);
}
void HMICapabilities::set_active_vr_language(
- const hmi_apis::Common_Language::eType& language) {
+ const hmi_apis::Common_Language::eType& language) {
vr_language_ = language;
+ hmi_language_handler_.set_language_for(HMILanguageHandler::INTERFACE_VR,
+ language);
}
void HMICapabilities::set_active_tts_language(
- const hmi_apis::Common_Language::eType& language) {
+ const hmi_apis::Common_Language::eType& language) {
tts_language_ = language;
+ hmi_language_handler_.set_language_for(HMILanguageHandler::INTERFACE_TTS,
+ language);
+}
+
+const hmi_apis::Common_Language::eType
+HMICapabilities::active_ui_language() const {
+ using namespace hmi_apis;
+ const Common_Language::eType language =
+ hmi_language_handler_.get_language_for(HMILanguageHandler::INTERFACE_UI);
+ return Common_Language::INVALID_ENUM != language ? language : ui_language_;
+}
+
+const hmi_apis::Common_Language::eType
+HMICapabilities::active_vr_language() const {
+ using namespace hmi_apis;
+ const Common_Language::eType language =
+ hmi_language_handler_.get_language_for(HMILanguageHandler::INTERFACE_VR);
+ return Common_Language::INVALID_ENUM != language ? language : vr_language_;
+}
+
+const hmi_apis::Common_Language::eType
+HMICapabilities::active_tts_language() const {
+ using namespace hmi_apis;
+ const Common_Language::eType language =
+ hmi_language_handler_.get_language_for(HMILanguageHandler::INTERFACE_TTS);
+ return Common_Language::INVALID_ENUM != language ? language : tts_language_;
}
void HMICapabilities::set_ui_supported_languages(
@@ -433,8 +466,8 @@ void HMICapabilities::set_tts_supported_languages(
if (tts_supported_languages_) {
delete tts_supported_languages_;
}
- tts_supported_languages_ = new smart_objects::SmartObject(
- supported_languages);
+ tts_supported_languages_ =
+ new smart_objects::SmartObject(supported_languages);
}
void HMICapabilities::set_vr_supported_languages(
@@ -458,8 +491,8 @@ void HMICapabilities::set_hmi_zone_capabilities(
if (hmi_zone_capabilities_) {
delete hmi_zone_capabilities_;
}
- hmi_zone_capabilities_ = new smart_objects::SmartObject(
- hmi_zone_capabilities);
+ hmi_zone_capabilities_ =
+ new smart_objects::SmartObject(hmi_zone_capabilities);
}
void HMICapabilities::set_soft_button_capabilities(
@@ -467,8 +500,8 @@ void HMICapabilities::set_soft_button_capabilities(
if (soft_buttons_capabilities_) {
delete soft_buttons_capabilities_;
}
- soft_buttons_capabilities_ = new smart_objects::SmartObject(
- soft_button_capabilities);
+ soft_buttons_capabilities_ =
+ new smart_objects::SmartObject(soft_button_capabilities);
}
void HMICapabilities::set_button_capabilities(
@@ -500,8 +533,8 @@ void HMICapabilities::set_audio_pass_thru_capabilities(
if (audio_pass_thru_capabilities_) {
delete audio_pass_thru_capabilities_;
}
- audio_pass_thru_capabilities_ = new smart_objects::SmartObject(
- audio_pass_thru_capabilities);
+ audio_pass_thru_capabilities_ =
+ new smart_objects::SmartObject(audio_pass_thru_capabilities);
}
void HMICapabilities::set_preset_bank_capabilities(
@@ -509,12 +542,12 @@ void HMICapabilities::set_preset_bank_capabilities(
if (preset_bank_capabilities_) {
delete preset_bank_capabilities_;
}
- preset_bank_capabilities_ = new smart_objects::SmartObject(
- preset_bank_capabilities);
+ preset_bank_capabilities_ =
+ new smart_objects::SmartObject(preset_bank_capabilities);
}
void HMICapabilities::set_vehicle_type(
- const smart_objects::SmartObject& vehicle_type) {
+ const smart_objects::SmartObject& vehicle_type) {
if (vehicle_type_) {
delete vehicle_type_;
}
@@ -522,7 +555,7 @@ void HMICapabilities::set_vehicle_type(
}
void HMICapabilities::set_prerecorded_speech(
- const smart_objects::SmartObject& prerecorded_speech) {
+ const smart_objects::SmartObject& prerecorded_speech) {
if (prerecorded_speech_) {
delete prerecorded_speech_;
prerecorded_speech_ = NULL;
@@ -530,6 +563,10 @@ void HMICapabilities::set_prerecorded_speech(
prerecorded_speech_ = new smart_objects::SmartObject(prerecorded_speech);
}
+void HMICapabilities::set_ccpu_version(const std::string& ccpu_version) {
+ ccpu_version_ = ccpu_version;
+}
+
void HMICapabilities::set_navigation_supported(bool supported) {
is_navigation_supported_ = supported;
}
@@ -538,10 +575,6 @@ void HMICapabilities::set_phone_call_supported(bool supported) {
is_phone_call_supported_ = supported;
}
-void HMICapabilities::set_ccpu_version(const std::string& ccpu_version) {
- ccpu_version_ = ccpu_version;
-}
-
bool HMICapabilities::load_capabilities_from_file() {
std::string json_string;
std::string file_name =
@@ -556,9 +589,8 @@ bool HMICapabilities::load_capabilities_from_file() {
}
try {
-
Json::Reader reader_;
- Json::Value root_json;
+ Json::Value root_json;
bool result = reader_.parse(json_string, root_json, false);
if (!result) {
@@ -569,7 +601,7 @@ bool HMICapabilities::load_capabilities_from_file() {
Json::Value ui = root_json.get("UI", Json::Value::null);
if (check_existing_json_member(ui, "language")) {
- const std::string lang = ui.get("language", "EN_US").asString();
+ const std::string lang = ui.get("language", "EN-US").asString();
set_active_ui_language(MessageHelper::CommonLanguageFromString(lang));
}
@@ -584,13 +616,15 @@ bool HMICapabilities::load_capabilities_from_file() {
if (check_existing_json_member(ui, "displayCapabilities")) {
smart_objects::SmartObject display_capabilities_so;
Json::Value display_capabilities = ui.get("displayCapabilities", "");
- Formatters::CFormatterJsonBase::jsonValueToObj(
- display_capabilities, display_capabilities_so);
+ Formatters::CFormatterJsonBase::jsonValueToObj(display_capabilities,
+ display_capabilities_so);
if (display_capabilities_so.keyExists(hmi_response::display_type)) {
- std::map<std::string, hmi_apis::Common_DisplayType::eType>
- ::const_iterator it = display_type_enum.find(
- (display_capabilities_so[hmi_response::display_type]).asString());
+ std::map<std::string,
+ hmi_apis::Common_DisplayType::eType>::const_iterator it =
+ display_type_enum.find(
+ (display_capabilities_so[hmi_response::display_type])
+ .asString());
display_capabilities_so.erase(hmi_response::display_type);
if (display_type_enum.end() != it) {
display_capabilities_so[hmi_response::display_type] = it->second;
@@ -602,31 +636,36 @@ bool HMICapabilities::load_capabilities_from_file() {
display_capabilities_so[hmi_response::text_fields].length();
for (uint32_t i = 0; i < len; ++i) {
-
- if ((display_capabilities_so
- [hmi_response::text_fields][i]).keyExists(strings::name)) {
- std::map<std::string, hmi_apis::Common_TextFieldName::eType>
- ::const_iterator it_text_field_name = text_fields_enum_name.find(
- display_capabilities_so[hmi_response::text_fields]
- [i][strings::name].asString());
- display_capabilities_so[hmi_response::text_fields][i].erase(strings::name);
+ if ((display_capabilities_so[hmi_response::text_fields][i])
+ .keyExists(strings::name)) {
+ std::map<std::string,
+ hmi_apis::Common_TextFieldName::eType>::const_iterator
+ it_text_field_name = text_fields_enum_name.find(
+ display_capabilities_so[hmi_response::text_fields][i]
+ [strings::name]
+ .asString());
+ display_capabilities_so[hmi_response::text_fields][i].erase(
+ strings::name);
if (text_fields_enum_name.end() != it_text_field_name) {
- display_capabilities_so[hmi_response::text_fields]
- [i][strings::name] = it_text_field_name->second;
+ display_capabilities_so[hmi_response::text_fields][i]
+ [strings::name] =
+ it_text_field_name->second;
}
}
- if ((display_capabilities_so
- [hmi_response::text_fields][i]).keyExists(strings::character_set)) {
- std::map<std::string, hmi_apis::Common_CharacterSet::eType>
- ::const_iterator it_characte_set = character_set_enum.find(
- display_capabilities_so[hmi_response::text_fields]
- [i][strings::character_set].asString());
- display_capabilities_so
- [hmi_response::text_fields][i].erase(strings::character_set);
+ if ((display_capabilities_so[hmi_response::text_fields][i])
+ .keyExists(strings::character_set)) {
+ std::map<std::string,
+ hmi_apis::Common_CharacterSet::eType>::const_iterator
+ it_characte_set = character_set_enum.find(
+ display_capabilities_so[hmi_response::text_fields][i]
+ [strings::character_set]
+ .asString());
+ display_capabilities_so[hmi_response::text_fields][i].erase(
+ strings::character_set);
if (character_set_enum.end() != it_characte_set) {
- display_capabilities_so
- [hmi_response::text_fields][i][strings::character_set] =
- it_characte_set->second;
+ display_capabilities_so[hmi_response::text_fields][i]
+ [strings::character_set] =
+ it_characte_set->second;
}
}
}
@@ -637,23 +676,28 @@ bool HMICapabilities::load_capabilities_from_file() {
display_capabilities_so[hmi_response::image_fields];
for (uint32_t i = 0; i < array_image_fields.length(); ++i) {
if (array_image_fields[i].keyExists(strings::name)) {
- std::map<std::string, hmi_apis::Common_ImageFieldName::eType>
- ::const_iterator it = image_field_name_enum.find(
- (array_image_fields[i][strings::name]).asString());
+ std::map<std::string,
+ hmi_apis::Common_ImageFieldName::eType>::const_iterator
+ it = image_field_name_enum.find(
+ (array_image_fields[i][strings::name]).asString());
array_image_fields[i].erase(strings::name);
if (image_field_name_enum.end() != it) {
array_image_fields[i][strings::name] = it->second;
}
}
- if (array_image_fields[i].keyExists(strings::image_type_supported)) {
+ if (array_image_fields[i].keyExists(
+ strings::image_type_supported)) {
smart_objects::SmartObject& image_type_supported_array =
array_image_fields[i][strings::image_type_supported];
smart_objects::SmartObject image_type_supported_enum(
smart_objects::SmartType_Array);
- for (uint32_t k = 0, j = 0; k < image_type_supported_array.length(); ++k) {
- std::map<std::string, hmi_apis::Common_FileType::eType>
- ::const_iterator it = file_type_enum.find(
- (image_type_supported_array[k]).asString());
+ for (uint32_t k = 0, j = 0;
+ k < image_type_supported_array.length();
+ ++k) {
+ std::map<std::string,
+ hmi_apis::Common_FileType::eType>::const_iterator it =
+ file_type_enum.find(
+ (image_type_supported_array[k]).asString());
if (file_type_enum.end() != it) {
image_type_supported_enum[j++] = it->second;
}
@@ -664,15 +708,18 @@ bool HMICapabilities::load_capabilities_from_file() {
}
}
}
- if (display_capabilities_so.keyExists(hmi_response::media_clock_formats)) {
+ if (display_capabilities_so.keyExists(
+ hmi_response::media_clock_formats)) {
smart_objects::SmartObject& media_clock_formats_array =
display_capabilities_so[hmi_response::media_clock_formats];
smart_objects::SmartObject media_clock_formats_enum(
smart_objects::SmartType_Array);
- for (uint32_t i = 0, j = 0; i < media_clock_formats_array.length(); ++i) {
- std::map<std::string, hmi_apis::Common_MediaClockFormat::eType>
- ::const_iterator it = media_clock_enum_name.find(
- (media_clock_formats_array[i]).asString());
+ for (uint32_t i = 0, j = 0; i < media_clock_formats_array.length();
+ ++i) {
+ std::map<std::string,
+ hmi_apis::Common_MediaClockFormat::eType>::const_iterator
+ it = media_clock_enum_name.find(
+ (media_clock_formats_array[i]).asString());
if (media_clock_enum_name.end() != it) {
media_clock_formats_enum[j++] = it->second;
}
@@ -682,15 +729,17 @@ bool HMICapabilities::load_capabilities_from_file() {
media_clock_formats_enum;
}
- if (display_capabilities_so.keyExists(hmi_response::image_capabilities)) {
+ if (display_capabilities_so.keyExists(
+ hmi_response::image_capabilities)) {
smart_objects::SmartObject& image_capabilities_array =
display_capabilities_so[hmi_response::image_capabilities];
smart_objects::SmartObject image_capabilities_enum(
smart_objects::SmartType_Array);
- for (uint32_t i = 0, j = 0; i < image_capabilities_array.length(); ++i) {
- std::map<std::string, hmi_apis::Common_ImageType::eType>
- ::const_iterator it = image_type_enum.find(
- (image_capabilities_array[i]).asString());
+ for (uint32_t i = 0, j = 0; i < image_capabilities_array.length();
+ ++i) {
+ std::map<std::string,
+ hmi_apis::Common_ImageType::eType>::const_iterator it =
+ image_type_enum.find((image_capabilities_array[i]).asString());
if (image_type_enum.end() != it) {
image_capabilities_enum[j++] = it->second;
}
@@ -703,26 +752,30 @@ bool HMICapabilities::load_capabilities_from_file() {
}
if (check_existing_json_member(ui, "audioPassThruCapabilities")) {
- Json::Value audio_capabilities = ui.get("audioPassThruCapabilities", "");
+ Json::Value audio_capabilities =
+ ui.get("audioPassThruCapabilities", "");
smart_objects::SmartObject audio_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- int32_t i = 0;
- audio_capabilities_so[i] =
+ audio_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Map);
if (check_existing_json_member(audio_capabilities, "samplingRate")) {
- audio_capabilities_so[i]["samplingRate"] =
- sampling_rate_enum.find(
- audio_capabilities.get("samplingRate", "").asString())->second;
+ audio_capabilities_so["samplingRate"] =
+ sampling_rate_enum.find(audio_capabilities.get("samplingRate", "")
+ .asString())
+ ->second;
}
if (check_existing_json_member(audio_capabilities, "bitsPerSample")) {
- audio_capabilities_so[i]["bitsPerSample"] =
+ audio_capabilities_so["bitsPerSample"] =
bit_per_sample_enum.find(
- audio_capabilities.get("bitsPerSample", "").asString())->second;
+ audio_capabilities.get("bitsPerSample", "")
+ .asString())
+ ->second;
}
if (check_existing_json_member(audio_capabilities, "audioType")) {
- audio_capabilities_so[i]["audioType"] =
- audio_type_enum.find(
- audio_capabilities.get("audioType", "").asString())->second;
+ audio_capabilities_so["audioType"] =
+ audio_type_enum.find(audio_capabilities.get("audioType", "")
+ .asString())
+ ->second;
}
set_audio_pass_thru_capabilities(audio_capabilities_so);
}
@@ -730,27 +783,27 @@ bool HMICapabilities::load_capabilities_from_file() {
if (check_existing_json_member(ui, "hmiZoneCapabilities")) {
smart_objects::SmartObject hmi_zone_capabilities_so =
smart_objects::SmartObject(smart_objects::SmartType_Array);
- int32_t index = 0;
- hmi_zone_capabilities_so[index] =
- hmi_zone_enum.find(ui.get("hmiZoneCapabilities", "").asString())->second;
+ hmi_zone_capabilities_so =
+ hmi_zone_enum.find(ui.get("hmiZoneCapabilities", "").asString())
+ ->second;
set_hmi_zone_capabilities(hmi_zone_capabilities_so);
}
if (check_existing_json_member(ui, "softButtonCapabilities")) {
- Json::Value soft_button_capabilities = ui.get(
- "softButtonCapabilities", "");
+ Json::Value soft_button_capabilities =
+ ui.get("softButtonCapabilities", "");
smart_objects::SmartObject soft_button_capabilities_so;
Formatters::CFormatterJsonBase::jsonValueToObj(
soft_button_capabilities, soft_button_capabilities_so);
set_soft_button_capabilities(soft_button_capabilities_so);
}
- } //UI end
+ } // UI end
// VR
if (check_existing_json_member(root_json, "VR")) {
Json::Value vr = root_json.get("VR", "");
if (check_existing_json_member(vr, "language")) {
- const std::string lang = vr.get("language", "").asString();
+ const std::string lang = vr.get("language", "EN-US").asString();
set_active_vr_language(MessageHelper::CommonLanguageFromString(lang));
}
@@ -772,14 +825,14 @@ bool HMICapabilities::load_capabilities_from_file() {
}
set_vr_capabilities(vr_capabilities_so);
}
- }//VR end
+ } // VR end
- //TTS
+ // TTS
if (check_existing_json_member(root_json, "TTS")) {
Json::Value tts = root_json.get("TTS", "");
if (check_existing_json_member(tts, "language")) {
- const std::string lang = tts.get("language", "").asString();
+ const std::string lang = tts.get("language", "EN-US").asString();
set_active_tts_language(MessageHelper::CommonLanguageFromString(lang));
}
@@ -795,7 +848,7 @@ bool HMICapabilities::load_capabilities_from_file() {
set_speech_capabilities(
smart_objects::SmartObject(tts.get("capabilities", "").asString()));
}
- } //TTS end
+ } // TTS end
// Buttons
if (check_existing_json_member(root_json, "Buttons")) {
@@ -803,14 +856,15 @@ bool HMICapabilities::load_capabilities_from_file() {
if (check_existing_json_member(buttons, "capabilities")) {
Json::Value bt_capabilities = buttons.get("capabilities", "");
smart_objects::SmartObject buttons_capabilities_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(
- bt_capabilities, buttons_capabilities_so);
+ Formatters::CFormatterJsonBase::jsonValueToObj(bt_capabilities,
+ buttons_capabilities_so);
for (uint32_t i = 0; i < buttons_capabilities_so.length(); ++i) {
if ((buttons_capabilities_so[i]).keyExists(strings::name)) {
- std::map<std::string, hmi_apis::Common_ButtonName::eType>
- ::const_iterator it = button_enum_name.find(
- (buttons_capabilities_so[i][strings::name]).asString());
+ std::map<std::string,
+ hmi_apis::Common_ButtonName::eType>::const_iterator it =
+ button_enum_name.find(
+ (buttons_capabilities_so[i][strings::name]).asString());
buttons_capabilities_so[i].erase(strings::name);
if (button_enum_name.end() != it) {
buttons_capabilities_so[i][strings::name] = it->second;
@@ -822,21 +876,20 @@ bool HMICapabilities::load_capabilities_from_file() {
if (check_existing_json_member(buttons, "presetBankCapabilities")) {
Json::Value presetBank = buttons.get("presetBankCapabilities", "");
smart_objects::SmartObject preset_bank_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(
- presetBank, preset_bank_so);
+ Formatters::CFormatterJsonBase::jsonValueToObj(presetBank,
+ preset_bank_so);
set_preset_bank_capabilities(preset_bank_so);
}
- } //Buttons end
+ } // Buttons end
- //VehicleType
+ // VehicleType
if (check_existing_json_member(root_json, "VehicleInfo")) {
Json::Value vehicle_info = root_json.get("VehicleInfo", "");
smart_objects::SmartObject vehicle_type_so;
- Formatters::CFormatterJsonBase::jsonValueToObj(
- vehicle_info, vehicle_type_so);
+ Formatters::CFormatterJsonBase::jsonValueToObj(vehicle_info,
+ vehicle_type_so);
set_vehicle_type(vehicle_type_so);
- }// VehicleType end
-
+ } // VehicleType end
} catch (...) {
return false;
@@ -844,16 +897,16 @@ bool HMICapabilities::load_capabilities_from_file() {
return true;
}
-bool HMICapabilities::check_existing_json_member(
- const Json::Value& json_member, const char* name_of_member) {
+bool HMICapabilities::check_existing_json_member(const Json::Value& json_member,
+ const char* name_of_member) {
return json_member.isMember(name_of_member);
}
-void HMICapabilities::convert_json_languages_to_obj(Json::Value& json_languages,
- smart_objects::SmartObject& languages) {
+void HMICapabilities::convert_json_languages_to_obj(
+ Json::Value& json_languages, smart_objects::SmartObject& languages) {
for (uint32_t i = 0, j = 0; i < json_languages.size(); ++i) {
- languages[j++] = MessageHelper::CommonLanguageFromString(
- json_languages[i].asString());
+ languages[j++] =
+ MessageHelper::CommonLanguageFromString(json_languages[i].asString());
}
}
diff --git a/src/components/application_manager/src/hmi_command_factory.cc b/src/components/application_manager/src/hmi_command_factory.cc
index f8bf47bb71..5701c67b4a 100644
--- a/src/components/application_manager/src/hmi_command_factory.cc
+++ b/src/components/application_manager/src/hmi_command_factory.cc
@@ -72,7 +72,6 @@
#include "application_manager/commands/hmi/on_resume_audio_source_notification.h"
#include "application_manager/commands/hmi/on_ignition_cycle_over_notification.h"
#include "application_manager/commands/hmi/on_system_info_changed_notification.h"
-#include "application_manager/commands/hmi/on_emergency_event_notification.h"
#include "application_manager/commands/hmi/get_system_info_request.h"
#include "application_manager/commands/hmi/get_system_info_response.h"
#include "application_manager/commands/hmi/close_popup_request.h"
@@ -156,6 +155,7 @@
#include "application_manager/commands/hmi/sdl_activate_app_request.h"
#include "application_manager/commands/hmi/sdl_activate_app_response.h"
#include "application_manager/commands/hmi/on_app_permission_changed_notification.h"
+#include "application_manager/commands/hmi/on_event_changed_notification.h"
#ifdef HMI_DBUS_API
#include "application_manager/commands/hmi/vi_get_vehicle_data_request_template.h"
@@ -216,7 +216,6 @@
#include "application_manager/commands/hmi/on_app_registered_notification.h"
#include "application_manager/commands/hmi/on_app_unregistered_notification.h"
#include "application_manager/commands/hmi/on_driver_distraction_notification.h"
-#include "application_manager/commands/hmi/on_play_tone_notification.h"
#include "application_manager/commands/hmi/on_tts_started_notification.h"
#include "application_manager/commands/hmi/on_tts_stopped_notification.h"
#include "application_manager/commands/hmi/on_vr_started_notification.h"
@@ -263,17 +262,18 @@
#include "application_manager/commands/hmi/navi_send_location_request.h"
#include "application_manager/commands/hmi/navi_send_location_response.h"
#include "application_manager/commands/hmi/on_tts_reset_timeout_notification.h"
-#include "application_manager/commands/hmi/on_phone_call_notification.h"
-
-namespace application_manager {
+#include "application_manager/commands/hmi/dial_number_request.h"
+#include "application_manager/commands/hmi/dial_number_response.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+namespace application_manager {
+
CommandSharedPtr HMICommandFactory::CreateCommand(
const commands::MessageSharedPtr& message) {
const int function_id = (*message)[strings::params][strings::function_id]
.asInt();
- LOG4CXX_INFO(logger_,
+ LOG4CXX_DEBUG(logger_,
"HMICommandFactory::CreateCommand function_id: " << function_id);
CommandSharedPtr command(
@@ -283,13 +283,13 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
const int msg_type = (*message)[strings::params][strings::message_type].asInt();
if (msg_type == static_cast<int>(application_manager::MessageType::kResponse)) {
is_response = true;
- LOG4CXX_INFO(logger_, "HMICommandFactory::CreateCommand response");
+ LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand response");
} else if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kErrorResponse)) {
is_response = true;
- LOG4CXX_INFO(logger_, "HMICommandFactory::CreateCommand error response");
+ LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand error response");
} else {
- LOG4CXX_INFO(logger_, "HMICommandFactory::CreateCommand request");
+ LOG4CXX_DEBUG(logger_, "HMICommandFactory::CreateCommand request");
}
switch (function_id) {
@@ -1089,14 +1089,6 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
command.reset(new commands::OnSystemInfoChangedNotification(message));
break;
}
- case hmi_apis::FunctionID::BasicCommunication_OnEmergencyEvent: {
- command.reset(new commands::OnEmergencyEventNotification(message));
- break;
- }
- case hmi_apis::FunctionID::BasicCommunication_PlayTone: {
- command.reset(new commands::OnPlayToneNotification(message));
- break;
- }
case hmi_apis::FunctionID::BasicCommunication_OnReady: {
command.reset(new commands::OnReadyNotification(message));
break;
@@ -2056,8 +2048,16 @@ CommandSharedPtr HMICommandFactory::CreateCommand(
command.reset(new commands::hmi::OnTTSResetTimeoutNotification(message));
break;
}
- case hmi_apis::FunctionID::BasicCommunication_OnPhoneCall: {
- command.reset(new commands::hmi::OnPhoneCallNotification(message));
+ case hmi_apis::FunctionID::BasicCommunication_DialNumber: {
+ if (is_response) {
+ command.reset(new commands::hmi::DialNumberResponse(message));
+ } else {
+ command.reset(new commands::hmi::DialNumberRequest(message));
+ }
+ break;
+ }
+ case hmi_apis::FunctionID::BasicCommunication_OnEventChanged: {
+ command.reset(new commands::OnEventChangedNotification(message));
break;
}
}
diff --git a/src/components/application_manager/src/hmi_language_handler.cc b/src/components/application_manager/src/hmi_language_handler.cc
new file mode 100644
index 0000000000..8ef9bf9479
--- /dev/null
+++ b/src/components/application_manager/src/hmi_language_handler.cc
@@ -0,0 +1,324 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include "application_manager/hmi_language_handler.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/hmi_capabilities.h"
+#include "utils/helpers.h"
+#include "resumption/last_state.h"
+
+static const std::string LanguagesKey = "Languages";
+static const std::string UIKey = "UI";
+static const std::string VRKey = "VR";
+static const std::string TTSKey = "TTS";
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+
+namespace application_manager {
+
+HMILanguageHandler::HMILanguageHandler() :
+ capabilities_ui_language_(hmi_apis::Common_Language::INVALID_ENUM),
+ capabilities_vr_language_(hmi_apis::Common_Language::INVALID_ENUM),
+ capabilities_tts_language_(hmi_apis::Common_Language::INVALID_ENUM),
+ is_ui_language_received_(false),
+ is_vr_language_received_(false),
+ is_tts_language_received_(false) {
+
+ persisted_ui_language_ = get_language_for(INTERFACE_UI);
+ persisted_vr_language_ = get_language_for(INTERFACE_VR);
+ persisted_tts_language_ = get_language_for(INTERFACE_TTS);
+
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
+}
+
+void HMILanguageHandler::set_language_for(
+ HMILanguageHandler::Interface interface,
+ hmi_apis::Common_Language::eType language) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::string key = "UNKNOWN";
+ switch (interface) {
+ case INTERFACE_UI:
+ key = UIKey;
+ break;
+ case INTERFACE_VR:
+ key = VRKey;
+ break;
+ case INTERFACE_TTS:
+ key = TTSKey;
+ break;
+ default:
+ LOG4CXX_WARN(logger_, "Unknown interface has been passed " << interface);
+ return;
+ }
+ LOG4CXX_DEBUG(logger_, "Setting language " << language
+ << " for interface " << interface);
+ resumption::LastState::instance()->dictionary[LanguagesKey][key] = language;
+ return;
+}
+
+hmi_apis::Common_Language::eType HMILanguageHandler::get_language_for(
+ HMILanguageHandler::Interface interface) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace resumption;
+ using namespace hmi_apis;
+ std::string key = "UNKNOWN";
+ switch (interface) {
+ case INTERFACE_UI:
+ key = UIKey;
+ break;
+ case INTERFACE_VR:
+ key = VRKey;
+ break;
+ case INTERFACE_TTS:
+ key = TTSKey;
+ break;
+ default:
+ LOG4CXX_WARN(logger_, "Unknown interfcase has been passed " << interface);
+ return Common_Language::INVALID_ENUM;
+ }
+
+ if (LastState::instance()->dictionary.isMember(LanguagesKey)) {
+ if (LastState::instance()->dictionary[LanguagesKey].isMember(key)) {
+ Common_Language::eType language =
+ static_cast<Common_Language::eType>(
+ LastState::instance()->dictionary[LanguagesKey][key].asInt());
+ return language;
+ }
+ }
+ return Common_Language::INVALID_ENUM;
+}
+
+void HMILanguageHandler::on_event(const event_engine::Event& event) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject msg = event.smart_object();
+ switch (event.id()) {
+ case hmi_apis::FunctionID::UI_GetLanguage:
+ LOG4CXX_DEBUG(logger_, "Got UI language response.");
+ is_ui_language_received_ = true;
+ break;
+ case hmi_apis::FunctionID::VR_GetLanguage:
+ LOG4CXX_DEBUG(logger_, "Got VR language response.");
+ is_vr_language_received_ = true;
+ break;
+ case hmi_apis::FunctionID::TTS_GetLanguage:
+ LOG4CXX_DEBUG(logger_, "Got TTS language response.");
+ is_tts_language_received_ = true;
+ break;
+ case hmi_apis::FunctionID::BasicCommunication_OnAppRegistered:
+ CheckApplication(std::make_pair(
+ msg[strings::params][strings::app_id].asUInt(),
+ true));
+ return;
+ default:
+ return;
+ }
+
+ if (is_ui_language_received_ && is_vr_language_received_ &&
+ is_tts_language_received_) {
+ LOG4CXX_DEBUG(logger_, "All GetLanguages responses gotten.");
+ VerifyWithPersistedLanguages();
+ }
+}
+
+void HMILanguageHandler::set_handle_response_for(
+ const event_engine::smart_objects::SmartObject& request) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ if (!request.keyExists(strings::params)) {
+ LOG4CXX_ERROR(logger_, "Object does not have " << strings::params
+ << " key.");
+ return;
+ }
+
+ if (!request[strings::params].keyExists(strings::function_id)) {
+ LOG4CXX_ERROR(logger_, "Object does not have " << strings::function_id
+ << " key.");
+ return;
+ }
+
+ if (!request[strings::params].keyExists(strings::correlation_id)) {
+ LOG4CXX_ERROR(logger_, "Object does not have " << strings::correlation_id
+ << " key.");
+ return;
+ }
+
+ hmi_apis::FunctionID::eType function_id =
+ static_cast<hmi_apis::FunctionID::eType>(
+ request[strings::params][strings::function_id].asInt());
+
+ if (!Compare<hmi_apis::FunctionID::eType, EQ, ONE>(
+ function_id,
+ hmi_apis::FunctionID::UI_GetLanguage,
+ hmi_apis::FunctionID::VR_GetLanguage,
+ hmi_apis::FunctionID::TTS_GetLanguage)) {
+ LOG4CXX_ERROR(logger_,
+ "Only *GetLanguage request are allowed to be subscribed.");
+ return;
+ }
+
+ uint32_t correlation_id =
+ request[strings::params][strings::correlation_id].asUInt();
+
+ subscribe_on_event(function_id, correlation_id);
+
+ LOG4CXX_DEBUG(logger_, "Subscribed for function_id " << function_id <<
+ " and correlation_id " << correlation_id);
+}
+
+void HMILanguageHandler::set_default_capabilities_languages(
+ hmi_apis::Common_Language::eType ui,
+ hmi_apis::Common_Language::eType vr,
+ hmi_apis::Common_Language::eType tts) {
+ capabilities_ui_language_ = ui;
+ if (hmi_apis::Common_Language::INVALID_ENUM == persisted_ui_language_) {
+ persisted_ui_language_ = ui;
+ }
+
+ capabilities_vr_language_ = vr;
+ if (hmi_apis::Common_Language::INVALID_ENUM == persisted_vr_language_) {
+ persisted_vr_language_ = vr;
+ }
+
+ capabilities_tts_language_ = tts;
+ if (hmi_apis::Common_Language::INVALID_ENUM == persisted_tts_language_) {
+ persisted_tts_language_ = tts;
+ }
+}
+
+void HMILanguageHandler::SendOnLanguageChangeToMobile(
+ const uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
+ DCHECK_OR_RETURN_VOID(notification);
+ smart_objects::SmartObject& message = *notification;
+ message[strings::params][strings::function_id] =
+ static_cast<int32_t>(mobile_api::FunctionID::OnLanguageChangeID);
+ message[strings::params][strings::message_type] =
+ static_cast<int32_t>(kNotification);
+ message[strings::params][strings::connection_key] = connection_key;
+
+ HMICapabilities& hmi_capabilities =
+ ApplicationManagerImpl::instance()->hmi_capabilities();
+ message[strings::msg_params][strings::hmi_display_language] =
+ hmi_capabilities.active_ui_language();
+ message[strings::msg_params][strings::language] =
+ hmi_capabilities.active_vr_language();
+ if (ApplicationManagerImpl::instance()->ManageMobileCommand(
+ notification, commands::Command::ORIGIN_SDL)) {
+ LOG4CXX_INFO(logger_, "Mobile command sent");
+ } else {
+ LOG4CXX_WARN(logger_, "Cannot send mobile command");
+ }
+}
+
+void HMILanguageHandler::VerifyWithPersistedLanguages() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ const HMICapabilities& hmi_capabilities =
+ ApplicationManagerImpl::instance()->hmi_capabilities();
+
+ // Updated values compared with persisted
+ if (hmi_capabilities.active_ui_language() == persisted_ui_language_ &&
+ hmi_capabilities.active_vr_language() == persisted_vr_language_ &&
+ hmi_capabilities.active_tts_language() == persisted_tts_language_) {
+ LOG4CXX_INFO(logger_,
+ "All languages gotten from HMI match to persisted values.");
+ return;
+ }
+
+ LOG4CXX_INFO(logger_, "Some languages gotten from HMI have "
+ "mismatch with persisted values.");
+
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ ApplicationSetIt it = accessor.begin();
+ for (; accessor.end() != it;) {
+ ApplicationConstSharedPtr app = *it++;
+
+ LOG4CXX_INFO(logger_, "Application with app_id " << app->app_id()
+ << " will be unregistered because of "
+ "HMI language(s) mismatch.");
+
+ CheckApplication(std::make_pair(app->app_id(), false));
+ }
+
+ sync_primitives::AutoLock lock(apps_lock_);
+ if (0 == apps_.size()) {
+ LOG4CXX_DEBUG(logger_,
+ "No registered apps found. Unsubscribing from all events.");
+ unsubscribe_from_all_events();
+ }
+}
+
+void HMILanguageHandler::HandleWrongLanguageApp(const Apps::value_type& app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ Apps::iterator it = apps_.find(app.first);
+ if (apps_.end() == it) {
+ LOG4CXX_DEBUG(logger_, "Application id " << app.first <<
+ " is not found within apps with wrong language.");
+ return;
+ }
+
+ LOG4CXX_INFO(logger_, "Unregistering application with app_id "
+ << app.first << " because of HMI language(s) mismatch.");
+
+ SendOnLanguageChangeToMobile(app.first);
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ app.first,
+ mobile_api::AppInterfaceUnregisteredReason::LANGUAGE_CHANGE);
+ ApplicationManagerImpl::instance()->
+ UnregisterApplication(app.first, mobile_apis::Result::SUCCESS, false);
+ apps_.erase(it);
+ if (0 == apps_.size()) {
+ LOG4CXX_DEBUG(logger_,
+ "All apps processed. Unsubscribing from all events.");
+ unsubscribe_from_all_events();
+ }
+}
+
+void HMILanguageHandler::CheckApplication(const Apps::value_type app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(apps_lock_);
+ Apps::iterator it = apps_.find(app.first);
+ if (apps_.end() == it) {
+ LOG4CXX_INFO(logger_, "Adding application id " << app.first <<
+ " Application registered: " << app.second);
+ apps_.insert(app);
+ return;
+ }
+ if (apps_[app.first]) {
+ HandleWrongLanguageApp(app);
+ }
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/hmi_state.cc b/src/components/application_manager/src/hmi_state.cc
index 2b165c1062..0ae3b2c981 100644
--- a/src/components/application_manager/src/hmi_state.cc
+++ b/src/components/application_manager/src/hmi_state.cc
@@ -1,65 +1,115 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
#include "application_manager/hmi_state.h"
+#include "application_manager/application_manager.h"
#include "utils/helpers.h"
namespace application_manager {
-HmiState::HmiState(uint32_t app_id, const StateContext& state_context_,
- StateID state_id):
- app_id_(app_id),
- state_id_(state_id),
- state_context_(state_context_),
- hmi_level_(mobile_apis::HMILevel::INVALID_ENUM),
- audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM),
- system_context_(mobile_apis::SystemContext::INVALID_ENUM) {
+HmiState::HmiState(uint32_t app_id,
+ ApplicationManager* app_mngr,
+ StateID state_id)
+ : app_id_(app_id)
+ , state_id_(state_id)
+ , app_mngr_(app_mngr)
+ , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
+ , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
+ , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {}
+
+HmiState::HmiState(uint32_t app_id, ApplicationManager* app_mngr)
+ : app_id_(app_id)
+ , state_id_(STATE_ID_REGULAR)
+ , app_mngr_(app_mngr)
+ , hmi_level_(mobile_apis::HMILevel::INVALID_ENUM)
+ , audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM)
+ , system_context_(mobile_apis::SystemContext::INVALID_ENUM) {}
+
+void HmiState::set_parent(HmiStatePtr parent) {
+ DCHECK_OR_RETURN_VOID(parent);
+ parent_ = parent;
}
+bool HmiState::is_navi_app(const uint32_t app_id) const {
+ DCHECK_OR_RETURN(app_mngr_, false);
+ const ApplicationSharedPtr app = app_mngr_->application(app_id);
+ DCHECK_OR_RETURN(app, false);
+ return app ? app->is_navi() : false;
+}
-HmiState::HmiState(uint32_t app_id, const StateContext& state_context):
- app_id_(app_id),
- state_id_(STATE_ID_REGULAR),
- state_context_(state_context),
- hmi_level_(mobile_apis::HMILevel::INVALID_ENUM),
- audio_streaming_state_(mobile_apis::AudioStreamingState::INVALID_ENUM),
- system_context_(mobile_apis::SystemContext::INVALID_ENUM) {
+bool HmiState::is_media_app(const uint32_t app_id) const {
+ DCHECK_OR_RETURN(app_mngr_, false);
+ const ApplicationSharedPtr app = app_mngr_->application(app_id);
+ DCHECK_OR_RETURN(app, false);
+ return app ? app->is_media_application() : false;
}
-void HmiState::set_parent(HmiStatePtr parent) {
- DCHECK_OR_RETURN_VOID(parent);
- parent_ = parent;
+bool HmiState::is_voice_communication_app(const uint32_t app_id) const {
+ DCHECK_OR_RETURN(app_mngr_, false);
+ const ApplicationSharedPtr app = app_mngr_->application(app_id);
+ DCHECK_OR_RETURN(app, false);
+ return app ? app->is_voice_communication_supported() : false;
}
-mobile_apis::AudioStreamingState::eType
-VRHmiState::audio_streaming_state() const {
+mobile_apis::AudioStreamingState::eType VRHmiState::audio_streaming_state()
+ const {
using namespace mobile_apis;
return AudioStreamingState::NOT_AUDIBLE;
}
-VRHmiState::VRHmiState(uint32_t app_id, StateContext& state_context):
- HmiState(app_id, state_context, STATE_ID_VR_SESSION) {
-}
+VRHmiState::VRHmiState(uint32_t app_id, ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_VR_SESSION) {}
-TTSHmiState::TTSHmiState(uint32_t app_id, StateContext& state_context):
- HmiState(app_id, state_context, STATE_ID_TTS_SESSION) {
-}
+TTSHmiState::TTSHmiState(uint32_t app_id, ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_TTS_SESSION) {}
-mobile_apis::AudioStreamingState::eType
-TTSHmiState::audio_streaming_state() const {
+mobile_apis::AudioStreamingState::eType TTSHmiState::audio_streaming_state()
+ const {
using namespace helpers;
using namespace mobile_apis;
AudioStreamingState::eType expected_state = AudioStreamingState::NOT_AUDIBLE;
- if (state_context_.is_attenuated_supported() &&
- AudioStreamingState::NOT_AUDIBLE != parent()->audio_streaming_state() &&
- Compare<HMILevel::eType, EQ, ONE> (hmi_level(), HMILevel::HMI_FULL,
- HMILevel::HMI_LIMITED)) {
+ if (app_mngr_->is_attenuated_supported() &&
+ AudioStreamingState::NOT_AUDIBLE != parent()->audio_streaming_state() &&
+ Compare<HMILevel::eType, EQ, ONE>(
+ hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) {
expected_state = AudioStreamingState::ATTENUATED;
}
return expected_state;
}
-NaviStreamingHmiState::NaviStreamingHmiState(uint32_t app_id, StateContext& state_context):
- HmiState(app_id, state_context, STATE_ID_NAVI_STREAMING) {
-}
+NaviStreamingHmiState::NaviStreamingHmiState(uint32_t app_id,
+ ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_NAVI_STREAMING) {}
mobile_apis::AudioStreamingState::eType
NaviStreamingHmiState::audio_streaming_state() const {
@@ -67,9 +117,8 @@ NaviStreamingHmiState::audio_streaming_state() const {
using namespace mobile_apis;
AudioStreamingState::eType expected_state = parent()->audio_streaming_state();
- if (!state_context_.is_navi_app(app_id_) &&
- AudioStreamingState::AUDIBLE == expected_state) {
- if (state_context_.is_attenuated_supported()) {
+ if (!is_navi_app(app_id_) && AudioStreamingState::AUDIBLE == expected_state) {
+ if (app_mngr_->is_attenuated_supported()) {
expected_state = AudioStreamingState::ATTENUATED;
} else {
expected_state = AudioStreamingState::NOT_AUDIBLE;
@@ -78,22 +127,79 @@ NaviStreamingHmiState::audio_streaming_state() const {
return expected_state;
}
-PhoneCallHmiState::PhoneCallHmiState(uint32_t app_id, StateContext& state_context):
- HmiState(app_id, state_context, STATE_ID_PHONE_CALL) {
-}
+PhoneCallHmiState::PhoneCallHmiState(uint32_t app_id,
+ ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_PHONE_CALL) {}
mobile_apis::HMILevel::eType PhoneCallHmiState::hmi_level() const {
+ using namespace helpers;
using namespace mobile_apis;
- HMILevel::eType expected_level(HMILevel::HMI_BACKGROUND);
- if (parent()->hmi_level() == HMILevel::HMI_FULL
- && state_context_.is_navi_app(app_id_)) {
- expected_level = HMILevel::HMI_LIMITED;
- }
- return expected_level;
+ if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
+ HMILevel::HMI_BACKGROUND,
+ HMILevel::HMI_NONE)) {
+ return parent()->hmi_level();
+ }
+ if (is_navi_app(app_id_)) {
+ return HMILevel::HMI_LIMITED;
+ }
+ if (!is_media_app(app_id_)) {
+ return parent()->hmi_level();
+ }
+ return HMILevel::HMI_BACKGROUND;
}
-SafetyModeHmiState::SafetyModeHmiState(uint32_t app_id, StateContext& state_context):
- HmiState(app_id, state_context, STATE_ID_SAFETY_MODE) {
+SafetyModeHmiState::SafetyModeHmiState(uint32_t app_id,
+ ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_SAFETY_MODE) {}
+
+DeactivateHMI::DeactivateHMI(uint32_t app_id, ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_DEACTIVATE_HMI) {}
+
+mobile_apis::HMILevel::eType DeactivateHMI::hmi_level() const {
+ using namespace helpers;
+ using namespace mobile_apis;
+ if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
+ HMILevel::HMI_BACKGROUND,
+ HMILevel::HMI_NONE)) {
+ return parent()->hmi_level();
+ }
+ return HMILevel::HMI_BACKGROUND;
+}
+
+AudioSource::AudioSource(uint32_t app_id, ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_AUDIO_SOURCE) {}
+
+mobile_apis::HMILevel::eType AudioSource::hmi_level() const {
+ using namespace mobile_apis;
+ using namespace helpers;
+ // TODO(AOleynik): That NONE check is necessary to avoid issue during
+ // calculation of HMI level during setting default HMI level
+ // Should be investigated (used in multiple places here), since looks weird
+ if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
+ HMILevel::HMI_BACKGROUND,
+ HMILevel::HMI_NONE)) {
+ return parent()->hmi_level();
+ }
+ if (is_navi_app(app_id_)) {
+ return HMILevel::HMI_LIMITED;
+ }
+ return HMILevel::HMI_BACKGROUND;
}
+EmbeddedNavi::EmbeddedNavi(uint32_t app_id, ApplicationManager* app_mngr)
+ : HmiState(app_id, app_mngr, STATE_ID_EMBEDDED_NAVI) {}
+
+mobile_apis::HMILevel::eType EmbeddedNavi::hmi_level() const {
+ using namespace mobile_apis;
+ using namespace helpers;
+ if (Compare<HMILevel::eType, EQ, ONE>(parent()->hmi_level(),
+ HMILevel::HMI_BACKGROUND,
+ HMILevel::HMI_NONE)) {
+ return parent()->hmi_level();
+ }
+ if (is_media_app(app_id_)) {
+ return HMILevel::HMI_LIMITED;
+ }
+ return HMILevel::HMI_BACKGROUND;
+}
}
diff --git a/src/components/application_manager/src/message_helper.cc b/src/components/application_manager/src/message_helper/message_helper.cc
index fd42305f77..809947dea1 100644
--- a/src/components/application_manager/src/message_helper.cc
+++ b/src/components/application_manager/src/message_helper/message_helper.cc
@@ -52,40 +52,29 @@
#include "smart_objects/enum_schema_item.h"
#include "utils/file_system.h"
#include "utils/macro.h"
-#include "utils/make_shared.h"
#include "utils/logger.h"
#include "utils/make_shared.h"
#include "formatters/formatter_json_rpc.h"
-#include "formatters/CFormatterJsonSDLRPCv2.hpp"
-#include "formatters/CFormatterJsonSDLRPCv1.hpp"
-
-namespace application_manager {
+#include "formatters/CFormatterJsonSDLRPCv2.h"
+#include "formatters/CFormatterJsonSDLRPCv1.h"
CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
+namespace application_manager {
namespace {
-typedef
-std::map<std::string, hmi_apis::Common_AppPriority::eType> CommonAppPriorityMap;
+typedef std::map<std::string, hmi_apis::Common_AppPriority::eType>
+ CommonAppPriorityMap;
CommonAppPriorityMap app_priority_values = {
- {"NORMAL", hmi_apis::Common_AppPriority::NORMAL},
- {"COMMUNICATION", hmi_apis::Common_AppPriority::COMMUNICATION},
- {"EMERGENCY", hmi_apis::Common_AppPriority::EMERGENCY},
- {"NAVIGATION", hmi_apis::Common_AppPriority::NAVIGATION},
- {"NONE", hmi_apis::Common_AppPriority::NONE},
- {"VOICECOM", hmi_apis::Common_AppPriority::VOICE_COMMUNICATION},
- {"INVALID_ENUM", hmi_apis::Common_AppPriority::INVALID_ENUM}
-};
-
-const uint32_t GetPriorityCode(const std::string& priority) {
- CommonAppPriorityMap::const_iterator it = app_priority_values.find(priority);
- if (app_priority_values.end() != it) {
- return static_cast<uint32_t>((*it).second);
- }
- return static_cast<uint32_t>(hmi_apis::Common_AppPriority::INVALID_ENUM);
-}
+ {"NORMAL", hmi_apis::Common_AppPriority::NORMAL},
+ {"COMMUNICATION", hmi_apis::Common_AppPriority::COMMUNICATION},
+ {"EMERGENCY", hmi_apis::Common_AppPriority::EMERGENCY},
+ {"NAVIGATION", hmi_apis::Common_AppPriority::NAVIGATION},
+ {"NONE", hmi_apis::Common_AppPriority::NONE},
+ {"VOICECOM", hmi_apis::Common_AppPriority::VOICE_COMMUNICATION},
+ {"INVALID_ENUM", hmi_apis::Common_AppPriority::INVALID_ENUM}};
bool ValidateSoftButtons(smart_objects::SmartObject& soft_buttons) {
using namespace smart_objects;
@@ -97,55 +86,54 @@ bool ValidateSoftButtons(smart_objects::SmartObject& soft_buttons) {
SmartObject& buttonImage = button[strings::image];
// Image name must not be empty and must not contain incorrect
- //character
+ // character
if (false == MessageHelper::VerifySoftButtonString(
- buttonImage[strings::value].asString())) {
+ buttonImage[strings::value].asString())) {
return false;
}
}
}
return true;
} // namespace
-
}
std::pair<std::string, VehicleDataType> kVehicleDataInitializer[] = {
- std::make_pair(strings::gps, VehicleDataType::GPS), std::make_pair(
- strings::speed, VehicleDataType::SPEED), std::make_pair(
- strings::rpm, VehicleDataType::RPM), std::make_pair(
- strings::fuel_level, VehicleDataType::FUELLEVEL), std::make_pair(
- strings::fuel_level_state, VehicleDataType::FUELLEVEL_STATE),
- std::make_pair(strings::instant_fuel_consumption,
- VehicleDataType::FUELCONSUMPTION), std::make_pair(
- strings::external_temp, VehicleDataType::EXTERNTEMP), std::make_pair(
- strings::vin, VehicleDataType::VIN), std::make_pair(
- strings::prndl, VehicleDataType::PRNDL), std::make_pair(
- strings::tire_pressure, VehicleDataType::TIREPRESSURE), std::make_pair(
- strings::odometer, VehicleDataType::ODOMETER), std::make_pair(
- strings::belt_status, VehicleDataType::BELTSTATUS), std::make_pair(
- strings::body_information, VehicleDataType::BODYINFO), std::make_pair(
- strings::device_status, VehicleDataType::DEVICESTATUS), std::make_pair(
- strings::driver_braking, VehicleDataType::BRAKING), std::make_pair(
- strings::wiper_status, VehicleDataType::WIPERSTATUS), std::make_pair(
- strings::head_lamp_status, VehicleDataType::HEADLAMPSTATUS),
- std::make_pair(strings::e_call_info, VehicleDataType::ECALLINFO),
- std::make_pair(strings::airbag_status, VehicleDataType::AIRBAGSTATUS),
- std::make_pair(strings::emergency_event, VehicleDataType::EMERGENCYEVENT),
- std::make_pair(strings::cluster_mode_status,
- VehicleDataType::CLUSTERMODESTATUS), std::make_pair(
- strings::my_key, VehicleDataType::MYKEY),
- /*
- NOT DEFINED in mobile API
- std::make_pair(strings::gps, VehicleDataType::BATTVOLTAGE),
- */
- std::make_pair(strings::engine_torque, VehicleDataType::ENGINETORQUE),
- std::make_pair(strings::acc_pedal_pos, VehicleDataType::ACCPEDAL),
- std::make_pair(strings::steering_wheel_angle,
- VehicleDataType::STEERINGWHEEL),
+ std::make_pair(strings::gps, VehicleDataType::GPS),
+ std::make_pair(strings::speed, VehicleDataType::SPEED),
+ std::make_pair(strings::rpm, VehicleDataType::RPM),
+ std::make_pair(strings::fuel_level, VehicleDataType::FUELLEVEL),
+ std::make_pair(strings::fuel_level_state, VehicleDataType::FUELLEVEL_STATE),
+ std::make_pair(strings::instant_fuel_consumption,
+ VehicleDataType::FUELCONSUMPTION),
+ std::make_pair(strings::external_temp, VehicleDataType::EXTERNTEMP),
+ std::make_pair(strings::vin, VehicleDataType::VIN),
+ std::make_pair(strings::prndl, VehicleDataType::PRNDL),
+ std::make_pair(strings::tire_pressure, VehicleDataType::TIREPRESSURE),
+ std::make_pair(strings::odometer, VehicleDataType::ODOMETER),
+ std::make_pair(strings::belt_status, VehicleDataType::BELTSTATUS),
+ std::make_pair(strings::body_information, VehicleDataType::BODYINFO),
+ std::make_pair(strings::device_status, VehicleDataType::DEVICESTATUS),
+ std::make_pair(strings::driver_braking, VehicleDataType::BRAKING),
+ std::make_pair(strings::wiper_status, VehicleDataType::WIPERSTATUS),
+ std::make_pair(strings::head_lamp_status, VehicleDataType::HEADLAMPSTATUS),
+ std::make_pair(strings::e_call_info, VehicleDataType::ECALLINFO),
+ std::make_pair(strings::airbag_status, VehicleDataType::AIRBAGSTATUS),
+ std::make_pair(strings::emergency_event, VehicleDataType::EMERGENCYEVENT),
+ std::make_pair(strings::cluster_mode_status,
+ VehicleDataType::CLUSTERMODESTATUS),
+ std::make_pair(strings::my_key, VehicleDataType::MYKEY),
+ /*
+ NOT DEFINED in mobile API
+ std::make_pair(strings::gps, VehicleDataType::BATTVOLTAGE),
+ */
+ std::make_pair(strings::engine_torque, VehicleDataType::ENGINETORQUE),
+ std::make_pair(strings::acc_pedal_pos, VehicleDataType::ACCPEDAL),
+ std::make_pair(strings::steering_wheel_angle,
+ VehicleDataType::STEERINGWHEEL),
};
const VehicleData MessageHelper::vehicle_data_(
- kVehicleDataInitializer, kVehicleDataInitializer +
- ARRAYSIZE(kVehicleDataInitializer));
+ kVehicleDataInitializer,
+ kVehicleDataInitializer + ARRAYSIZE(kVehicleDataInitializer));
#ifdef HMI_DBUS_API
namespace {
@@ -154,41 +142,66 @@ struct VehicleInfo_Requests {
const char* str;
};
static VehicleInfo_Requests ivi_subrequests[] = {
- { hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State, strings::fuel_level_state},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption, strings::instant_fuel_consumption},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature, strings::external_temp},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin},
- { hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure, strings::tire_pressure},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus, strings::belt_status},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation, strings::body_information},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus, strings::device_status},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking, strings::driver_braking},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus, strings::wiper_status},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus, strings::head_lamp_status},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque, strings::engine_torque},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition, strings::acc_pedal_pos},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle, strings::steering_wheel_angle},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo, strings::e_call_info},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus, strings::airbag_status},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent, strings::emergency_event},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus, strings::cluster_mode_status},
- { hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeGps, strings::gps},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeSpeed, strings::speed},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeRpm, strings::rpm},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel, strings::fuel_level},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeFuelLevel_State,
+ strings::fuel_level_state},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeInstantFuelConsumption,
+ strings::instant_fuel_consumption},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeExternalTemperature,
+ strings::external_temp},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeVin, strings::vin},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribePrndl, strings::prndl},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeTirePressure,
+ strings::tire_pressure},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeOdometer, strings::odometer},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeBeltStatus,
+ strings::belt_status},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeBodyInformation,
+ strings::body_information},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeDeviceStatus,
+ strings::device_status},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeDriverBraking,
+ strings::driver_braking},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeWiperStatus,
+ strings::wiper_status},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeHeadLampStatus,
+ strings::head_lamp_status},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeEngineTorque,
+ strings::engine_torque},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeAccPedalPosition,
+ strings::acc_pedal_pos},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeSteeringWheelAngle,
+ strings::steering_wheel_angle},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeECallInfo,
+ strings::e_call_info},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeAirbagStatus,
+ strings::airbag_status},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeEmergencyEvent,
+ strings::emergency_event},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeClusterModeStatus,
+ strings::cluster_mode_status},
+ {hmi_apis::FunctionID::VehicleInfo_SubscribeMyKey, strings::my_key},
};
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
+
+const uint32_t MessageHelper::GetPriorityCode(const std::string& priority) {
+ CommonAppPriorityMap::const_iterator it = app_priority_values.find(priority);
+ if (app_priority_values.end() != it) {
+ return static_cast<uint32_t>((*it).second);
+ }
+ return static_cast<uint32_t>(hmi_apis::Common_AppPriority::INVALID_ENUM);
+}
std::string MessageHelper::CommonLanguageToString(
- hmi_apis::Common_Language::eType language) {
+ hmi_apis::Common_Language::eType language) {
using namespace NsSmartDeviceLink::NsSmartObjects;
const char* str = 0;
if (EnumConversionHelper<hmi_apis::Common_Language::eType>::EnumToCString(
- language, &str)) {
+ language, &str)) {
return str ? str : "";
}
return std::string();
@@ -199,199 +212,88 @@ hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(
using namespace NsSmartDeviceLink::NsSmartObjects;
hmi_apis::Common_Language::eType value;
if (EnumConversionHelper<hmi_apis::Common_Language::eType>::StringToEnum(
- language, &value)) {
+ language, &value)) {
return value;
}
return hmi_apis::Common_Language::INVALID_ENUM;
}
uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) {
-
std::string priority;
policy::PolicyHandler::instance()->GetPriority(policy_app_id, &priority);
return policy::PolicyHandler::instance()->GetNotificationsNumber(priority);
}
-void MessageHelper::SendHMIStatusNotification(
- const Application& application_impl) {
- LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
- if (!notification) {
- // TODO(VS): please add logger.
- return;
- }
- smart_objects::SmartObject& message = *notification;
-
- message[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_api::FunctionID::OnHMIStatusID);
-
- message[strings::params][strings::message_type] =
- static_cast<int32_t>(application_manager::MessageType::kNotification);
-
- message[strings::params][strings::connection_key] =
- static_cast<int32_t>(application_impl.app_id());
-
- message[strings::msg_params][strings::hmi_level] =
- static_cast<int32_t>(application_impl.hmi_level());
-
- message[strings::msg_params][strings::audio_streaming_state] =
- static_cast<int32_t>(application_impl.audio_streaming_state());
-
- message[strings::msg_params][strings::system_context] =
- static_cast<int32_t>(application_impl.system_context());
-
- ApplicationManagerImpl::instance()->ManageMobileCommand(notification);
-}
-
-void MessageHelper::SendOnAppRegisteredNotificationToHMI(
- const Application& application_impl, bool resumption, bool need_restore_vr) {
+smart_objects::SmartObjectSPtr MessageHelper::CreateRequestObject() {
using namespace smart_objects;
- SmartObjectSPtr notification = utils::MakeShared<SmartObject>(SmartType_Map);
- if (!notification) {
- LOG4CXX_ERROR(logger_, "Failed to create smart object");
- return;
- }
-
- (*notification)[strings::params] = SmartObject(SmartType_Map);
- smart_objects::SmartObject& params = (*notification)[strings::params];
- params[strings::function_id] =
- static_cast<int32_t>(hmi_apis::FunctionID::BasicCommunication_OnAppRegistered);
- params[strings::message_type] = static_cast<int32_t>(kNotification);
- params[strings::protocol_version] = commands::CommandImpl::protocol_version_;
- params[strings::protocol_type] = commands::CommandImpl::hmi_protocol_type_;
-
- (*notification)[strings::msg_params] = SmartObject(SmartType_Map);
- smart_objects::SmartObject& msg_params = (*notification)[strings::msg_params];
- // Due to current requirements in case when we're in resumption mode
- // we have to always send resumeVRGrammar field.
- if (resumption) {
- msg_params[strings::resume_vr_grammars] = need_restore_vr;
- }
-
- if (application_impl.vr_synonyms()) {
- msg_params[strings::vr_synonyms] = *(application_impl.vr_synonyms());
- }
-
- if (application_impl.tts_name()) {
- msg_params[strings::tts_name] = *(application_impl.tts_name());
- }
-
- std::string priority;
- policy::PolicyHandler::instance()->GetPriority(
- application_impl.mobile_app_id(), &priority);
- if (!priority.empty()) {
- msg_params[strings::priority] = GetPriorityCode(priority);
- }
-
- smart_objects::SmartObject& application = msg_params[strings::application];
- application[strings::app_name] = application_impl.name();
- application[strings::app_id] = application_impl.app_id();
- application[hmi_response::policy_app_id] = application_impl.mobile_app_id();
- application[strings::icon] = application_impl.app_icon_path();
-
- const smart_objects::SmartObject* ngn_media_screen_name =
- application_impl.ngn_media_screen_name();
- if (ngn_media_screen_name) {
- application[strings::ngn_media_screen_app_name] = *ngn_media_screen_name;
- }
-
- application[strings::hmi_display_language_desired] =
- static_cast<int32_t>(application_impl.ui_language());
-
- application[strings::is_media_application] = application_impl.is_media_application();
-
- const smart_objects::SmartObject* app_type = application_impl.app_types();
-
- if (app_type) {
- application[strings::app_type] = *app_type;
- }
- if (application_impl.IsRegistered()) {
- std::vector<std::string> request_types =
- policy::PolicyHandler::instance()->GetAppRequestTypes(
- application_impl.mobile_app_id());
-
- application[strings::request_type] = SmartObject(SmartType_Array);
- smart_objects::SmartObject& request_array = application[strings::request_type];
-
- uint32_t index = 0;
- std::vector<std::string>::const_iterator it = request_types.begin();
- for (; request_types.end() != it; ++it) {
- request_array[index] = *it;
- ++index;
- }
- }
+ SmartObjectSPtr request(new SmartObject(SmartType_Map));
+ if (request) {
+ SmartObject& ref = *request;
- application[strings::device_info] = SmartObject(SmartType_Map);
- smart_objects::SmartObject& device_info = application[strings::device_info];
- std::string device_name;
- std::string mac_address;
- std::string transport_type;
- if (-1 == connection_handler::ConnectionHandlerImpl::instance()->
- GetDataOnDeviceID(application_impl.device(), &device_name,
- NULL, &mac_address, &transport_type)) {
- LOG4CXX_ERROR(logger_, "Failed to extract information for device "
- << application_impl.device());
+ ref[strings::params][strings::message_type] =
+ static_cast<int>(hmi_apis::messageType::request);
+ ref[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
+ ref[strings::params][strings::protocol_type] =
+ commands::CommandImpl::hmi_protocol_type_;
+ ref[strings::params][strings::correlation_id] =
+ ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
}
- device_info[strings::name] = device_name;
- device_info[strings::id] = mac_address;
-
- const policy::DeviceConsent device_consent =
- policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address);
- device_info[strings::isSDLAllowed] =
- policy::DeviceConsent::kDeviceAllowed == device_consent;
-
- device_info[strings::transport_type] =
- ApplicationManagerImpl::instance()->GetDeviceTransportType(transport_type);
-
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(notification));
+ return request;
}
smart_objects::SmartObjectSPtr MessageHelper::GetHashUpdateNotification(
- const uint32_t app_id) {
-
+ const uint32_t app_id) {
LOG4CXX_INFO(logger_, "GetHashUpdateNotification" << app_id);
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- app_id);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app) {
return NULL;
}
-
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
mobile_apis::FunctionID::OnHashChangeID;
(*message)[strings::params][strings::connection_key] = app_id;
(*message)[strings::params][strings::message_type] =
static_cast<int32_t>(kNotification);
-
return message;
}
-smart_objects::SmartObject* MessageHelper::GetLockScreenIconUrlNotification(const uint32_t connection_key) {
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(connection_key);
+smart_objects::SmartObject* MessageHelper::GetLockScreenIconUrlNotification(
+ const uint32_t connection_key) {
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key);
DCHECK(app.get());
- smart_objects::SmartObject* message = new smart_objects::SmartObject(smart_objects::SmartType_Map);
- (*message)[strings::params][strings::function_id] = mobile_apis::FunctionID::OnSystemRequestID;
+ smart_objects::SmartObject* message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ (*message)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemRequestID;
(*message)[strings::params][strings::connection_key] = connection_key;
- (*message)[strings::params][strings::message_type] = mobile_apis::messageType::notification;
- (*message)[strings::params][strings::protocol_type] = commands::CommandImpl::mobile_protocol_type_;
- (*message)[strings::params][strings::protocol_version] = commands::CommandImpl::protocol_version_;
-
- (*message)[strings::msg_params][strings::request_type] = mobile_apis::RequestType::LOCK_SCREEN_ICON_URL;
+ (*message)[strings::params][strings::message_type] =
+ mobile_apis::messageType::notification;
+ (*message)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::mobile_protocol_type_;
+ (*message)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
- (*message)[strings::msg_params][strings::url] = policy::PolicyHandler::instance()->GetLockScreenIconUrl();
+ (*message)[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::LOCK_SCREEN_ICON_URL;
+ (*message)[strings::msg_params][strings::url] =
+ policy::PolicyHandler::instance()->GetLockScreenIconUrl();
return message;
}
+void MessageHelper::SendLockScreenIconUrlNotification(
+ const uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
-void MessageHelper::SendLockScreenIconUrlNotification(const uint32_t connection_key) {
- LOG4CXX_INFO(logger_, "SendLockScreenIconUrlNotification");
-
- smart_objects::SmartObject* so = GetLockScreenIconUrlNotification(connection_key);
+ smart_objects::SmartObject* so =
+ GetLockScreenIconUrlNotification(connection_key);
PrintSmartObject(*so);
DCHECK(ApplicationManagerImpl::instance()->ManageMobileCommand(so));
}
@@ -403,28 +305,29 @@ void MessageHelper::SendHashUpdateNotification(const uint32_t app_id) {
if (so) {
PrintSmartObject(*so);
if (!ApplicationManagerImpl::instance()->ManageMobileCommand(so)) {
- LOG4CXX_ERROR_EXT(logger_, "Failed to send HashUpdate notification.");
+ LOG4CXX_ERROR(logger_, "Failed to send HashUpdate notification.");
} else {
- ApplicationManagerImpl::instance()->resume_controller().ApplicationsDataUpdated();
+ ApplicationManagerImpl::instance()
+ ->resume_controller()
+ .ApplicationsDataUpdated();
}
}
}
void MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
- int32_t connection_key,
- mobile_api::AppInterfaceUnregisteredReason::eType reason) {
-
+ int32_t connection_key,
+ mobile_api::AppInterfaceUnregisteredReason::eType reason) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject;
DCHECK(notification);
smart_objects::SmartObject& message = *notification;
- message[strings::params][strings::function_id] =
- static_cast<int32_t>(mobile_api::FunctionID::OnAppInterfaceUnregisteredID);
+ message[strings::params][strings::function_id] = static_cast<int32_t>(
+ mobile_api::FunctionID::OnAppInterfaceUnregisteredID);
message[strings::params][strings::message_type] =
- static_cast<int32_t>(kNotification);
+ static_cast<int32_t>(kNotification);
message[strings::params][strings::connection_key] = connection_key;
@@ -432,8 +335,7 @@ void MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
if (ApplicationManagerImpl::instance()->ManageMobileCommand(notification)) {
LOG4CXX_DEBUG(logger_, "Mobile command sent");
- }
- else {
+ } else {
LOG4CXX_WARN(logger_, "Cannot send mobile command");
}
}
@@ -442,39 +344,101 @@ const VehicleData& MessageHelper::vehicle_data() {
return vehicle_data_;
}
+std::string MessageHelper::HMIResultToString(
+ hmi_apis::Common_Result::eType hmi_result) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ const char* str = 0;
+ if (EnumConversionHelper<hmi_apis::Common_Result::eType>::EnumToCString(
+ hmi_result, &str)) {
+ return str;
+ }
+ return std::string();
+}
+
+hmi_apis::Common_Result::eType MessageHelper::HMIResultFromString(
+ const std::string& hmi_result) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ hmi_apis::Common_Result::eType value;
+ if (EnumConversionHelper<hmi_apis::Common_Result::eType>::StringToEnum(
+ hmi_result, &value)) {
+ return value;
+ }
+ return hmi_apis::Common_Result::INVALID_ENUM;
+}
+
+std::string MessageHelper::MobileResultToString(
+ mobile_apis::Result::eType mobile_result) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ const char* str = 0;
+ if (EnumConversionHelper<mobile_apis::Result::eType>::EnumToCString(
+ mobile_result, &str)) {
+ return str;
+ }
+ return std::string();
+}
+
+mobile_apis::Result::eType MessageHelper::MobileResultFromString(
+ const std::string& mobile_result) {
+ using namespace NsSmartDeviceLink::NsSmartObjects;
+ mobile_apis::Result::eType value;
+ if (EnumConversionHelper<mobile_apis::Result::eType>::StringToEnum(
+ mobile_result, &value)) {
+ return value;
+ }
+ return mobile_apis::Result::INVALID_ENUM;
+}
+
+mobile_apis::Result::eType MessageHelper::HMIToMobileResult(
+ const hmi_apis::Common_Result::eType hmi_result) {
+ const std::string result = HMIResultToString(hmi_result);
+ if (result.empty()) {
+ return mobile_api::Result::INVALID_ENUM;
+ }
+ return MobileResultFromString(result);
+}
+
+hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
+ const mobile_apis::Result::eType mobile_result) {
+ const std::string result = MobileResultToString(mobile_result);
+ if (result.empty()) {
+ return hmi_apis::Common_Result::INVALID_ENUM;
+ }
+ return HMIResultFromString(result);
+}
+
mobile_apis::HMILevel::eType MessageHelper::StringToHMILevel(
- const std::string& hmi_level) {
+ const std::string& hmi_level) {
using namespace NsSmartDeviceLink::NsSmartObjects;
mobile_apis::HMILevel::eType value;
if (EnumConversionHelper<mobile_apis::HMILevel::eType>::StringToEnum(
- hmi_level, &value)) {
+ hmi_level, &value)) {
return value;
}
return mobile_apis::HMILevel::INVALID_ENUM;
}
std::string MessageHelper::StringifiedHMILevel(
- mobile_apis::HMILevel::eType hmi_level) {
+ mobile_apis::HMILevel::eType hmi_level) {
using namespace NsSmartDeviceLink::NsSmartObjects;
const char* str = 0;
if (EnumConversionHelper<mobile_apis::HMILevel::eType>::EnumToCString(
- hmi_level, &str)) {
+ hmi_level, &str)) {
return str;
}
return std::string();
}
std::string MessageHelper::StringifiedFunctionID(
- mobile_apis::FunctionID::eType function_id) {
+ mobile_apis::FunctionID::eType function_id) {
LOG4CXX_AUTO_TRACE(logger_);
using namespace NsSmartDeviceLink::NsSmartObjects;
const char* str = 0;
if (EnumConversionHelper<mobile_apis::FunctionID::eType>::EnumToCString(
- function_id, &str)) {
+ function_id, &str)) {
const std::string enum_name = str;
// Strip 'ID' suffix from value name
- DCHECK(enum_name.length() > 2
- && enum_name.substr(enum_name.length() - 2) == "ID");
+ DCHECK(enum_name.length() > 2 &&
+ enum_name.substr(enum_name.length() - 2) == "ID");
return enum_name.substr(0, enum_name.length() - 2);
}
return std::string();
@@ -484,34 +448,69 @@ std::string MessageHelper::StringifiedFunctionID(
namespace {
const std::map<std::string, uint16_t> create_get_vehicle_data_args() {
std::map<std::string, uint16_t> rc;
- rc.insert(std::make_pair(strings::gps, hmi_apis::FunctionID::VehicleInfo_GetGpsData));
- rc.insert(std::make_pair(strings::speed, hmi_apis::FunctionID::VehicleInfo_GetSpeed));
- rc.insert(std::make_pair(strings::rpm, hmi_apis::FunctionID::VehicleInfo_GetRpm));
- rc.insert(std::make_pair(strings::fuel_level, hmi_apis::FunctionID::VehicleInfo_GetFuelLevel));
- rc.insert(std::make_pair(strings::fuel_level_state, hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState));
- rc.insert(std::make_pair(strings::instant_fuel_consumption, hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption));
- rc.insert(std::make_pair(strings::external_temp, hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature));
- rc.insert(std::make_pair(strings::vin, hmi_apis::FunctionID::VehicleInfo_GetVin));
- rc.insert(std::make_pair(strings::prndl, hmi_apis::FunctionID::VehicleInfo_GetPrndl));
- rc.insert(std::make_pair(strings::tire_pressure, hmi_apis::FunctionID::VehicleInfo_GetTirePressure));
- rc.insert(std::make_pair(strings::odometer, hmi_apis::FunctionID::VehicleInfo_GetOdometer));
- rc.insert(std::make_pair(strings::belt_status, hmi_apis::FunctionID::VehicleInfo_GetBeltStatus));
- rc.insert(std::make_pair(strings::body_information, hmi_apis::FunctionID::VehicleInfo_GetBodyInformation));
- rc.insert(std::make_pair(strings::device_status, hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus));
- rc.insert(std::make_pair(strings::driver_braking, hmi_apis::FunctionID::VehicleInfo_GetDriverBraking));
- rc.insert(std::make_pair(strings::wiper_status, hmi_apis::FunctionID::VehicleInfo_GetWiperStatus));
- rc.insert(std::make_pair(strings::head_lamp_status, hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus));
- rc.insert(std::make_pair(strings::engine_torque, hmi_apis::FunctionID::VehicleInfo_GetEngineTorque));
- rc.insert(std::make_pair(strings::acc_pedal_pos, hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition));
- rc.insert(std::make_pair(strings::steering_wheel_angle, hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle));
- rc.insert(std::make_pair(strings::e_call_info, hmi_apis::FunctionID::VehicleInfo_GetECallInfo));
- rc.insert(std::make_pair(strings::airbag_status, hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus));
- rc.insert(std::make_pair(strings::emergency_event, hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent));
- rc.insert(std::make_pair(strings::cluster_mode_status, hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus));
- rc.insert(std::make_pair(strings::my_key, hmi_apis::FunctionID::VehicleInfo_GetMyKey));
+ rc.insert(std::make_pair(strings::gps,
+ hmi_apis::FunctionID::VehicleInfo_GetGpsData));
+ rc.insert(std::make_pair(strings::speed,
+ hmi_apis::FunctionID::VehicleInfo_GetSpeed));
+ rc.insert(
+ std::make_pair(strings::rpm, hmi_apis::FunctionID::VehicleInfo_GetRpm));
+ rc.insert(std::make_pair(strings::fuel_level,
+ hmi_apis::FunctionID::VehicleInfo_GetFuelLevel));
+ rc.insert(
+ std::make_pair(strings::fuel_level_state,
+ hmi_apis::FunctionID::VehicleInfo_GetFuelLevelState));
+ rc.insert(std::make_pair(
+ strings::instant_fuel_consumption,
+ hmi_apis::FunctionID::VehicleInfo_GetInstantFuelConsumption));
+ rc.insert(
+ std::make_pair(strings::external_temp,
+ hmi_apis::FunctionID::VehicleInfo_GetExternalTemperature));
+ rc.insert(
+ std::make_pair(strings::vin, hmi_apis::FunctionID::VehicleInfo_GetVin));
+ rc.insert(std::make_pair(strings::prndl,
+ hmi_apis::FunctionID::VehicleInfo_GetPrndl));
+ rc.insert(std::make_pair(strings::tire_pressure,
+ hmi_apis::FunctionID::VehicleInfo_GetTirePressure));
+ rc.insert(std::make_pair(strings::odometer,
+ hmi_apis::FunctionID::VehicleInfo_GetOdometer));
+ rc.insert(std::make_pair(strings::belt_status,
+ hmi_apis::FunctionID::VehicleInfo_GetBeltStatus));
+ rc.insert(
+ std::make_pair(strings::body_information,
+ hmi_apis::FunctionID::VehicleInfo_GetBodyInformation));
+ rc.insert(std::make_pair(strings::device_status,
+ hmi_apis::FunctionID::VehicleInfo_GetDeviceStatus));
+ rc.insert(std::make_pair(strings::driver_braking,
+ hmi_apis::FunctionID::VehicleInfo_GetDriverBraking));
+ rc.insert(std::make_pair(strings::wiper_status,
+ hmi_apis::FunctionID::VehicleInfo_GetWiperStatus));
+ rc.insert(
+ std::make_pair(strings::head_lamp_status,
+ hmi_apis::FunctionID::VehicleInfo_GetHeadLampStatus));
+ rc.insert(std::make_pair(strings::engine_torque,
+ hmi_apis::FunctionID::VehicleInfo_GetEngineTorque));
+ rc.insert(
+ std::make_pair(strings::acc_pedal_pos,
+ hmi_apis::FunctionID::VehicleInfo_GetAccPedalPosition));
+ rc.insert(
+ std::make_pair(strings::steering_wheel_angle,
+ hmi_apis::FunctionID::VehicleInfo_GetSteeringWheelAngle));
+ rc.insert(std::make_pair(strings::e_call_info,
+ hmi_apis::FunctionID::VehicleInfo_GetECallInfo));
+ rc.insert(std::make_pair(strings::airbag_status,
+ hmi_apis::FunctionID::VehicleInfo_GetAirbagStatus));
+ rc.insert(
+ std::make_pair(strings::emergency_event,
+ hmi_apis::FunctionID::VehicleInfo_GetEmergencyEvent));
+ rc.insert(
+ std::make_pair(strings::cluster_mode_status,
+ hmi_apis::FunctionID::VehicleInfo_GetClusterModeStatus));
+ rc.insert(std::make_pair(strings::my_key,
+ hmi_apis::FunctionID::VehicleInfo_GetMyKey));
return rc;
}
-static std::map<std::string, uint16_t> vehicle_data_args = create_get_vehicle_data_args();
+static std::map<std::string, uint16_t> vehicle_data_args =
+ create_get_vehicle_data_args();
}
#endif
@@ -520,33 +519,38 @@ void MessageHelper::CreateGetVehicleDataRequest(
LOG4CXX_AUTO_TRACE(logger_);
#ifdef HMI_DBUS_API
for (std::vector<std::string>::const_iterator it = params.begin();
- it != params.end(); it++) {
+ it != params.end();
+ it++) {
smart_objects::SmartObjectSPtr request = new smart_objects::SmartObject;
- (*request)[strings::params][strings::message_type] = static_cast<int>(kRequest);
+ (*request)[strings::params][strings::message_type] =
+ static_cast<int>(kRequest);
(*request)[strings::params][strings::correlation_id] = correlation_id;
(*request)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
+ commands::CommandImpl::protocol_version_;
(*request)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
+ commands::CommandImpl::hmi_protocol_type_;
(*request)[strings::params][strings::function_id] =
- static_cast<int>(vehicle_data_args[*it]);
+ static_cast<int>(vehicle_data_args[*it]);
ApplicationManagerImpl::instance()->ManageHMICommand(request);
}
#else
smart_objects::SmartObjectSPtr request = new smart_objects::SmartObject;
- (*request)[strings::params][strings::message_type] = static_cast<int>(kRequest);
+ (*request)[strings::params][strings::message_type] =
+ static_cast<int>(kRequest);
(*request)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
+ static_cast<int>(hmi_apis::FunctionID::VehicleInfo_GetVehicleData);
(*request)[strings::params][strings::correlation_id] = correlation_id;
(*request)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
+ commands::CommandImpl::protocol_version_;
(*request)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*request)[strings::msg_params] = smart_objects::SmartObject(smart_objects::SmartType_Map);
+ commands::CommandImpl::hmi_protocol_type_;
+ (*request)[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
for (std::vector<std::string>::const_iterator it = params.begin();
- it != params.end(); it++) {
+ it != params.end();
+ it++) {
(*request)[strings::msg_params][*it] = true;
}
ApplicationManagerImpl::instance()->ManageHMICommand(request);
@@ -555,51 +559,55 @@ void MessageHelper::CreateGetVehicleDataRequest(
smart_objects::SmartObjectSPtr MessageHelper::CreateBlockedByPoliciesResponse(
mobile_apis::FunctionID::eType function_id,
- mobile_apis::Result::eType result, uint32_t correlation_id,
+ mobile_apis::Result::eType result,
+ uint32_t correlation_id,
uint32_t connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr response = new smart_objects::SmartObject;
(*response)[strings::params][strings::function_id] =
- static_cast<int>(function_id);
+ static_cast<int>(function_id);
(*response)[strings::params][strings::message_type] =
- static_cast<int>(kResponse);
+ static_cast<int>(kResponse);
(*response)[strings::msg_params][strings::success] = false;
(*response)[strings::msg_params][strings::result_code] =
- static_cast<int>(result);
+ static_cast<int>(result);
(*response)[strings::params][strings::correlation_id] = correlation_id;
(*response)[strings::params][strings::connection_key] = connection_key;
(*response)[strings::params][strings::protocol_type] =
- commands::CommandImpl::mobile_protocol_type_;
+ commands::CommandImpl::mobile_protocol_type_;
(*response)[strings::params][strings::protocol_version] =
- static_cast<int>(kV2);
+ static_cast<int>(kV2);
return response;
}
smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
- const connection_handler::DeviceMap& devices) {
+ const connection_handler::DeviceMap& devices) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectSPtr device_list_so =
new smart_objects::SmartObject(smart_objects::SmartType_Map);
- (*device_list_so)[strings::device_list] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ (*device_list_so)[strings::device_list] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& list_so = (*device_list_so)[strings::device_list];
int32_t index = 0;
for (connection_handler::DeviceMap::const_iterator it = devices.begin();
- devices.end() != it; ++it) {
+ devices.end() != it;
+ ++it) {
const connection_handler::Device& d =
- static_cast<connection_handler::Device>(it->second);
+ static_cast<connection_handler::Device>(it->second);
list_so[index][strings::name] = d.user_friendly_name();
list_so[index][strings::id] = it->second.mac_address();
const policy::DeviceConsent device_consent =
- policy::PolicyHandler::instance()->GetUserConsentForDevice(it->second.mac_address());
+ policy::PolicyHandler::instance()->GetUserConsentForDevice(
+ it->second.mac_address());
list_so[index][strings::isSDLAllowed] =
policy::DeviceConsent::kDeviceAllowed == device_consent;
list_so[index][strings::transport_type] =
- ApplicationManagerImpl::instance()->GetDeviceTransportType(d.connection_type());
+ ApplicationManagerImpl::instance()->GetDeviceTransportType(
+ d.connection_type());
++index;
}
return device_list_so;
@@ -608,23 +616,23 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateDeviceListSO(
smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO(
uint32_t function_id) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr module_info = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr module_info =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& object = *module_info;
object[strings::params][strings::message_type] = static_cast<int>(kRequest);
object[strings::params][strings::function_id] = static_cast<int>(function_id);
object[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
- object[strings::msg_params] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ object[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
return module_info;
}
smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
- const std::string& path_to_icon, uint32_t app_id) {
+ const std::string& path_to_icon, uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr set_icon = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr set_icon =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!set_icon) {
return NULL;
@@ -634,7 +642,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateSetAppIcon(
object[strings::sync_file_name][strings::value] = path_to_icon;
// TODO(PV): need to store actual image type
object[strings::sync_file_name][strings::image_type] =
- static_cast<int>(mobile_api::ImageType::DYNAMIC);
+ static_cast<int>(mobile_api::ImageType::DYNAMIC);
object[strings::app_id] = app_id;
return set_icon;
@@ -644,8 +652,8 @@ bool MessageHelper::SendIVISubscribtions(const uint32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
bool result = true;
- ApplicationSharedPtr app = ApplicationManagerImpl::instance()->application(
- app_id);
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app.valid()) {
LOG4CXX_ERROR(logger_, "Invalid application " << app_id);
@@ -654,7 +662,8 @@ bool MessageHelper::SendIVISubscribtions(const uint32_t app_id) {
smart_objects::SmartObjectList requests = GetIVISubscriptionRequests(app);
for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
- it != requests.end(); ++it) {
+ it != requests.end();
+ ++it) {
if (!ApplicationManagerImpl::instance()->ManageHMICommand(*it)) {
result = false;
}
@@ -663,7 +672,7 @@ bool MessageHelper::SendIVISubscribtions(const uint32_t app_id) {
}
smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
- ApplicationSharedPtr app) {
+ ApplicationSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectList hmi_requests;
@@ -672,16 +681,17 @@ smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
return hmi_requests;
}
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app->app_id();
const VehicleData& vehicle_data = MessageHelper::vehicle_data_;
VehicleData::const_iterator ivi_it = vehicle_data.begin();
- const std::set<uint32_t>& subscribes = app->SubscribesIVI();
+ DataAccessor<VehicleInfoSubscriptions> vi_accessor = app->SubscribedIVI();
+ const VehicleInfoSubscriptions& subscriptions = vi_accessor.GetData();
for (; vehicle_data.end() != ivi_it; ++ivi_it) {
uint32_t type_id = static_cast<int>(ivi_it->second);
- if (subscribes.end() != subscribes.find(type_id)) {
+ if (subscriptions.end() != subscriptions.find(type_id)) {
std::string key_name = ivi_it->first;
msg_params[key_name] = true;
}
@@ -692,30 +702,34 @@ smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
hmi_apis::FunctionID::VehicleInfo_SubscribeVehicleData);
(*request)[strings::msg_params] = msg_params;
hmi_requests.push_back(request);
-#endif // #ifdef HMI_JSON_API
+#endif // #ifdef HMI_JSON_API
#ifdef HMI_DBUS_API
- //Generate list of ivi_subrequests
- for (size_t i = 0; i < sizeof(ivi_subrequests) / sizeof(ivi_subrequests[0]); ++i) {
+ // Generate list of ivi_subrequests
+ for (size_t i = 0; i < sizeof(ivi_subrequests) / sizeof(ivi_subrequests[0]);
+ ++i) {
const VehicleInfo_Requests& sr = ivi_subrequests[i];
- if (true == msg_params.keyExists(sr.str)
- && true == msg_params[sr.str].asBool()) {
- smart_objects::SmartObjectSPtr request = MessageHelper::CreateModuleInfoSO(
- sr.func_id);
+ if (true == msg_params.keyExists(sr.str) &&
+ true == msg_params[sr.str].asBool()) {
+ smart_objects::SmartObjectSPtr request =
+ MessageHelper::CreateModuleInfoSO(sr.func_id);
(*request)[strings::msg_params] = msg_params;
hmi_requests.push_back(request);
}
}
-#endif // #ifdef HMI_DBUS_API
+#endif // #ifdef HMI_DBUS_API
return hmi_requests;
}
void MessageHelper::SendOnButtonSubscriptionNotification(
- uint32_t app_id, hmi_apis::Common_ButtonName::eType button, bool is_subscribed) {
+ const uint32_t app_id,
+ const hmi_apis::Common_ButtonName::eType button,
+ const bool is_subscribed) {
using namespace smart_objects;
using namespace hmi_apis;
LOG4CXX_AUTO_TRACE(logger_);
- SmartObjectSPtr notification_ptr = utils::MakeShared<SmartObject>(SmartType_Map);
+ SmartObjectSPtr notification_ptr =
+ utils::MakeShared<SmartObject>(SmartType_Map);
if (!notification_ptr) {
LOG4CXX_ERROR(logger_, "Memory allocation failed.");
return;
@@ -754,34 +768,28 @@ void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
return;
}
- std::set<ButtonName::eType> subscriptions = app->SubscribedButtons();
- std::set<ButtonName::eType>::iterator it = subscriptions.begin();
+ DataAccessor<ButtonSubscriptions> button_accessor = app->SubscribedButtons();
+ ButtonSubscriptions subscriptions = button_accessor.GetData();
+ ButtonSubscriptions::iterator it = subscriptions.begin();
for (; subscriptions.end() != it; ++it) {
SendOnButtonSubscriptionNotification(
app->hmi_app_id(), static_cast<Common_ButtonName::eType>(*it), true);
}
}
-void MessageHelper::SendSetAppIcon(uint32_t app_id,
+void MessageHelper::SendSetAppIcon(const uint32_t app_id,
const std::string& icon_path) {
using namespace smart_objects;
- SmartObjectSPtr set_app_icon(new smart_objects::SmartObject);
+ SmartObjectSPtr set_app_icon = CreateRequestObject();
if (set_app_icon) {
SmartObject& so_to_send = *set_app_icon;
so_to_send[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_SetAppIcon);
- so_to_send[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- so_to_send[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- so_to_send[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- so_to_send[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ static_cast<int>(hmi_apis::FunctionID::UI_SetAppIcon);
- so_to_send[strings::msg_params] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- SmartObjectSPtr msg_params(MessageHelper::CreateSetAppIcon(icon_path, app_id));
+ so_to_send[strings::msg_params] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ SmartObjectSPtr msg_params(
+ MessageHelper::CreateSetAppIcon(icon_path, app_id));
if (msg_params) {
so_to_send[strings::msg_params] = *msg_params;
@@ -805,15 +813,18 @@ void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app) {
return;
}
- smart_objects::SmartObjectList requests = CreateGlobalPropertiesRequestsToHMI(app);
+ smart_objects::SmartObjectList requests =
+ CreateGlobalPropertiesRequestsToHMI(app);
for (smart_objects::SmartObjectList::const_iterator it = requests.begin();
- it != requests.end(); ++it) {
- DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it))
+ it != requests.end();
+ ++it) {
+ DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
}
}
-smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHMI(
- ApplicationConstSharedPtr app) {
+smart_objects::SmartObjectList
+MessageHelper::CreateGlobalPropertiesRequestsToHMI(
+ ApplicationConstSharedPtr app) {
LOG4CXX_AUTO_TRACE(logger_);
smart_objects::SmartObjectList requests;
@@ -825,26 +836,16 @@ smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHM
// UI global properties
if (app->vr_help_title() || app->vr_help()) {
- smart_objects::SmartObjectSPtr ui_global_properties =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
-
+ smart_objects::SmartObjectSPtr ui_global_properties = CreateRequestObject();
if (!ui_global_properties) {
return requests;
}
(*ui_global_properties)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
- (*ui_global_properties)[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- (*ui_global_properties)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*ui_global_properties)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*ui_global_properties)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ static_cast<int>(hmi_apis::FunctionID::UI_SetGlobalProperties);
- smart_objects::SmartObject ui_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject ui_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if (app->vr_help_title()) {
ui_msg_params[strings::vr_help_title] = (*app->vr_help_title());
}
@@ -870,25 +871,16 @@ smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHM
// TTS global properties
if (app->help_prompt() || app->timeout_prompt()) {
smart_objects::SmartObjectSPtr tts_global_properties =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
-
+ CreateRequestObject();
if (!tts_global_properties) {
return requests;
}
(*tts_global_properties)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
- (*tts_global_properties)[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- (*tts_global_properties)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*tts_global_properties)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*tts_global_properties)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
- smart_objects::SmartObject tts_msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject tts_msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if (app->help_prompt()) {
tts_msg_params[strings::help_prompt] = (*app->help_prompt());
}
@@ -904,30 +896,22 @@ smart_objects::SmartObjectList MessageHelper::CreateGlobalPropertiesRequestsToHM
return requests;
}
-void MessageHelper::SendTTSGlobalProperties(
- ApplicationSharedPtr app, bool default_help_prompt) {
+void MessageHelper::SendTTSGlobalProperties(ApplicationSharedPtr app,
+ const bool default_help_prompt) {
LOG4CXX_AUTO_TRACE(logger_);
if (!app) {
return;
}
- smart_objects::SmartObjectSPtr tts_global_properties(
- new smart_objects::SmartObject);
+ smart_objects::SmartObjectSPtr tts_global_properties = CreateRequestObject();
if (tts_global_properties) {
smart_objects::SmartObject& so_to_send = *tts_global_properties;
so_to_send[strings::params][strings::function_id] =
static_cast<int>(hmi_apis::FunctionID::TTS_SetGlobalProperties);
- so_to_send[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- so_to_send[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- so_to_send[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- so_to_send[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- msg_params[strings::help_prompt] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::help_prompt] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
if (default_help_prompt) {
const DataAccessor<CommandsMap> accessor = app->commands_map();
const CommandsMap& commands = accessor.GetData();
@@ -935,8 +919,10 @@ void MessageHelper::SendTTSGlobalProperties(
uint32_t index = 0;
for (; commands.end() != it; ++it) {
smart_objects::SmartObject item(smart_objects::SmartType_Map);
- if ((*it->second).keyExists(strings::menu_params)){
- item[strings::text] = (*it->second)[strings::menu_params][strings::menu_name].asString();
+ if ((*it->second).keyExists(strings::menu_params)) {
+ item[strings::text] =
+ (*it->second)[strings::menu_params][strings::menu_name]
+ .asString();
item[strings::type] = mobile_apis::SpeechCapabilities::SC_TEXT;
} else {
continue;
@@ -952,9 +938,9 @@ void MessageHelper::SendTTSGlobalProperties(
}
smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
- ApplicationConstSharedPtr app) {
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ ApplicationConstSharedPtr app) {
+ smart_objects::SmartObjectSPtr result =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!result) {
return NULL;
}
@@ -985,7 +971,6 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAppVrHelp(
smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
ApplicationConstSharedPtr app) {
-
smart_objects::SmartObjectList requests;
if (!app) {
LOG4CXX_ERROR(logger_, "Invalid application");
@@ -993,18 +978,10 @@ smart_objects::SmartObjectList MessageHelper::CreateShowRequestToHMI(
}
if (app->show_command()) {
- smart_objects::SmartObjectSPtr ui_show = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr ui_show = CreateRequestObject();
(*ui_show)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_Show);
- (*ui_show)[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- (*ui_show)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*ui_show)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*ui_show)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ static_cast<int>(hmi_apis::FunctionID::UI_Show);
+
(*ui_show)[strings::msg_params] = (*app->show_command());
requests.push_back(ui_show);
}
@@ -1018,34 +995,26 @@ void MessageHelper::SendShowRequestToHMI(ApplicationConstSharedPtr app) {
smart_objects::SmartObjectList shows = CreateShowRequestToHMI(app);
for (smart_objects::SmartObjectList::const_iterator it = shows.begin();
- it != shows.end(); ++it) {
+ it != shows.end();
+ ++it) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
}
-
}
void MessageHelper::SendShowConstantTBTRequestToHMI(
- ApplicationConstSharedPtr app) {
+ ApplicationConstSharedPtr app) {
if (!app) {
return;
}
if (app->tbt_show_command()) {
- utils::SharedPtr<smart_objects::SmartObject> navi_show_tbt =
- new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr navi_show_tbt = CreateRequestObject();
if (!navi_show_tbt) {
return;
}
(*navi_show_tbt)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::Navigation_ShowConstantTBT);
- (*navi_show_tbt)[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- (*navi_show_tbt)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*navi_show_tbt)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*navi_show_tbt)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ static_cast<int>(hmi_apis::FunctionID::Navigation_ShowConstantTBT);
+
(*navi_show_tbt)[strings::msg_params] = (*app->tbt_show_command());
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(navi_show_tbt));
}
@@ -1056,15 +1025,15 @@ void MessageHelper::SendAddCommandRequestToHMI(ApplicationConstSharedPtr app) {
return;
}
smart_objects::SmartObjectList requests = CreateAddCommandRequestToHMI(app);
- for (smart_objects::SmartObjectList::iterator it = requests.begin(); it != requests.end();
+ for (smart_objects::SmartObjectList::iterator it = requests.begin();
+ it != requests.end();
++it) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
}
}
smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
- ApplicationConstSharedPtr app) {
-
+ ApplicationConstSharedPtr app) {
smart_objects::SmartObjectList requests;
if (!app) {
LOG4CXX_ERROR(logger_, "Invalid application");
@@ -1077,32 +1046,22 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
for (; commands.end() != i; ++i) {
// UI Interface
if ((*i->second).keyExists(strings::menu_params)) {
- smart_objects::SmartObjectSPtr ui_command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+ smart_objects::SmartObjectSPtr ui_command = CreateRequestObject();
if (!ui_command) {
return requests;
}
(*ui_command)[strings::params][strings::function_id] =
- static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
- (*ui_command)[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- (*ui_command)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*ui_command)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*ui_command)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::cmd_id] = i->first;
msg_params[strings::menu_params] = (*i->second)[strings::menu_params];
msg_params[strings::app_id] = app->app_id();
- if (((*i->second).keyExists(strings::cmd_icon))
- && (0 < (*i->second)[strings::cmd_icon][strings::value].length())) {
+ if (((*i->second).keyExists(strings::cmd_icon)) &&
+ (0 < (*i->second)[strings::cmd_icon][strings::value].length())) {
msg_params[strings::cmd_icon] = (*i->second)[strings::cmd_icon];
msg_params[strings::cmd_icon][strings::value] =
(*i->second)[strings::cmd_icon][strings::value].asString();
@@ -1113,37 +1072,71 @@ smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
// VR Interface
if ((*i->second).keyExists(strings::vr_commands)) {
- SendAddVRCommandToHMI(i->first, (*i->second)[strings::vr_commands],
- app->app_id());
+ SendAddVRCommandToHMI(
+ i->first, (*i->second)[strings::vr_commands], app->app_id());
+ }
+ }
+ return requests;
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ ApplicationConstSharedPtr app) {
+ smart_objects::SmartObjectList requests;
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid application");
+ return requests;
+ }
+
+ const DataAccessor<ChoiceSetMap> accessor = app->choice_set_map();
+ const ChoiceSetMap& choices = accessor.GetData();
+ ChoiceSetMap::const_iterator it = choices.begin();
+ for (; choices.end() != it; ++it) {
+ const uint32_t choice_grammar_id =
+ (*(it->second))[strings::grammar_id].asUInt();
+ const size_t size = (*(it->second))[strings::choice_set].length();
+ for (size_t j = 0; j < size; ++j) {
+ smart_objects::SmartObjectSPtr vr_command = CreateRequestObject();
+ if (!vr_command) {
+ return requests;
+ }
+
+ (*vr_command)[strings::params][strings::function_id] =
+ static_cast<int>(hmi_apis::FunctionID::VR_AddCommand);
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ msg_params[strings::app_id] = app->app_id();
+ msg_params[strings::cmd_id] =
+ (*(it->second))[strings::choice_set][j][strings::choice_id];
+ msg_params[strings::vr_commands] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ msg_params[strings::vr_commands] =
+ (*(it->second))[strings::choice_set][j][strings::vr_commands];
+ msg_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
+ msg_params[strings::grammar_id] = choice_grammar_id;
+
+ (*vr_command)[strings::msg_params] = msg_params;
+ requests.push_back(vr_command);
}
}
return requests;
}
smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration(
- int32_t function_id, int32_t language, uint32_t app_id,
+ const int32_t function_id,
+ const int32_t language,
+ const uint32_t app_id,
const smart_objects::SmartObject* app_types) {
- smart_objects::SmartObjectSPtr command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr command = CreateRequestObject();
if (!command) {
return NULL;
}
smart_objects::SmartObject& params = *command;
-
- params[strings::params][strings::message_type] =
- static_cast<int>(hmi_apis::messageType::request);
- params[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- params[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
-
params[strings::params][strings::function_id] = function_id;
- params[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::language] = language;
msg_params[strings::app_id] = app_id;
@@ -1155,16 +1148,19 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateChangeRegistration(
return command;
}
-void MessageHelper::SendUIChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app) {
+void MessageHelper::SendUIChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app) {
if (!app.valid()) {
LOG4CXX_ERROR(logger_, "Application is not valid");
return;
}
if (NULL != app->app_types()) {
- smart_objects::SmartObjectSPtr ui_command = CreateChangeRegistration(
- hmi_apis::FunctionID::UI_ChangeRegistration, app->ui_language(),
- app->app_id(), app->app_types());
+ smart_objects::SmartObjectSPtr ui_command =
+ CreateChangeRegistration(hmi_apis::FunctionID::UI_ChangeRegistration,
+ app->ui_language(),
+ app->app_id(),
+ app->app_types());
if (ui_command) {
ApplicationManagerImpl::instance()->ManageHMICommand(ui_command);
@@ -1172,14 +1168,16 @@ void MessageHelper::SendUIChangeRegistrationRequestToHMI(ApplicationConstSharedP
}
}
-void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr app) {
+void MessageHelper::SendChangeRegistrationRequestToHMI(
+ ApplicationConstSharedPtr app) {
if (!app.valid()) {
return;
}
if (mobile_apis::Language::INVALID_ENUM != app->language()) {
- smart_objects::SmartObjectSPtr vr_command = CreateChangeRegistration(
- hmi_apis::FunctionID::VR_ChangeRegistration, app->language(),
- app->app_id());
+ smart_objects::SmartObjectSPtr vr_command =
+ CreateChangeRegistration(hmi_apis::FunctionID::VR_ChangeRegistration,
+ app->language(),
+ app->app_id());
if (vr_command) {
ApplicationManagerImpl::instance()->ManageHMICommand(vr_command);
@@ -1187,9 +1185,10 @@ void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr
}
if (mobile_apis::Language::INVALID_ENUM != app->language()) {
- smart_objects::SmartObjectSPtr tts_command = CreateChangeRegistration(
- hmi_apis::FunctionID::TTS_ChangeRegistration, app->language(),
- app->app_id());
+ smart_objects::SmartObjectSPtr tts_command =
+ CreateChangeRegistration(hmi_apis::FunctionID::TTS_ChangeRegistration,
+ app->language(),
+ app->app_id());
if (tts_command) {
ApplicationManagerImpl::instance()->ManageHMICommand(tts_command);
@@ -1197,49 +1196,40 @@ void MessageHelper::SendChangeRegistrationRequestToHMI(ApplicationConstSharedPtr
}
if (mobile_apis::Language::INVALID_ENUM != app->ui_language()) {
- smart_objects::SmartObjectSPtr ui_command = CreateChangeRegistration(
- hmi_apis::FunctionID::UI_ChangeRegistration, app->ui_language(),
- app->app_id());
+ smart_objects::SmartObjectSPtr ui_command =
+ CreateChangeRegistration(hmi_apis::FunctionID::UI_ChangeRegistration,
+ app->ui_language(),
+ app->app_id());
if (ui_command) {
ApplicationManagerImpl::instance()->ManageHMICommand(ui_command);
}
-
}
}
void MessageHelper::SendAddVRCommandToHMI(
- uint32_t cmd_id, const smart_objects::SmartObject& vr_commands,
- uint32_t app_id) {
- smart_objects::SmartObjectSPtr request = CreateAddVRCommandToHMI(cmd_id,
- vr_commands,
- app_id);
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id) {
+ smart_objects::SmartObjectSPtr request =
+ CreateAddVRCommandToHMI(cmd_id, vr_commands, app_id);
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(request));
}
smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
- uint32_t cmd_id, const smart_objects::SmartObject& vr_commands,
- uint32_t app_id) {
- smart_objects::SmartObjectSPtr vr_command = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+ const uint32_t cmd_id,
+ const smart_objects::SmartObject& vr_commands,
+ const uint32_t app_id) {
+ smart_objects::SmartObjectSPtr vr_command = CreateRequestObject();
if (!vr_command) {
return NULL;
}
(*vr_command)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::VR_AddCommand;
- (*vr_command)[strings::params][strings::message_type] =
- hmi_apis::messageType::request;
- (*vr_command)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*vr_command)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*vr_command)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ hmi_apis::FunctionID::VR_AddCommand;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
if (0 != cmd_id) {
msg_params[strings::cmd_id] = cmd_id;
}
@@ -1248,7 +1238,7 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
msg_params[strings::app_id] = app_id;
}
msg_params[strings::grammar_id] =
- ApplicationManagerImpl::instance()->application(app_id)->get_grammar_id();
+ ApplicationManagerImpl::instance()->application(app_id)->get_grammar_id();
msg_params[strings::type] = hmi_apis::Common_VRCommandType::Command;
(*vr_command)[strings::msg_params] = msg_params;
@@ -1256,11 +1246,15 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateAddVRCommandToHMI(
return vr_command;
}
-bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
- smart_objects::SmartObject& output) {
- using namespace smart_objects;
+bool MessageHelper::CreateHMIApplicationStruct(
+ ApplicationConstSharedPtr app,
+ const protocol_handler::SessionObserver& session_observer,
+ NsSmartDeviceLink::NsSmartObjects::SmartObject* output) {
LOG4CXX_AUTO_TRACE(logger_);
+ using smart_objects::SmartObject;
+ DCHECK(output);
+ SmartObject& message = *output;
if (!app) {
LOG4CXX_WARN(logger_, "Application is not valid");
return false;
@@ -1269,59 +1263,56 @@ bool MessageHelper::CreateHMIApplicationStruct(ApplicationConstSharedPtr app,
const SmartObject* app_types = app->app_types();
const SmartObject* ngn_media_screen_name = app->ngn_media_screen_name();
const connection_handler::DeviceHandle handle = app->device();
- std::string device_name = ApplicationManagerImpl::instance()->GetDeviceName(handle);
-
+ std::string device_name =
+ ApplicationManagerImpl::instance()->GetDeviceName(handle);
std::string mac_address;
std::string transport_type;
- if (-1 == connection_handler::ConnectionHandlerImpl::instance()->
- GetDataOnDeviceID(app->device(), &device_name,
- NULL, &mac_address, &transport_type)) {
- LOG4CXX_ERROR(logger_, "Failed to extract information for device "
- << app->device());
+ if (-1 ==
+ session_observer.GetDataOnDeviceID(
+ app->device(), &device_name, NULL, &mac_address, &transport_type)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to extract information for device " << app->device());
}
- output = SmartObject(SmartType_Map);
- output[strings::app_name] = app->name();
- output[strings::icon] = app->app_icon_path();
- output[strings::app_id] = app->hmi_app_id();
-
+ message = SmartObject(smart_objects::SmartType_Map);
+ message[strings::app_name] = app->name();
+ message[strings::app_id] = app->hmi_app_id();
+ const std::string icon_path = app->app_icon_path();
+ if (!icon_path.empty()) {
+ message[strings::icon] = icon_path;
+ }
if (app->IsRegistered()) {
- output[strings::hmi_display_language_desired] = app->ui_language();
- output[strings::is_media_application] = app->is_media_application();
- }
-
- if (!app->IsRegistered()) {
- output[strings::greyOut] = app->is_greyed_out();
- const SmartObject* app_tts_name = app->tts_name();
- DCHECK_OR_RETURN(app_tts_name, false);
- if (!app_tts_name->empty()) {
- SmartObject output_tts_name = SmartObject(SmartType_Array);
- output_tts_name[0][strings::text] = *(app->tts_name());
- output_tts_name[0][strings::type] = hmi_apis::Common_SpeechCapabilities::SC_TEXT;
- output[json::ttsName] = output_tts_name;
- }
- if (!app->vr_synonyms()->empty()) {
- output[json::vrSynonyms] = *(app->vr_synonyms());
- }
+ message[strings::hmi_display_language_desired] = app->ui_language();
+ message[strings::is_media_application] = app->is_media_application();
+ } else {
+ message[strings::greyOut] = app->is_greyed_out();
+ }
+ if (app->tts_name() && !app->tts_name()->empty()) {
+ message[json::ttsName] = *(app->tts_name());
+ }
+ if (app->vr_synonyms() && !app->vr_synonyms()->empty()) {
+ message[json::vrSynonyms] = *(app->vr_synonyms());
}
-
if (ngn_media_screen_name) {
- output[strings::ngn_media_screen_app_name] = ngn_media_screen_name->asString();
+ message[strings::ngn_media_screen_app_name] =
+ ngn_media_screen_name->asString();
}
if (app_types) {
- output[strings::app_type] = *app_types;
+ message[strings::app_type] = *app_types;
}
- output[strings::device_info] = smart_objects::SmartObject(smart_objects::SmartType_Map);
- output[strings::device_info][strings::name] = device_name;
- output[strings::device_info][strings::id] = mac_address;
+ message[strings::device_info] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ message[strings::device_info][strings::name] = device_name;
+ message[strings::device_info][strings::id] = mac_address;
const policy::DeviceConsent device_consent =
policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_address);
- output[strings::device_info][strings::isSDLAllowed] =
+ message[strings::device_info][strings::isSDLAllowed] =
policy::DeviceConsent::kDeviceAllowed == device_consent;
- output[strings::device_info][strings::transport_type] =
- ApplicationManagerImpl::instance()->GetDeviceTransportType(transport_type);
+ message[strings::device_info][strings::transport_type] =
+ ApplicationManagerImpl::instance()->GetDeviceTransportType(
+ transport_type);
return true;
}
@@ -1333,44 +1324,35 @@ void MessageHelper::SendAddSubMenuRequestToHMI(ApplicationConstSharedPtr app) {
smart_objects::SmartObjectList requests = CreateAddSubMenuRequestToHMI(app);
for (smart_objects::SmartObjectList::iterator it = requests.begin();
- it != requests.end(); ++it) {
+ it != requests.end();
+ ++it) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(*it));
}
}
smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
- ApplicationConstSharedPtr app) {
+ ApplicationConstSharedPtr app) {
smart_objects::SmartObjectList requsets;
const DataAccessor<SubMenuMap> accessor = app->sub_menu_map();
const SubMenuMap& sub_menu = accessor.GetData();
SubMenuMap::const_iterator i = sub_menu.begin();
for (; sub_menu.end() != i; ++i) {
- smart_objects::SmartObjectSPtr ui_sub_menu = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+ smart_objects::SmartObjectSPtr ui_sub_menu = CreateRequestObject();
if (!ui_sub_menu) {
return requsets;
}
(*ui_sub_menu)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::UI_AddSubMenu;
- (*ui_sub_menu)[strings::params][strings::message_type] =
- hmi_apis::messageType::request;
- (*ui_sub_menu)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*ui_sub_menu)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*ui_sub_menu)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ hmi_apis::FunctionID::UI_AddSubMenu;
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::menu_id] = i->first;
msg_params[strings::menu_params][strings::position] =
- (*i->second)[strings::position];
+ (*i->second)[strings::position];
msg_params[strings::menu_params][strings::menu_name] =
- (*i->second)[strings::menu_name];
+ (*i->second)[strings::menu_name];
msg_params[strings::app_id] = app->app_id();
(*ui_sub_menu)[strings::msg_params] = msg_params;
requsets.push_back(ui_sub_menu);
@@ -1379,67 +1361,63 @@ smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
}
void MessageHelper::SendOnAppUnregNotificationToHMI(
- ApplicationConstSharedPtr app, bool is_unexpected_disconnect) {
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ ApplicationConstSharedPtr app, const bool is_unexpected_disconnect) {
+ smart_objects::SmartObjectSPtr notification =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!notification) {
return;
}
-
smart_objects::SmartObject& message = *notification;
message[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered;
+ hmi_apis::FunctionID::BasicCommunication_OnAppUnregistered;
message[strings::params][strings::message_type] = MessageType::kNotification;
- // we put hmi_app_id because applicaton list does not contain application on this momment
- // and ReplaceHMIByMobileAppId function will be unable to replace app_id to hmi_app_id
+ // we put hmi_app_id because applicaton list does not contain application on
+ // this momment
+ // and ReplaceHMIByMobileAppId function will be unable to replace app_id to
+ // hmi_app_id
message[strings::msg_params][strings::app_id] = app->hmi_app_id();
message[strings::msg_params][strings::unexpected_disconnect] =
- is_unexpected_disconnect;
+ is_unexpected_disconnect;
ApplicationManagerImpl::instance()->ManageHMICommand(notification);
}
-uint32_t MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority) {
- uint32_t correlation_id = 0;
- application_manager::ApplicationConstSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
- ->application(app_id);
- if (!app) {
- LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id);
- return correlation_id;
- }
+smart_objects::SmartObjectSPtr
+MessageHelper::GetBCActivateAppRequestToHMI(
+ ApplicationConstSharedPtr app,
+ const hmi_apis::Common_HMILevel::eType level,
+ const bool send_policy_priority) {
+ DCHECK_OR_RETURN(app, smart_objects::SmartObjectSPtr());
- correlation_id =
+ const uint32_t correlation_id =
ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
- utils::SharedPtr<smart_objects::SmartObject> message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message =
+ utils::MakeShared<smart_objects::SmartObject>(
+ smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_ActivateApp;
+ hmi_apis::FunctionID::BasicCommunication_ActivateApp;
(*message)[strings::params][strings::message_type] = MessageType::kRequest;
(*message)[strings::params][strings::correlation_id] = correlation_id;
- (*message)[strings::msg_params][strings::app_id] = app_id;
+ (*message)[strings::msg_params][strings::app_id] = app->app_id();
if (send_policy_priority) {
std::string priority;
// TODO(KKolodiy): need remove method policy_manager
- policy::PolicyHandler::instance()->GetPriority(
- app->mobile_app_id(), &priority);
+ policy::PolicyHandler::instance()->GetPriority(app->mobile_app_id(),
+ &priority);
// According SDLAQ-CRS-2794
// SDL have to send ActivateApp without "proirity" parameter to HMI.
// in case of unconsented device
- std::string mac_adress;
- connection_handler::DeviceHandle device_handle = app->device();
- connection_handler::ConnectionHandlerImpl::instance()->
- GetDataOnDeviceID(device_handle, NULL, NULL, &mac_adress, NULL);
+ const std::string& mac_adress = app->mac_address();
policy::DeviceConsent consent =
policy::PolicyHandler::instance()->GetUserConsentForDevice(mac_adress);
- if (!priority.empty() && (policy::DeviceConsent::kDeviceAllowed == consent)) {
- (*message)[strings::msg_params][strings::priority] = GetPriorityCode(priority);
+ if (!priority.empty() &&
+ (policy::DeviceConsent::kDeviceAllowed == consent)) {
+ (*message)[strings::msg_params][strings::priority] =
+ GetPriorityCode(priority);
}
}
@@ -1448,106 +1426,73 @@ uint32_t MessageHelper::SendActivateAppToHMI(uint32_t const app_id,
hmi_apis::Common_HMILevel::FULL != level) {
(*message)[strings::msg_params][strings::activate_app_hmi_level] = level;
}
-
- ApplicationManagerImpl::instance()->ManageHMICommand(message);
- return correlation_id;
+ return message;
}
void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id) {
LOG4CXX_WARN(logger_, "SendOnResumeAudioSourceToHMI app_id: " << app_id);
application_manager::ApplicationConstSharedPtr app =
- application_manager::ApplicationManagerImpl::instance()
- ->application(app_id);
+ application_manager::ApplicationManagerImpl::instance()->application(
+ app_id);
if (!app) {
LOG4CXX_WARN(logger_, "Invalid app_id: " << app_id);
return;
}
- utils::SharedPtr<smart_objects::SmartObject> message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ utils::SharedPtr<smart_objects::SmartObject> message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource;
- (*message)[strings::params][strings::message_type] = MessageType::kNotification;
+ hmi_apis::FunctionID::BasicCommunication_OnResumeAudioSource;
+ (*message)[strings::params][strings::message_type] =
+ MessageType::kNotification;
(*message)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+ ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
(*message)[strings::msg_params][strings::app_id] = app_id;
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
-std::string MessageHelper::GetDeviceMacAddressForHandle(
- const uint32_t device_handle) {
-
- std::string device_mac_address = "";
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnDeviceID(
- device_handle, NULL, NULL, &device_mac_address);
- LOG4CXX_DEBUG(logger_, "result : " << device_handle);
- return device_mac_address;
-}
-
-void MessageHelper::GetDeviceInfoForHandle(const uint32_t device_handle,
- policy::DeviceParams* device_info) {
- if (!device_info) {
- return;
- }
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnDeviceID(
- device_handle, &device_info->device_name, NULL,
- &device_info->device_mac_address, &device_info->device_connection_type);
-}
-
-void MessageHelper::GetDeviceInfoForApp(uint32_t connection_key,
- policy::DeviceParams* device_info) {
- if (!device_info) {
- return;
- }
-
- device_info->device_handle = ApplicationManagerImpl::instance()->application(
- connection_key)->device();
-
- GetDeviceInfoForHandle(device_info->device_handle, device_info);
-}
-
-void MessageHelper::SendSDLActivateAppResponse(policy::AppPermissions& permissions,
- uint32_t correlation_id) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+void MessageHelper::SendSDLActivateAppResponse(
+ policy::AppPermissions& permissions, const uint32_t correlation_id) {
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_ActivateApp;
+ hmi_apis::FunctionID::SDL_ActivateApp;
(*message)[strings::params][strings::message_type] = MessageType::kResponse;
(*message)[strings::params][strings::correlation_id] = correlation_id;
(*message)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
+ commands::CommandImpl::hmi_protocol_type_;
(*message)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
+ commands::CommandImpl::protocol_version_;
(*message)[strings::params][hmi_response::code] = 0;
(*message)[strings::msg_params]["isSDLAllowed"] = permissions.isSDLAllowed;
if (!permissions.isSDLAllowed) {
- (*message)[strings::msg_params]["device"]["name"] = permissions.deviceInfo
- .device_name;
- (*message)[strings::msg_params]["device"]["id"] = permissions.deviceInfo
- .device_mac_address;
+ (*message)[strings::msg_params]["device"]["name"] =
+ permissions.deviceInfo.device_name;
+ (*message)[strings::msg_params]["device"]["id"] =
+ permissions.deviceInfo.device_mac_address;
}
(*message)[strings::msg_params]["isAppRevoked"] = permissions.appRevoked;
- (*message)[strings::msg_params]["isAppPermissionsRevoked"] = permissions
- .isAppPermissionsRevoked;
+ (*message)[strings::msg_params]["isAppPermissionsRevoked"] =
+ permissions.isAppPermissionsRevoked;
if (permissions.isAppPermissionsRevoked) {
FillAppRevokedPermissions(permissions, *message);
}
- (*message)[strings::msg_params]["isPermissionsConsentNeeded"] = permissions
- .appPermissionsConsentNeeded;
+ (*message)[strings::msg_params]["isPermissionsConsentNeeded"] =
+ permissions.appPermissionsConsentNeeded;
if (!permissions.priority.empty()) {
- (*message)[strings::msg_params]["priority"] = GetPriorityCode(
- permissions.priority);
+ (*message)[strings::msg_params]["priority"] =
+ GetPriorityCode(permissions.priority);
}
ApplicationManagerImpl::instance()->ManageHMICommand(message);
@@ -1559,45 +1504,37 @@ void MessageHelper::SendSDLActivateAppResponse(policy::AppPermissions& permissio
}
void MessageHelper::SendOnSDLConsentNeeded(
- const policy::DeviceParams& device_info) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ const policy::DeviceParams& device_info) {
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_OnSDLConsentNeeded;
+ hmi_apis::FunctionID::SDL_OnSDLConsentNeeded;
(*message)[strings::params][strings::message_type] =
- MessageType::kNotification;
+ MessageType::kNotification;
- (*message)[strings::msg_params]["device"]["id"] = device_info.device_mac_address;
+ (*message)[strings::msg_params]["device"]["id"] =
+ device_info.device_mac_address;
(*message)[strings::msg_params]["device"]["name"] = device_info.device_name;
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
-void MessageHelper::SendPolicyUpdate(
- const std::string& file_path,
- int timeout,
- const std::vector<int>& retries) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+void MessageHelper::SendPolicyUpdate(const std::string& file_path,
+ const int timeout,
+ const std::vector<int>& retries) {
+ smart_objects::SmartObjectSPtr message = CreateRequestObject();
smart_objects::SmartObject& object = *message;
object[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_PolicyUpdate;
- object[strings::params][strings::message_type] = MessageType::kRequest;
- object[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
- object[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- object[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
+ hmi_apis::FunctionID::BasicCommunication_PolicyUpdate;
object[strings::msg_params][hmi_request::file] = file_path;
object[strings::msg_params][strings::timeout] = timeout;
- object[strings::msg_params][hmi_request::retry] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ object[strings::msg_params][hmi_request::retry] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
for (size_t i = 0; i < retries.size(); ++i) {
object[strings::msg_params][hmi_request::retry][i] = retries[i];
}
@@ -1605,40 +1542,41 @@ void MessageHelper::SendPolicyUpdate(
}
void MessageHelper::SendGetUserFriendlyMessageResponse(
- const std::vector<policy::UserFriendlyMessage>& msg,
- uint32_t correlation_id) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ const std::vector<policy::UserFriendlyMessage>& msg,
+ const uint32_t correlation_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_GetUserFriendlyMessage;
- (*message)[strings::params][strings::message_type] =
- MessageType::kResponse;
+ hmi_apis::FunctionID::SDL_GetUserFriendlyMessage;
+ (*message)[strings::params][strings::message_type] = MessageType::kResponse;
(*message)[strings::params][strings::correlation_id] = correlation_id;
(*message)[strings::params][hmi_response::code] = 0;
// If no any messages found - skip sending of "messages" param
if (msg.empty()) {
ApplicationManagerImpl::instance()->ManageHMICommand(message);
+ return;
}
const std::string messages = "messages";
(*message)[strings::msg_params][messages] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& user_friendly_messages =
- (*message)[strings::msg_params][messages];
+ (*message)[strings::msg_params][messages];
const std::string message_code = "messageCode";
std::vector<policy::UserFriendlyMessage>::const_iterator it = msg.begin();
std::vector<policy::UserFriendlyMessage>::const_iterator it_end = msg.end();
for (uint32_t index = 0; it != it_end; ++it, ++index) {
- user_friendly_messages[index] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ user_friendly_messages[index] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& obj = user_friendly_messages[index];
obj[message_code] = it->message_code;
@@ -1649,34 +1587,33 @@ void MessageHelper::SendGetUserFriendlyMessageResponse(
void MessageHelper::SendGetListOfPermissionsResponse(
const std::vector<policy::FunctionalGroupPermission>& permissions,
- uint32_t correlation_id) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ const uint32_t correlation_id) {
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_GetListOfPermissions;
- (*message)[strings::params][strings::message_type] =
- MessageType::kResponse;
+ hmi_apis::FunctionID::SDL_GetListOfPermissions;
+ (*message)[strings::params][strings::message_type] = MessageType::kResponse;
(*message)[strings::params][strings::correlation_id] = correlation_id;
(*message)[strings::params][hmi_response::code] = 0;
const std::string allowed_functions = "allowedFunctions";
(*message)[strings::msg_params][allowed_functions] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& allowed_functions_array =
- (*message)[strings::msg_params][allowed_functions];
+ (*message)[strings::msg_params][allowed_functions];
std::vector<policy::FunctionalGroupPermission>::const_iterator it =
- permissions.begin();
+ permissions.begin();
std::vector<policy::FunctionalGroupPermission>::const_iterator it_end =
- permissions.end();
+ permissions.end();
for (uint32_t index = 0; it != it_end; ++it, ++index) {
- allowed_functions_array[index] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ allowed_functions_array[index] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& item = allowed_functions_array[index];
item[strings::name] = (*it).group_alias;
@@ -1692,19 +1629,21 @@ void MessageHelper::SendGetListOfPermissionsResponse(
}
smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
- uint32_t connection_key, int32_t function_id, uint32_t correlation_id,
+ uint32_t connection_key,
+ int32_t function_id,
+ uint32_t correlation_id,
int32_t result_code) {
- smart_objects::SmartObjectSPtr response = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr response =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& response_data = *response;
response_data[strings::params][strings::function_id] = function_id;
response_data[strings::params][strings::message_type] =
- mobile_apis::messageType::response;
+ mobile_apis::messageType::response;
response_data[strings::params][strings::correlation_id] = correlation_id;
response_data[strings::params][strings::protocol_type] =
- commands::CommandImpl::mobile_protocol_type_;
+ commands::CommandImpl::mobile_protocol_type_;
response_data[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
+ commands::CommandImpl::protocol_version_;
response_data[strings::msg_params][strings::result_code] = result_code;
response_data[strings::msg_params][strings::success] = false;
response_data[strings::params][strings::connection_key] = connection_key;
@@ -1712,45 +1651,38 @@ smart_objects::SmartObjectSPtr MessageHelper::CreateNegativeResponse(
return response;
}
-void MessageHelper::SendNaviStartStream(int32_t connection_key) {
+void MessageHelper::SendNaviStartStream(const int32_t app_id) {
LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr start_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+ smart_objects::SmartObjectSPtr start_stream = CreateRequestObject();
if (!start_stream) {
return;
}
(*start_stream)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Navigation_StartStream;
- (*start_stream)[strings::params][strings::message_type] =
- hmi_apis::messageType::request;
- (*start_stream)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*start_stream)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*start_stream)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- uint32_t app_id = 0;
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnSessionKey(
- connection_key, &app_id);
+ hmi_apis::FunctionID::Navigation_StartStream;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
char url[100] = {'\0'};
if ("socket" == profile::Profile::instance()->video_server_type()) {
- snprintf(url, sizeof(url) / sizeof(url[0]), "http://%s:%d",
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "http://%s:%d",
profile::Profile::instance()->server_address().c_str(),
profile::Profile::instance()->video_streaming_port());
} else if ("pipe" == profile::Profile::instance()->video_server_type()) {
- snprintf(url, sizeof(url) / sizeof(url[0]), "%s",
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
profile::Profile::instance()->named_video_pipe_path().c_str());
} else {
int snprintf_result;
- snprintf_result = snprintf(url, sizeof(url) / sizeof(url[0]), "%s",
- profile::Profile::instance()->video_stream_file().c_str());
+ snprintf_result =
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
+ profile::Profile::instance()->video_stream_file().c_str());
DCHECK(snprintf_result);
}
msg_params[strings::app_id] = app_id;
@@ -1761,31 +1693,18 @@ void MessageHelper::SendNaviStartStream(int32_t connection_key) {
ApplicationManagerImpl::instance()->ManageHMICommand(start_stream);
}
-void MessageHelper::SendNaviStopStream(int32_t connection_key) {
- smart_objects::SmartObjectSPtr stop_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+void MessageHelper::SendNaviStopStream(const int32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr stop_stream = CreateRequestObject();
if (!stop_stream) {
return;
}
(*stop_stream)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Navigation_StopStream;
- (*stop_stream)[strings::params][strings::message_type] =
- hmi_apis::messageType::request;
- (*stop_stream)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*stop_stream)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*stop_stream)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- uint32_t app_id = 0;
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnSessionKey(
- connection_key, &app_id);
+ hmi_apis::FunctionID::Navigation_StopStream;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app_id;
@@ -1794,45 +1713,38 @@ void MessageHelper::SendNaviStopStream(int32_t connection_key) {
ApplicationManagerImpl::instance()->ManageHMICommand(stop_stream);
}
-void MessageHelper::SendAudioStartStream(int32_t connection_key) {
-
- smart_objects::SmartObjectSPtr start_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+void MessageHelper::SendAudioStartStream(const int32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr start_stream = CreateRequestObject();
if (!start_stream) {
return;
}
(*start_stream)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Navigation_StartAudioStream;
- (*start_stream)[strings::params][strings::message_type] =
- hmi_apis::messageType::request;
- (*start_stream)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*start_stream)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*start_stream)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- uint32_t app_id = 0;
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnSessionKey(
- connection_key, &app_id);
+ hmi_apis::FunctionID::Navigation_StartAudioStream;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
char url[100] = {'\0'};
if ("socket" == profile::Profile::instance()->audio_server_type()) {
- snprintf(url, sizeof(url) / sizeof(url[0]), "http://%s:%d",
- profile::Profile::instance()->server_address().c_str(),
- profile::Profile::instance()->audio_streaming_port());
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "http://%s:%d",
+ profile::Profile::instance()->server_address().c_str(),
+ profile::Profile::instance()->audio_streaming_port());
} else if ("pipe" == profile::Profile::instance()->audio_server_type()) {
- snprintf(url, sizeof(url) / sizeof(url[0]), "%s",
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
profile::Profile::instance()->named_audio_pipe_path().c_str());
} else {
int snprintf_result;
- snprintf_result = snprintf(url, sizeof(url) / sizeof(url[0]), "%s",
- profile::Profile::instance()->audio_stream_file().c_str());
+ snprintf_result =
+ snprintf(url,
+ sizeof(url) / sizeof(url[0]),
+ "%s",
+ profile::Profile::instance()->audio_stream_file().c_str());
DCHECK(snprintf_result);
}
@@ -1844,31 +1756,18 @@ void MessageHelper::SendAudioStartStream(int32_t connection_key) {
DCHECK(ApplicationManagerImpl::instance()->ManageHMICommand(start_stream));
}
-void MessageHelper::SendAudioStopStream(int32_t connection_key) {
- smart_objects::SmartObjectSPtr stop_stream = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
+void MessageHelper::SendAudioStopStream(const int32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr stop_stream = CreateRequestObject();
if (!stop_stream) {
return;
}
(*stop_stream)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::Navigation_StopAudioStream;
- (*stop_stream)[strings::params][strings::message_type] =
- hmi_apis::messageType::request;
- (*stop_stream)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*stop_stream)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
- (*stop_stream)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
-
- smart_objects::SmartObject msg_params = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
-
- uint32_t app_id = 0;
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnSessionKey(
- connection_key, &app_id);
+ hmi_apis::FunctionID::Navigation_StopAudioStream;
+
+ smart_objects::SmartObject msg_params =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
msg_params[strings::app_id] = app_id;
@@ -1877,11 +1776,11 @@ void MessageHelper::SendAudioStopStream(int32_t connection_key) {
ApplicationManagerImpl::instance()->ManageHMICommand(stop_stream);
}
-void MessageHelper::SendOnDataStreaming(protocol_handler::ServiceType service,
- bool available) {
+void MessageHelper::SendOnDataStreaming(const protocol_handler::ServiceType service,
+ const bool available) {
using namespace protocol_handler;
- smart_objects::SmartObjectSPtr notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr notification =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!notification) {
return;
@@ -1893,14 +1792,14 @@ void MessageHelper::SendOnDataStreaming(protocol_handler::ServiceType service,
(*notification)[strings::params][strings::function_id] =
ServiceType::kAudio == service
- ? hmi_apis::FunctionID::Navigation_OnAudioDataStreaming
- : hmi_apis::FunctionID::Navigation_OnVideoDataStreaming;
+ ? hmi_apis::FunctionID::Navigation_OnAudioDataStreaming
+ : hmi_apis::FunctionID::Navigation_OnVideoDataStreaming;
(*notification)[strings::params][strings::message_type] =
- hmi_apis::messageType::notification;
+ hmi_apis::messageType::notification;
(*notification)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
+ commands::CommandImpl::protocol_version_;
(*notification)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
+ commands::CommandImpl::hmi_protocol_type_;
(*notification)[strings::msg_params]["available"] = available;
@@ -1910,91 +1809,102 @@ void MessageHelper::SendOnDataStreaming(protocol_handler::ServiceType service,
bool MessageHelper::SendStopAudioPathThru() {
LOG4CXX_INFO(logger_, "MessageHelper::SendAudioStopAudioPathThru");
- smart_objects::SmartObjectSPtr result = new smart_objects::SmartObject;
- const uint32_t hmi_correlation_id = ApplicationManagerImpl::instance()
- ->GetNextHMICorrelationID();
+ smart_objects::SmartObjectSPtr result = CreateRequestObject();
+
smart_objects::SmartObject& request = *result;
- request[strings::params][strings::message_type] = MessageType::kRequest;
request[strings::params][strings::function_id] =
- hmi_apis::FunctionID::UI_EndAudioPassThru;
- request[strings::params][strings::correlation_id] = hmi_correlation_id;
- request[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- request[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
+ hmi_apis::FunctionID::UI_EndAudioPassThru;
+
return ApplicationManagerImpl::instance()->ManageHMICommand(result);
}
void MessageHelper::SendPolicySnapshotNotification(
- unsigned int connection_key, const std::vector<uint8_t>& policy_data,
- const std::string& url, int timeout) {
+ const unsigned int connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url) {
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(connection_key);
+ DCHECK(app.get());
- using namespace mobile_apis;
- using namespace smart_objects;
+ smart_objects::SmartObject* content =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map); // AKirov: possible memory leak here
- SmartObject content (SmartType_Map);
if (!url.empty()) {
- content[strings::msg_params][strings::url] = url;
+ (*content)[strings::msg_params][strings::url] = url; // Doesn't work with mobile_notification::syncp_url ("URL")
+ } else {
+ LOG4CXX_WARN(logger_, "No service URLs");
}
- content[strings::msg_params][strings::request_type] = RequestType::HTTP;
- content[strings::params][strings::binary_data] = SmartObject(policy_data);
- content[strings::msg_params][strings::file_type] = FileType::BINARY;
+ (*content)[strings::msg_params][strings::request_type] =
+ mobile_apis::RequestType::PROPRIETARY;
+ (*content)[strings::params][strings::binary_data] =
+ smart_objects::SmartObject(policy_data);
+ (*content)[strings::msg_params][strings::file_type] =
+ mobile_apis::FileType::BINARY;
SendSystemRequestNotification(connection_key, content);
}
-void MessageHelper::SendSystemRequestNotification (uint32_t connection_key,
- smart_objects::SmartObject& content) {
-
+void MessageHelper::SendSystemRequestNotification(
+ const uint32_t connection_key, smart_objects::SmartObject*& content) {
using namespace mobile_apis;
using namespace commands;
- using namespace smart_objects;
+ (*content)[strings::params][strings::function_id] =
+ mobile_apis::FunctionID::OnSystemRequestID;
+ (*content)[strings::params][strings::message_type] =
+ mobile_apis::messageType::notification;
+ (*content)[strings::params][strings::protocol_type] =
+ commands::CommandImpl::mobile_protocol_type_;
+ (*content)[strings::params][strings::protocol_version] =
+ commands::CommandImpl::protocol_version_;
- content[strings::params][strings::function_id] = FunctionID::OnSystemRequestID;
- content[strings::params][strings::message_type] = messageType::notification;
- content[strings::params][strings::protocol_type] = CommandImpl::mobile_protocol_type_;
- content[strings::params][strings::protocol_version] = CommandImpl::protocol_version_;
+ (*content)[strings::params][strings::connection_key] = connection_key;
- content[strings::params][strings::connection_key] = connection_key;
+ smart_objects::SmartObject* so = new smart_objects::SmartObject(*content);
+#ifdef DEBUG
+ PrintSmartObject(*so);
+#endif
- ApplicationManagerImpl::instance()->ManageMobileCommand(new SmartObject(content));
+ DCHECK(ApplicationManagerImpl::instance()->ManageMobileCommand(so));
}
-void MessageHelper::SendLaunchApp(uint32_t connection_key,
+void MessageHelper::SendLaunchApp(const uint32_t connection_key,
const std::string& urlSchema,
const std::string& packageName) {
-
using namespace mobile_apis;
using namespace smart_objects;
- SmartObject content (SmartType_Map);
- content[strings::msg_params][strings::request_type] = RequestType::LAUNCH_APP;
- content[strings::msg_params][strings::app_id] = connection_key;
+ SmartObject* content = new SmartObject(SmartType_Map);
+ (*content)[strings::msg_params][strings::request_type] =
+ RequestType::LAUNCH_APP;
+ (*content)[strings::msg_params][strings::app_id] = connection_key;
if (!urlSchema.empty()) {
- content[strings::msg_params][strings::url] = urlSchema;
+ (*content)[strings::msg_params][strings::url] = urlSchema;
} else if (!packageName.empty()) {
- content[strings::msg_params][strings::url] = packageName;
+ (*content)[strings::msg_params][strings::url] = packageName;
}
SendSystemRequestNotification(connection_key, content);
}
void application_manager::MessageHelper::SendQueryApps(
- uint32_t connection_key) {
+ const uint32_t connection_key) {
using namespace mobile_apis;
using namespace smart_objects;
policy::PolicyHandler* policy_handler = policy::PolicyHandler::instance();
- SmartObject content (SmartType_Map);
- content[strings::msg_params][strings::request_type] = RequestType::QUERY_APPS;
- content[strings::msg_params][strings::url] = policy_handler->RemoteAppsUrl();
- content[strings::msg_params][strings::timeout] =
+ SmartObject* content = new SmartObject(SmartType_Map);
+ (*content)[strings::msg_params][strings::request_type] =
+ RequestType::QUERY_APPS;
+ (*content)[strings::msg_params][strings::url] =
+ policy_handler->RemoteAppsUrl();
+ (*content)[strings::msg_params][strings::timeout] =
policy_handler->TimeoutExchange();
Json::Value http;
- Json::Value& http_header = http[http_request::httpRequest][http_request::headers];
+ Json::Value& http_header =
+ http[http_request::httpRequest][http_request::headers];
const int timeout = policy_handler->TimeoutExchange();
@@ -2012,84 +1922,83 @@ void application_manager::MessageHelper::SendQueryApps(
std::string data = http_header.toStyledString();
std::vector<uint8_t> binary_data(data.begin(), data.end());
- content[strings::params][strings::binary_data] = SmartObject(binary_data);
- content[strings::msg_params][strings::file_type] = FileType::BINARY;
+ (*content)[strings::params][strings::binary_data] = SmartObject(binary_data);
+ (*content)[strings::msg_params][strings::file_type] = FileType::BINARY;
SendSystemRequestNotification(connection_key, content);
}
void MessageHelper::SendOnPermissionsChangeNotification(
- uint32_t connection_key, const policy::Permissions& permissions) {
- utils::SharedPtr<smart_objects::SmartObject> notification = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ uint32_t connection_key, const policy::Permissions& permissions) {
+ utils::SharedPtr<smart_objects::SmartObject> notification =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& content = *notification;
content[strings::params][strings::function_id] =
- mobile_apis::FunctionID::OnPermissionsChangeID;
+ mobile_apis::FunctionID::OnPermissionsChangeID;
content[strings::params][strings::message_type] =
- mobile_apis::messageType::notification;
+ mobile_apis::messageType::notification;
content[strings::params][strings::protocol_type] =
- commands::CommandImpl::mobile_protocol_type_;
+ commands::CommandImpl::mobile_protocol_type_;
content[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
+ commands::CommandImpl::protocol_version_;
content[strings::params][strings::connection_key] = connection_key;
- utils::SharedPtr<smart_objects::SmartObject> p_msg_params = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ utils::SharedPtr<smart_objects::SmartObject> p_msg_params =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& msg_params = *p_msg_params;
content[strings::msg_params] = msg_params;
- //content[strings::msg_params][strings::app_id] = connection_key;
+ // content[strings::msg_params][strings::app_id] = connection_key;
- content[strings::msg_params]["permissionItem"] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ content[strings::msg_params]["permissionItem"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& permissions_item_array =
- content[strings::msg_params]["permissionItem"];
+ content[strings::msg_params]["permissionItem"];
policy::Permissions::const_iterator it_permissions = permissions.begin();
policy::Permissions::const_iterator it_permissions_end = permissions.end();
for (size_t index_pi = 0; it_permissions != it_permissions_end;
++it_permissions, ++index_pi) {
-
- permissions_item_array[index_pi] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ permissions_item_array[index_pi] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& permission_item =
- permissions_item_array[index_pi];
+ permissions_item_array[index_pi];
// Filling the rpcName of PermissionItem
permission_item["rpcName"] = (*it_permissions).first;
const policy::RpcPermissions& rpc_permissions = (*it_permissions).second;
// Creating SO for hmiPermissions
- permission_item["hmiPermissions"] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ permission_item["hmiPermissions"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& hmi_permissions =
- permission_item["hmiPermissions"];
+ permission_item["hmiPermissions"];
- policy::HMIPermissions::const_iterator it_hmi_permissions = rpc_permissions
- .hmi_permissions.begin();
+ policy::HMIPermissions::const_iterator it_hmi_permissions =
+ rpc_permissions.hmi_permissions.begin();
policy::HMIPermissions::const_iterator it_hmi_permissions_end =
- rpc_permissions.hmi_permissions.end();
+ rpc_permissions.hmi_permissions.end();
// Filling the hmiPermissions of PermissionItem
for (; it_hmi_permissions != it_hmi_permissions_end; ++it_hmi_permissions) {
// Possible key names are "allowed", "userDisallowed"
- hmi_permissions[(*it_hmi_permissions).first] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
+ hmi_permissions[(*it_hmi_permissions).first] =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& hmi_levels =
- hmi_permissions[(*it_hmi_permissions).first];
+ hmi_permissions[(*it_hmi_permissions).first];
std::set<policy::HMILevel>::const_iterator it_hmi_levels =
- (*it_hmi_permissions).second.begin();
+ (*it_hmi_permissions).second.begin();
std::set<policy::HMILevel>::const_iterator it_hmi_levels_end =
- (*it_hmi_permissions).second.end();
+ (*it_hmi_permissions).second.end();
for (size_t index_hmi_levels = 0; it_hmi_levels != it_hmi_levels_end;
++it_hmi_levels, ++index_hmi_levels) {
@@ -2098,31 +2007,31 @@ void MessageHelper::SendOnPermissionsChangeNotification(
}
// Creating SO for parameterPermissions
- permission_item["parameterPermissions"] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ permission_item["parameterPermissions"] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& parameter_permissions =
- permission_item["parameterPermissions"];
+ permission_item["parameterPermissions"];
policy::ParameterPermissions::const_iterator it_parameter_permissions =
- rpc_permissions.parameter_permissions.begin();
+ rpc_permissions.parameter_permissions.begin();
policy::ParameterPermissions::const_iterator it_parameter_permissions_end =
- rpc_permissions.parameter_permissions.end();
+ rpc_permissions.parameter_permissions.end();
// Filling the parameterPermissions of PermissionItem
for (; it_parameter_permissions != it_parameter_permissions_end;
++it_parameter_permissions) {
// Possible key names are "allowed", "userDisallowed"
parameter_permissions[(*it_parameter_permissions).first] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& parameters =
- parameter_permissions[(*it_parameter_permissions).first];
+ parameter_permissions[(*it_parameter_permissions).first];
std::set<policy::Parameter>::const_iterator it_parameters =
- (*it_parameter_permissions).second.begin();
+ (*it_parameter_permissions).second.begin();
std::set<policy::Parameter>::const_iterator it_parameters_end =
- (*it_parameter_permissions).second.end();
+ (*it_parameter_permissions).second.end();
for (size_t index_parameters = 0; it_parameters != it_parameters_end;
++it_parameters, ++index_parameters) {
@@ -2137,31 +2046,29 @@ void MessageHelper::SendOnPermissionsChangeNotification(
void MessageHelper::FillAppRevokedPermissions(
const policy::AppPermissions& permissions,
smart_objects::SmartObject& message) {
-
message[strings::msg_params]["appRevokedPermissions"] =
- smart_objects::SmartObject(smart_objects::SmartType_Array);
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
smart_objects::SmartObject& revoked_permission_items =
message[strings::msg_params]["appRevokedPermissions"];
for (size_t i = 0; i < permissions.appRevokedPermissions.size(); ++i) {
- revoked_permission_items[i] = smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ revoked_permission_items[i] =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
smart_objects::SmartObject& permission_item = revoked_permission_items[i];
- permission_item["name"] = permissions.appRevokedPermissions[i].
- group_alias;
+ permission_item["name"] = permissions.appRevokedPermissions[i].group_alias;
permission_item["id"] = permissions.appRevokedPermissions[i].group_id;
- if (policy::kGroupUndefined !=
- permissions.appRevokedPermissions[i].state) {
+ if (policy::kGroupUndefined != permissions.appRevokedPermissions[i].state) {
permission_item["allowed"] =
policy::kGroupAllowed == permissions.appRevokedPermissions[i].state
- ? true : false;
+ ? true
+ : false;
}
}
}
void MessageHelper::SendOnAppPermissionsChangedNotification(
- uint32_t connection_key, const policy::AppPermissions& permissions) {
+ const uint32_t connection_key, const policy::AppPermissions& permissions) {
using namespace smart_objects;
SmartObjectSPtr notification = new SmartObject(SmartType_Map);
if (!notification) {
@@ -2171,7 +2078,7 @@ void MessageHelper::SendOnAppPermissionsChangedNotification(
SmartObject& message = *notification;
message[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_OnAppPermissionChanged;
+ hmi_apis::FunctionID::SDL_OnAppPermissionChanged;
message[strings::params][strings::message_type] = MessageType::kNotification;
message[strings::msg_params][strings::app_id] = connection_key;
@@ -2181,48 +2088,46 @@ void MessageHelper::SendOnAppPermissionsChangedNotification(
message[strings::msg_params]["appRevoked"] = permissions.appRevoked;
}
if (permissions.isAppPermissionsRevoked) {
- message[strings::msg_params]["isAppPermissionsRevoked"] = permissions
- .isAppPermissionsRevoked;
+ message[strings::msg_params]["isAppPermissionsRevoked"] =
+ permissions.isAppPermissionsRevoked;
FillAppRevokedPermissions(permissions, message);
}
if (permissions.appPermissionsConsentNeeded) {
- message[strings::msg_params]["appPermissionsConsentNeeded"] = permissions
- .appPermissionsConsentNeeded;
+ message[strings::msg_params]["appPermissionsConsentNeeded"] =
+ permissions.appPermissionsConsentNeeded;
}
if (permissions.appUnauthorized) {
- message[strings::msg_params]["appUnauthorized"] = permissions
- .appUnauthorized;
+ message[strings::msg_params]["appUnauthorized"] =
+ permissions.appUnauthorized;
}
if (!permissions.priority.empty()) {
- message[strings::msg_params]["priority"] = GetPriorityCode(
- permissions.priority);
+ message[strings::msg_params]["priority"] =
+ GetPriorityCode(permissions.priority);
}
if (permissions.requestTypeChanged) {
SmartObject request_types_array = SmartObject(SmartType_Array);
for (uint16_t index = 0; index < permissions.requestType.size(); ++index) {
request_types_array[index] = permissions.requestType[index];
}
- message[strings::msg_params][strings::request_type] =
- request_types_array;
+ message[strings::msg_params][strings::request_type] = request_types_array;
}
ApplicationManagerImpl::instance()->ManageHMICommand(notification);
}
void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
- uint32_t correlation_id) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ const uint32_t correlation_id) {
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_GetStatusUpdate;
- (*message)[strings::params][strings::message_type] =
- MessageType::kResponse;
+ hmi_apis::FunctionID::SDL_GetStatusUpdate;
+ (*message)[strings::params][strings::message_type] = MessageType::kResponse;
(*message)[strings::params][strings::correlation_id] = correlation_id;
(*message)[strings::params][hmi_response::code] = 0;
@@ -2232,17 +2137,14 @@ void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
}
void MessageHelper::SendUpdateSDLResponse(const std::string& result,
- uint32_t correlation_id) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
- if (!message) {
- return;
- }
+ const uint32_t correlation_id) {
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
+ DCHECK(message);
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_UpdateSDL;
- (*message)[strings::params][strings::message_type] =
- MessageType::kResponse;
+ hmi_apis::FunctionID::SDL_UpdateSDL;
+ (*message)[strings::params][strings::message_type] = MessageType::kResponse;
(*message)[strings::params][strings::correlation_id] = correlation_id;
(*message)[strings::params][hmi_response::code] = 0;
@@ -2252,16 +2154,16 @@ void MessageHelper::SendUpdateSDLResponse(const std::string& result,
}
void MessageHelper::SendOnStatusUpdate(const std::string& status) {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message =
+ new smart_objects::SmartObject(smart_objects::SmartType_Map);
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::SDL_OnStatusUpdate;
+ hmi_apis::FunctionID::SDL_OnStatusUpdate;
(*message)[strings::params][strings::message_type] =
- MessageType::kNotification;
+ MessageType::kNotification;
(*message)[strings::msg_params]["status"] = status;
@@ -2269,28 +2171,19 @@ void MessageHelper::SendOnStatusUpdate(const std::string& status) {
}
void MessageHelper::SendGetSystemInfoRequest() {
- smart_objects::SmartObjectSPtr message = new smart_objects::SmartObject(
- smart_objects::SmartType_Map);
+ smart_objects::SmartObjectSPtr message = CreateRequestObject();
if (!message) {
return;
}
(*message)[strings::params][strings::function_id] =
- hmi_apis::FunctionID::BasicCommunication_GetSystemInfo;
- (*message)[strings::params][strings::message_type] =
- MessageType::kRequest;
- (*message)[strings::params][strings::correlation_id] =
- ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
- (*message)[strings::params][strings::protocol_version] =
- commands::CommandImpl::protocol_version_;
- (*message)[strings::params][strings::protocol_type] =
- commands::CommandImpl::hmi_protocol_type_;
+ hmi_apis::FunctionID::BasicCommunication_GetSystemInfo;
ApplicationManagerImpl::instance()->ManageHMICommand(message);
}
mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app) {
+ smart_objects::SmartObject& message, ApplicationConstSharedPtr app) {
if (NsSmartDeviceLink::NsSmartObjects::SmartType_Array == message.getType()) {
for (uint32_t i = 0; i < message.length(); ++i) {
mobile_apis::Result::eType res = VerifyImageFiles(message[i], app);
@@ -2299,21 +2192,23 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
return res;
}
}
- } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map
- == message.getType()) {
+ } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Map ==
+ message.getType()) {
if (message.keyExists(strings::image_type)) {
- mobile_apis::Result::eType verification_result = VerifyImage(message,
- app);
+ mobile_apis::Result::eType verification_result =
+ VerifyImage(message, app);
if (mobile_apis::Result::SUCCESS != verification_result) {
- LOG4CXX_DEBUG(logger_, "VerifyImageFiles result:" << verification_result);
+ LOG4CXX_DEBUG(logger_,
+ "VerifyImageFiles result:" << verification_result);
return verification_result; // exit point
}
} else {
std::set<std::string> keys = message.enumerate();
for (std::set<std::string>::const_iterator key = keys.begin();
- key != keys.end(); ++key) {
+ key != keys.end();
+ ++key) {
if (strings::soft_buttons != (*key)) {
mobile_apis::Result::eType res = VerifyImageFiles(message[*key], app);
if (mobile_apis::Result::SUCCESS != res) {
@@ -2329,12 +2224,12 @@ mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
}
mobile_apis::Result::eType MessageHelper::VerifyImage(
- smart_objects::SmartObject& image, ApplicationConstSharedPtr app) {
+ smart_objects::SmartObject& image, ApplicationConstSharedPtr app) {
// Checking image type first: if STATIC - skip existence check, since it is
// HMI related file and it should know it location
const uint32_t image_type = image[strings::image_type].asUInt();
mobile_apis::ImageType::eType type =
- static_cast<mobile_apis::ImageType::eType>(image_type);
+ static_cast<mobile_apis::ImageType::eType>(image_type);
if (mobile_apis::ImageType::STATIC == type) {
return mobile_apis::Result::SUCCESS;
}
@@ -2352,18 +2247,16 @@ mobile_apis::Result::eType MessageHelper::VerifyImage(
full_file_path = file_name;
} else {
const std::string& app_storage_folder =
- profile::Profile::instance()->app_storage_folder();
+ profile::Profile::instance()->app_storage_folder();
if (!app_storage_folder.empty()) {
-// TODO(nvaganov@luxoft.com): APPLINK-11293
- if (app_storage_folder[0] == '/') { // absolute path
+ // TODO(nvaganov@luxoft.com): APPLINK-11293
+ if (app_storage_folder[0] == '/') { // absolute path
full_file_path = app_storage_folder + "/";
- }
- else { // relative path
+ } else { // relative path
full_file_path = file_system::CurrentWorkingDirectory() + "/" +
app_storage_folder + "/";
}
- }
- else { // empty app storage folder
+ } else { // empty app storage folder
full_file_path = file_system::CurrentWorkingDirectory() + "/";
}
@@ -2382,12 +2275,12 @@ mobile_apis::Result::eType MessageHelper::VerifyImage(
}
mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
- smart_objects::SmartObject& message, ApplicationConstSharedPtr app) {
+ smart_objects::SmartObject& message, ApplicationConstSharedPtr app) {
mobile_apis::Result::eType verification_result_image =
- mobile_apis::Result::SUCCESS;
+ mobile_apis::Result::SUCCESS;
for (uint32_t i = 0; i < message.length(); ++i) {
if (message[i].keyExists(strings::image)) {
- verification_result_image = VerifyImage(message[i][strings::image], app);
+ verification_result_image = VerifyImage(message[i][strings::image], app);
if (mobile_apis::Result::SUCCESS != verification_result_image) {
return verification_result_image;
}
@@ -2397,12 +2290,12 @@ mobile_apis::Result::eType MessageHelper::VerifyImageVrHelpItems(
}
bool MessageHelper::VerifySoftButtonString(const std::string& str) {
-
if ((std::string::npos != str.find_first_of("\t\n")) ||
(std::string::npos != str.find("\\n")) ||
(std::string::npos != str.find("\\t")) ||
(std::string::npos == str.find_first_not_of(' '))) {
- LOG4CXX_ERROR(logger_, "MessageHelper::VerifySoftButtonString"
+ LOG4CXX_ERROR(logger_,
+ "MessageHelper::VerifySoftButtonString"
"string contains incorrect character");
return false;
}
@@ -2423,7 +2316,7 @@ bool MessageHelper::CheckWithPolicy(
}
mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
- smart_objects::SmartObject& message_params, ApplicationConstSharedPtr app) {
+ smart_objects::SmartObject& message_params, ApplicationConstSharedPtr app) {
using namespace mobile_apis;
using namespace smart_objects;
@@ -2431,16 +2324,6 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
return mobile_apis::Result::SUCCESS;
}
- const HMICapabilities& hmi_capabilities = ApplicationManagerImpl::instance()
- ->hmi_capabilities();
- const SmartObject* soft_button_capabilities = hmi_capabilities
- .soft_button_capabilities();
- bool image_supported = false;
- if (soft_button_capabilities) {
- image_supported = (*soft_button_capabilities)[hmi_response::image_supported]
- .asBool();
- }
-
SmartObject& request_soft_buttons = message_params[strings::soft_buttons];
// Check whether soft buttons request is well-formed
@@ -2453,7 +2336,8 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
uint32_t j = 0;
size_t size = request_soft_buttons.length();
for (uint32_t i = 0; i < size; ++i) {
- const int system_action = request_soft_buttons[i][strings::system_action].asInt();
+ const int system_action =
+ request_soft_buttons[i][strings::system_action].asInt();
if (!CheckWithPolicy(static_cast<SystemAction::eType>(system_action),
app->mobile_app_id())) {
@@ -2462,20 +2346,14 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
switch (request_soft_buttons[i][strings::type].asInt()) {
case SoftButtonType::SBT_IMAGE: {
- if (!image_supported) {
- continue;
- }
- //Any text value for type "IMAGE" should be ignored.
+ // Any text value for type "IMAGE" should be ignored.
if (request_soft_buttons[i].keyExists(strings::text)) {
request_soft_buttons[i].erase(strings::text);
}
- if (request_soft_buttons[i].keyExists(strings::image)) {
- Result::eType verification_result = VerifyImage(
- request_soft_buttons[i][strings::image], app);
- if (Result::SUCCESS != verification_result) {
- return Result::INVALID_DATA;
- }
- } else {
+
+ if ((!request_soft_buttons[i].keyExists(strings::image) ||
+ (Result::SUCCESS !=
+ VerifyImage(request_soft_buttons[i][strings::image], app)))) {
return Result::INVALID_DATA;
}
break;
@@ -2489,29 +2367,17 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
break;
}
case SoftButtonType::SBT_BOTH: {
-
if ((!request_soft_buttons[i].keyExists(strings::text)) ||
- ((request_soft_buttons[i][strings::text].length())
- && (!VerifySoftButtonString(
- request_soft_buttons[i][strings::text].asString())))) {
+ ((request_soft_buttons[i][strings::text].length()) &&
+ (!VerifySoftButtonString(
+ request_soft_buttons[i][strings::text].asString())))) {
return Result::INVALID_DATA;
}
- bool image_exist = false;
- if (image_supported) {
- image_exist = request_soft_buttons[i].keyExists(strings::image);
- if (!image_exist) {
- return Result::INVALID_DATA;
- }
- }
- if (image_exist) {
- Result::eType verification_result = VerifyImage(
- request_soft_buttons[i][strings::image], app);
-
- if (Result::SUCCESS != verification_result) {
- return Result::INVALID_DATA;
-
- }
+ if ((!request_soft_buttons[i].keyExists(strings::image) ||
+ (Result::SUCCESS !=
+ VerifyImage(request_soft_buttons[i][strings::image], app)))) {
+ return Result::INVALID_DATA;
}
break;
}
@@ -2521,8 +2387,7 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
}
}
- soft_buttons[j] = request_soft_buttons[i];
- ++j;
+ soft_buttons[j++] = request_soft_buttons[i];
}
request_soft_buttons = soft_buttons;
@@ -2534,12 +2399,14 @@ mobile_apis::Result::eType MessageHelper::ProcessSoftButtons(
}
void MessageHelper::SubscribeApplicationToSoftButton(
- smart_objects::SmartObject& message_params, ApplicationSharedPtr app,
+ smart_objects::SmartObject& message_params,
+ ApplicationSharedPtr app,
int32_t function_id) {
SoftButtonID softbuttons_id;
- smart_objects::SmartObject& soft_buttons = message_params[strings::soft_buttons];
+ smart_objects::SmartObject& soft_buttons =
+ message_params[strings::soft_buttons];
unsigned int length = soft_buttons.length();
- for(unsigned int i = 0; i < length; ++i) {
+ for (unsigned int i = 0; i < length; ++i) {
softbuttons_id.insert(soft_buttons[i][strings::soft_button_id].asUInt());
}
app->SubscribeToSoftButtons(function_id, softbuttons_id);
@@ -2577,7 +2444,8 @@ bool MessageHelper::PrintSmartObject(const smart_objects::SmartObject& object) {
std::set<std::string> keys = object.enumerate();
for (std::set<std::string>::const_iterator key = keys.begin();
- key != keys.end(); key++) {
+ key != keys.end();
+ key++) {
++tab;
printf("\n%s%s: ", tab_buffer.c_str(), (*key).c_str());
diff --git a/src/components/application_manager/src/mobile_command_factory.cc b/src/components/application_manager/src/mobile_command_factory.cc
index 0d592e9562..ff2d4fd49e 100644
--- a/src/components/application_manager/src/mobile_command_factory.cc
+++ b/src/components/application_manager/src/mobile_command_factory.cc
@@ -51,7 +51,6 @@
#include "application_manager/commands/mobile/delete_interaction_choice_set_response.h"
#include "application_manager/commands/mobile/delete_sub_menu_request.h"
#include "application_manager/commands/mobile/delete_sub_menu_response.h"
-#include "application_manager/commands/mobile/dial_number_request.h"
#include "application_manager/commands/mobile/end_audio_pass_thru_request.h"
#include "application_manager/commands/mobile/end_audio_pass_thru_response.h"
#include "application_manager/commands/mobile/generic_response.h"
@@ -125,430 +124,442 @@
#include "application_manager/commands/mobile/diagnostic_message_response.h"
#include "application_manager/commands/mobile/send_location_request.h"
#include "application_manager/commands/mobile/send_location_response.h"
+#include "application_manager/commands/mobile/dial_number_request.h"
+#include "application_manager/commands/mobile/dial_number_response.h"
#include "interfaces/MOBILE_API.h"
+#include "utils/make_shared.h"
namespace application_manager {
-commands::Command *MobileCommandFactory::CreateCommand(
+CommandSharedPtr MobileCommandFactory::CreateCommand(
const commands::MessageSharedPtr& message,
commands::Command::CommandOrigin origin) {
+ CommandSharedPtr command;
+
switch ((*message)[strings::params][strings::function_id].asInt()) {
case mobile_apis::FunctionID::RegisterAppInterfaceID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kRequest)) {
- return new commands::RegisterAppInterfaceRequest(message);
+ command = utils::MakeShared<commands::RegisterAppInterfaceRequest>(message);
} else {
- return new commands::RegisterAppInterfaceResponse(message);
+ command = utils::MakeShared<commands::RegisterAppInterfaceResponse>(message);
}
break;
}
case mobile_apis::FunctionID::UnregisterAppInterfaceID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kRequest)) {
- return new commands::UnregisterAppInterfaceRequest(message);
+ command = utils::MakeShared<commands::UnregisterAppInterfaceRequest>(message);
} else {
- return new commands::UnregisterAppInterfaceResponse(message);
+ command = utils::MakeShared<commands::UnregisterAppInterfaceResponse>(message);
}
break;
}
case mobile_apis::FunctionID::SetGlobalPropertiesID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SetGlobalPropertiesResponse(message);
+ command = utils::MakeShared<commands::SetGlobalPropertiesResponse>(message);
} else {
- return new commands::SetGlobalPropertiesRequest(message);
+ command = utils::MakeShared<commands::SetGlobalPropertiesRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ResetGlobalPropertiesID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ResetGlobalPropertiesResponse(message);
+ command = utils::MakeShared<commands::ResetGlobalPropertiesResponse>(message);
} else {
- return new commands::ResetGlobalPropertiesRequest(message);
+ command = utils::MakeShared<commands::ResetGlobalPropertiesRequest>(message);
}
break;
}
case mobile_apis::FunctionID::AddCommandID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::AddCommandResponse(message);
+ command = utils::MakeShared<commands::AddCommandResponse>(message);
} else {
- return new commands::AddCommandRequest(message);
+ command = utils::MakeShared<commands::AddCommandRequest>(message);
}
break;
}
case mobile_apis::FunctionID::DeleteCommandID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::DeleteCommandResponse(message);
+ command = utils::MakeShared<commands::DeleteCommandResponse>(message);
} else {
- return new commands::DeleteCommandRequest(message);
+ command = utils::MakeShared<commands::DeleteCommandRequest>(message);
}
break;
}
case mobile_apis::FunctionID::AddSubMenuID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::AddSubMenuResponse(message);
+ command = utils::MakeShared<commands::AddSubMenuResponse>(message);
} else {
- return new commands::AddSubMenuRequest(message);
+ command = utils::MakeShared<commands::AddSubMenuRequest>(message);
}
break;
}
case mobile_apis::FunctionID::DeleteSubMenuID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::DeleteSubMenuResponse(message);
+ command = utils::MakeShared<commands::DeleteSubMenuResponse>(message);
} else {
- return new commands::DeleteSubMenuRequest(message);
+ command = utils::MakeShared<commands::DeleteSubMenuRequest>(message);
}
break;
}
case mobile_apis::FunctionID::DeleteInteractionChoiceSetID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return
- new commands::DeleteInteractionChoiceSetResponse(message);
+ command = utils::MakeShared<commands::DeleteInteractionChoiceSetResponse>(message);
} else {
- return new commands::DeleteInteractionChoiceSetRequest(message);
+ command = utils::MakeShared<commands::DeleteInteractionChoiceSetRequest>(message);
}
break;
}
case mobile_apis::FunctionID::AlertID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::AlertResponse(message);
+ command = utils::MakeShared<commands::AlertResponse>(message);
} else {
- return new commands::AlertRequest(message);
+ command = utils::MakeShared<commands::AlertRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SpeakID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SpeakResponse(message);
+ command = utils::MakeShared<commands::SpeakResponse>(message);
} else {
- return new commands::SpeakRequest(message);
+ command = utils::MakeShared<commands::SpeakRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SliderID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SliderResponse(message);
+ command = utils::MakeShared<commands::SliderResponse>(message);
} else {
- return new commands::SliderRequest(message);
+ command = utils::MakeShared<commands::SliderRequest>(message);
}
break;
}
case mobile_apis::FunctionID::PerformAudioPassThruID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::PerformAudioPassThruResponse(message);
+ command = utils::MakeShared<commands::PerformAudioPassThruResponse>(message);
} else {
- return new commands::PerformAudioPassThruRequest(message);
+ command = utils::MakeShared<commands::PerformAudioPassThruRequest>(message);
}
break;
}
case mobile_apis::FunctionID::CreateInteractionChoiceSetID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return
- new commands::CreateInteractionChoiceSetResponse(message);
+ command = utils::MakeShared<commands::CreateInteractionChoiceSetResponse>(message);
} else {
- return new commands::CreateInteractionChoiceSetRequest(message);
+ command = utils::MakeShared<commands::CreateInteractionChoiceSetRequest>(message);
}
break;
}
case mobile_apis::FunctionID::PerformInteractionID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::PerformInteractionResponse(message);
+ command = utils::MakeShared<commands::PerformInteractionResponse>(message);
} else {
- return new commands::PerformInteractionRequest(message);
+ command = utils::MakeShared<commands::PerformInteractionRequest>(message);
}
break;
}
case mobile_apis::FunctionID::EndAudioPassThruID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::EndAudioPassThruResponse(message);
+ command = utils::MakeShared<commands::EndAudioPassThruResponse>(message);
} else {
- return new commands::EndAudioPassThruRequest(message);
+ command = utils::MakeShared<commands::EndAudioPassThruRequest>(message);
}
break;
}
case mobile_apis::FunctionID::PutFileID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::PutFileResponse(message);
+ command = utils::MakeShared<commands::PutFileResponse>(message);
} else {
- return new commands::PutFileRequest(message);
+ command = utils::MakeShared<commands::PutFileRequest>(message);
}
break;
}
case mobile_apis::FunctionID::DeleteFileID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::DeleteFileResponse(message);
+ command = utils::MakeShared<commands::DeleteFileResponse>(message);
} else {
- return new commands::DeleteFileRequest(message);
+ command = utils::MakeShared<commands::DeleteFileRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ListFilesID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ListFilesResponse(message);
+ command = utils::MakeShared<commands::ListFilesResponse>(message);
} else {
- return new commands::ListFilesRequest(message);
+ command = utils::MakeShared<commands::ListFilesRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SubscribeButtonID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SubscribeButtonResponse(message);
+ command = utils::MakeShared<commands::SubscribeButtonResponse>(message);
} else {
- return new commands::SubscribeButtonRequest(message);
+ command = utils::MakeShared<commands::SubscribeButtonRequest>(message);
}
break;
}
case mobile_apis::FunctionID::UnsubscribeButtonID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::UnsubscribeButtonResponse(message);
+ command = utils::MakeShared<commands::UnsubscribeButtonResponse>(message);
} else {
- return new commands::UnsubscribeButtonRequest(message);
+ command = utils::MakeShared<commands::UnsubscribeButtonRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ShowConstantTBTID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ShowConstantTBTResponse(message);
+ command = utils::MakeShared<commands::ShowConstantTBTResponse>(message);
} else {
- return new commands::ShowConstantTBTRequest(message);
+ command = utils::MakeShared<commands::ShowConstantTBTRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ShowID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ShowResponse(message);
+ command = utils::MakeShared<commands::ShowResponse>(message);
} else {
- return new commands::ShowRequest(message);
+ command = utils::MakeShared<commands::ShowRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SubscribeVehicleDataID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SubscribeVehicleDataResponse(message);
+ command = utils::MakeShared<commands::SubscribeVehicleDataResponse>(message);
} else {
- return new commands::SubscribeVehicleDataRequest(message);
+ command = utils::MakeShared<commands::SubscribeVehicleDataRequest>(message);
}
break;
}
case mobile_apis::FunctionID::UnsubscribeVehicleDataID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::UnsubscribeVehicleDataResponse(message);
+ command = utils::MakeShared<commands::UnsubscribeVehicleDataResponse>(message);
} else {
- return new commands::UnsubscribeVehicleDataRequest(message);
+ command = utils::MakeShared<commands::UnsubscribeVehicleDataRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ReadDIDID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ReadDIDResponse(message);
+ command = utils::MakeShared<commands::ReadDIDResponse>(message);
} else {
- return new commands::ReadDIDRequest(message);
+ command = utils::MakeShared<commands::ReadDIDRequest>(message);
}
break;
}
case mobile_apis::FunctionID::GetVehicleDataID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::GetVehicleDataResponse(message);
+ command = utils::MakeShared<commands::GetVehicleDataResponse>(message);
} else {
- return new commands::GetVehicleDataRequest(message);
+ command = utils::MakeShared<commands::GetVehicleDataRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ScrollableMessageID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ScrollableMessageResponse(message);
+ command = utils::MakeShared<commands::ScrollableMessageResponse>(message);
} else {
- return new commands::ScrollableMessageRequest(message);
+ command = utils::MakeShared<commands::ScrollableMessageRequest>(message);
}
break;
}
case mobile_apis::FunctionID::AlertManeuverID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::AlertManeuverResponse(message);
+ command = utils::MakeShared<commands::AlertManeuverResponse>(message);
} else {
- return new commands::AlertManeuverRequest(message);
+ command = utils::MakeShared<commands::AlertManeuverRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SetAppIconID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SetAppIconResponse(message);
+ command = utils::MakeShared<commands::SetAppIconResponse>(message);
} else {
- return new commands::SetAppIconRequest(message);
+ command = utils::MakeShared<commands::SetAppIconRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SetDisplayLayoutID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SetDisplayLayoutResponse(message);
+ command = utils::MakeShared<commands::SetDisplayLayoutResponse>(message);
} else {
- return new commands::SetDisplayLayoutRequest(message);
+ command = utils::MakeShared<commands::SetDisplayLayoutRequest>(message);
}
break;
}
case mobile_apis::FunctionID::UpdateTurnListID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::UpdateTurnListResponse(message);
+ command = utils::MakeShared<commands::UpdateTurnListResponse>(message);
} else {
- return new commands::UpdateTurnListRequest(message);
+ command = utils::MakeShared<commands::UpdateTurnListRequest>(message);
}
break;
}
case mobile_apis::FunctionID::ChangeRegistrationID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::ChangeRegistrationResponse(message);
+ command = utils::MakeShared<commands::ChangeRegistrationResponse>(message);
} else {
- return new commands::ChangeRegistrationRequest(message);
+ command = utils::MakeShared<commands::ChangeRegistrationRequest>(message);
}
break;
}
case mobile_apis::FunctionID::GetDTCsID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::GetDTCsResponse(message);
+ command = utils::MakeShared<commands::GetDTCsResponse>(message);
} else {
- return new commands::GetDTCsRequest(message);
+ command = utils::MakeShared<commands::GetDTCsRequest>(message);
}
break;
}
case mobile_apis::FunctionID::DiagnosticMessageID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::DiagnosticMessageResponse(message);
+ command = utils::MakeShared<commands::DiagnosticMessageResponse>(message);
} else {
- return new commands::DiagnosticMessageRequest(message);
+ command = utils::MakeShared<commands::DiagnosticMessageRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SetMediaClockTimerID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SetMediaClockTimerResponse(message);
+ command = utils::MakeShared<commands::SetMediaClockTimerResponse>(message);
} else {
- return new commands::SetMediaClockRequest(message);
+ command = utils::MakeShared<commands::SetMediaClockRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SystemRequestID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SystemResponse(message);
+ command = utils::MakeShared<commands::SystemResponse>(message);
} else {
- return new commands::SystemRequest(message);
+ command = utils::MakeShared<commands::SystemRequest>(message);
}
break;
}
case mobile_apis::FunctionID::SendLocationID: {
if ((*message)[strings::params][strings::message_type]
== static_cast<int>(application_manager::MessageType::kResponse)) {
- return new commands::SendLocationResponse(message);
+ command = utils::MakeShared<commands::SendLocationResponse>(message);
+ } else {
+ command = utils::MakeShared<commands::SendLocationRequest>(message);
+ }
+ break;
+ }
+ case mobile_apis::FunctionID::DialNumberID: {
+ if ((*message)[strings::params][strings::message_type]
+ == static_cast<int>(application_manager::MessageType::kResponse)) {
+ command = utils::MakeShared<commands::DialNumberResponse>(message);
} else {
- return new commands::SendLocationRequest(message);
+ command = utils::MakeShared<commands::DialNumberRequest>(message);
}
break;
}
case mobile_apis::FunctionID::OnButtonEventID: {
- return new commands::mobile::OnButtonEventNotification(message);
+ command = utils::MakeShared<commands::mobile::OnButtonEventNotification>(message);
break;
}
case mobile_apis::FunctionID::OnButtonPressID: {
- return new commands::mobile::OnButtonPressNotification(message);
+ command = utils::MakeShared<commands::mobile::OnButtonPressNotification>(message);
break;
}
case mobile_apis::FunctionID::OnAudioPassThruID: {
- return new commands::OnAudioPassThruNotification(message);
+ command = utils::MakeShared<commands::OnAudioPassThruNotification>(message);
break;
}
case mobile_apis::FunctionID::OnVehicleDataID: {
- return new commands::OnVehicleDataNotification(message);
+ command = utils::MakeShared<commands::OnVehicleDataNotification>(message);
break;
}
case mobile_apis::FunctionID::OnAppInterfaceUnregisteredID: {
- return
- new commands::OnAppInterfaceUnregisteredNotification(message);
+ command = utils::MakeShared<commands::OnAppInterfaceUnregisteredNotification>(message);
break;
}
case mobile_apis::FunctionID::OnCommandID: {
- return new commands::OnCommandNotification(message);
+ command = utils::MakeShared<commands::OnCommandNotification>(message);
break;
}
case mobile_apis::FunctionID::OnTBTClientStateID: {
- return new commands::OnTBTClientStateNotification(message);
+ command = utils::MakeShared<commands::OnTBTClientStateNotification>(message);
break;
}
case mobile_apis::FunctionID::OnDriverDistractionID: {
- return
- new commands::mobile::OnDriverDistractionNotification(message);
+ command = utils::MakeShared<commands::mobile::OnDriverDistractionNotification>(message);
break;
}
case mobile_apis::FunctionID::OnLanguageChangeID: {
- return new commands::OnLanguageChangeNotification(message);
+ command = utils::MakeShared<commands::OnLanguageChangeNotification>(message);
break;
}
case mobile_apis::FunctionID::OnPermissionsChangeID: {
- return new commands::OnPermissionsChangeNotification(message);
+ command = utils::MakeShared<commands::OnPermissionsChangeNotification>(message);
break;
}
case mobile_apis::FunctionID::OnHMIStatusID: {
if (origin == commands::Command::ORIGIN_MOBILE) {
- return new commands::OnHMIStatusNotificationFromMobile(message);
+ command = utils::MakeShared<commands::OnHMIStatusNotificationFromMobile>(message);
+ } else {
+ command = utils::MakeShared<commands::OnHMIStatusNotification>(message);
}
- return new commands::OnHMIStatusNotification(message);
break;
}
case mobile_apis::FunctionID::OnKeyboardInputID: {
- return new commands::mobile::OnKeyBoardInputNotification(message);
+ command = utils::MakeShared<commands::mobile::OnKeyBoardInputNotification>(message);
break;
}
case mobile_apis::FunctionID::OnTouchEventID: {
- return new commands::mobile::OnTouchEventNotification(message);
+ command = utils::MakeShared<commands::mobile::OnTouchEventNotification>(message);
break;
}
case mobile_apis::FunctionID::OnSystemRequestID: {
- return new commands::mobile::OnSystemRequestNotification(message);
+ command = utils::MakeShared<commands::mobile::OnSystemRequestNotification>(message);
break;
}
case mobile_apis::FunctionID::OnHashChangeID: {
- return new commands::mobile::OnHashChangeNotification(message);
+ command = utils::MakeShared<commands::mobile::OnHashChangeNotification>(message);
break;
}
default: {
(*message)[strings::params][strings::function_id] =
static_cast<int32_t>(mobile_apis::FunctionID::GenericResponseID);
- return new commands::GenericResponse(message);
+ command = utils::MakeShared<commands::GenericResponse>(message);
}
}
+ return command;
}
} // namespace application_manager
diff --git a/src/components/application_manager/src/mobile_message_handler.cc b/src/components/application_manager/src/mobile_message_handler.cc
index 732faf8a58..226ff0da3f 100644
--- a/src/components/application_manager/src/mobile_message_handler.cc
+++ b/src/components/application_manager/src/mobile_message_handler.cc
@@ -41,6 +41,7 @@
#include <stdint.h>
#include <memory>
+#include <string>
namespace {
const uint8_t kRequest = 0x0;
@@ -52,29 +53,71 @@ const uint8_t kUnknown = 0xF;
namespace application_manager {
using protocol_handler::Extract;
-CREATE_LOGGERPTR_GLOBAL(logger_, "MobileMessageHandler")
+namespace {
+ typedef std::map<MessageType, std::string> MessageTypeMap;
+ MessageTypeMap messageTypes = {
+ std::make_pair(kRequest, "Request"),
+ std::make_pair(kResponse, "Response"),
+ std::make_pair(kNotification, "Notification")
+ };
+}
+CREATE_LOGGERPTR_GLOBAL(logger_, "ApplicationManager")
application_manager::Message* MobileMessageHandler::HandleIncomingMessageProtocol(
const protocol_handler::RawMessagePtr message) {
- if (message->protocol_version() == ProtocolVersion::kV1) {
- return MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
+ DCHECK_OR_RETURN(message, NULL);
+ application_manager::Message* out_message = NULL;
+ switch (message->protocol_version()) {
+ case ProtocolVersion::kV1:
+ LOG4CXX_DEBUG(logger_, "Protocol version - V1");
+ out_message = MobileMessageHandler::HandleIncomingMessageProtocolV1(message);
+ break;
+ case ProtocolVersion::kV2:
+ LOG4CXX_DEBUG(logger_, "Protocol version - V2");
+ out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
+ break;
+ case ProtocolVersion::kV3:
+ LOG4CXX_DEBUG(logger_, "Protocol version - V3");
+ out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
+ break;
+ case ProtocolVersion::kV4:
+ LOG4CXX_DEBUG(logger_, "Protocol version - V4");
+ out_message = MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
+ break;
+ default:
+ LOG4CXX_WARN(logger_, "Can't recognise protocol version");
+ out_message = NULL;
+ break;
}
- if ((message->protocol_version() == ProtocolVersion::kV2) ||
- (message->protocol_version() == ProtocolVersion::kV3) ||
- (message->protocol_version() == ProtocolVersion::kV4)) {
- return MobileMessageHandler::HandleIncomingMessageProtocolV2(message);
+ if (out_message == NULL) {
+ LOG4CXX_WARN(logger_, "Message is NULL");
+ return NULL;
}
- return NULL;
+ LOG4CXX_DEBUG(logger_, "Incoming RPC_INFO: " <<
+ (out_message->connection_key() >> 16) <<", "<<
+ messageTypes[out_message->type()] <<", "<<
+ out_message->function_id() << ", " <<
+ out_message->correlation_id() << ", " <<
+ out_message->json_message());
+ return out_message;
}
protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtocol(
const MobileMessage& message) {
+
+ LOG4CXX_DEBUG(logger_, "Outgoing RPC_INFO: " <<
+ (message->connection_key() >> 16) <<", "<<
+ messageTypes[message->type()]<<", "<<
+ message->function_id() << ", " <<
+ message->correlation_id() << ", " <<
+ message->json_message());
+
if (message->protocol_version() == application_manager::kV1) {
return MobileMessageHandler::HandleOutgoingMessageProtocolV1(message);
}
if ((message->protocol_version() == application_manager::kV2) ||
- (message->protocol_version() == application_manager::kV3) ||
- (message->protocol_version() == application_manager::kV4)) {
+ (message->protocol_version() == application_manager::kV3) ||
+ (message->protocol_version() == application_manager::kV4)) {
return MobileMessageHandler::HandleOutgoingMessageProtocolV2(message);
}
return NULL;
@@ -84,8 +127,7 @@ protocol_handler::RawMessage* MobileMessageHandler::HandleOutgoingMessageProtoco
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV1(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleIncomingMessageProtocolV1()");
+ LOG4CXX_AUTO_TRACE(logger_);
application_manager::Message* outgoing_message =
new application_manager::Message(
protocol_handler::MessagePriority::FromServiceType(
@@ -115,9 +157,7 @@ MobileMessageHandler::HandleIncomingMessageProtocolV1(
application_manager::Message*
MobileMessageHandler::HandleIncomingMessageProtocolV2(
const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleIncomingMessageProtocolV2()");
-
+ LOG4CXX_AUTO_TRACE(logger_);
utils::BitStream message_bytestream(message->data(), message->data_size());
protocol_handler::ProtocolPayloadV2 payload;
protocol_handler::Extract(&message_bytestream, &payload,
@@ -158,11 +198,10 @@ MobileMessageHandler::HandleIncomingMessageProtocolV2(
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocolV1(
const MobileMessage& message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleOutgoingMessageProtocolV1()");
+ LOG4CXX_AUTO_TRACE(logger_);
std::string messageString = message->json_message();
if (messageString.length() == 0) {
- LOG4CXX_INFO(logger_,
+ LOG4CXX_WARN(logger_,
"Drop ill-formed message from mobile");
return NULL;
}
@@ -181,8 +220,7 @@ MobileMessageHandler::HandleOutgoingMessageProtocolV1(
protocol_handler::RawMessage*
MobileMessageHandler::HandleOutgoingMessageProtocolV2(
const MobileMessage& message) {
- LOG4CXX_INFO(logger_,
- "MobileMessageHandler HandleOutgoingMessageProtocolV2()");
+ LOG4CXX_AUTO_TRACE(logger_);
if (message->json_message().length() == 0) {
LOG4CXX_ERROR(logger_, "json string is empty.");
}
diff --git a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc
index f6fe4b2538..497558d8d2 100644
--- a/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc
+++ b/src/components/application_manager/src/policies/delegates/app_permission_delegate.cc
@@ -34,7 +34,7 @@
#include "application_manager/policies/policy_handler.h"
namespace policy {
- CREATE_LOGGERPTR_GLOBAL(logger_, "AppPermissionDelegate")
+ CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
AppPermissionDelegate::AppPermissionDelegate(
const uint32_t connection_key, const PermissionConsent& permissions)
diff --git a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
index d4335cec8c..26a1df2e3c 100644
--- a/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
+++ b/src/components/application_manager/src/policies/delegates/statistics_delegate.cc
@@ -33,7 +33,7 @@
#include "application_manager/policies/delegates/statistics_delegate.h"
#include "application_manager/policies/policy_handler.h"
-CREATE_LOGGERPTR_GLOBAL(logger_, "StatisticDelegate")
+CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
namespace policy {
StatisticsDelegate::StatisticsDelegate(usage_statistics::GlobalCounterId type)
: type_(INCREMENT_GLOBAL),
diff --git a/src/components/application_manager/src/policies/policy_event_observer.cc b/src/components/application_manager/src/policies/policy_event_observer.cc
index 09f97dd3f1..184f091bf5 100644
--- a/src/components/application_manager/src/policies/policy_event_observer.cc
+++ b/src/components/application_manager/src/policies/policy_event_observer.cc
@@ -95,14 +95,10 @@ void PolicyEventObserver::ProcessOdometerEvent(const smart_objects::SmartObject&
.asInt())) {
if (message[strings::msg_params].keyExists(strings::odometer)) {
- TimevalStruct current_time = date_time::DateTime::getCurrentTime();
- const int kSecondsInDay = 60 * 60 * 24;
- int days_after_epoch = current_time.tv_sec / kSecondsInDay;
-
if (policy_handler_) {
policy_handler_->PTUpdatedAt(
- message[strings::msg_params][strings::odometer].asInt(),
- days_after_epoch);
+ Counters::KILOMETERS,
+ message[strings::msg_params][strings::odometer].asInt());
}
}
}
diff --git a/src/components/application_manager/src/policies/policy_handler.cc b/src/components/application_manager/src/policies/policy_handler.cc
index 31d8099433..60a90f545e 100644
--- a/src/components/application_manager/src/policies/policy_handler.cc
+++ b/src/components/application_manager/src/policies/policy_handler.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2014, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -43,6 +43,7 @@
#include "application_manager/application_manager_impl.h"
#include "application_manager/message_helper.h"
#include "policy/policy_manager_impl.h"
+#include "./types.h"
#include "connection_handler/connection_handler.h"
#include "utils/macro.h"
#include "utils/date_time.h"
@@ -53,37 +54,40 @@
#include "policy/policy_types.h"
#include "interfaces/MOBILE_API.h"
#include "utils/file_system.h"
+#include "utils/scope_guard.h"
+#include "utils/make_shared.h"
namespace policy {
using namespace application_manager;
+CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
+
namespace {
using namespace mobile_apis;
typedef std::map<RequestType::eType, std::string> RequestTypeMap;
RequestTypeMap TypeToString = {
- {RequestType::INVALID_ENUM, "INVALID_ENUM"},
- {RequestType::HTTP, "HTTP"},
- {RequestType::FILE_RESUME, "FILE_RESUME"},
- {RequestType::AUTH_REQUEST, "AUTH_REQUEST"},
- {RequestType::AUTH_CHALLENGE, "AUTH_CHALLENGE"},
- {RequestType::AUTH_ACK, "AUTH_ACK"},
- {RequestType::PROPRIETARY, "PROPRIETARY"},
- {RequestType::QUERY_APPS, "QUERY_APPS"},
- {RequestType::LAUNCH_APP, "LAUNCH_APP"},
- {RequestType::LOCK_SCREEN_ICON_URL, "LOCK_SCREEN_ICON_URL"},
- {RequestType::TRAFFIC_MESSAGE_CHANNEL, "TRAFFIC_MESSAGE_CHANNEL"},
- {RequestType::DRIVER_PROFILE, "DRIVER_PROFILE"},
- {RequestType::VOICE_SEARCH, "VOICE_SEARCH"},
- {RequestType::NAVIGATION, "NAVIGATION"},
- {RequestType::PHONE,"PHONE"},
- {RequestType::CLIMATE, "CLIMATE"},
- {RequestType::SETTINGS, "SETTINGS"},
- {RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"},
- {RequestType::EMERGENCY, "EMERGENCY"},
- {RequestType::MEDIA, "MEDIA"},
- {RequestType::FOTA, "FOTA"}
-};
+ {RequestType::INVALID_ENUM, "INVALID_ENUM"},
+ {RequestType::HTTP, "HTTP"},
+ {RequestType::FILE_RESUME, "FILE_RESUME"},
+ {RequestType::AUTH_REQUEST, "AUTH_REQUEST"},
+ {RequestType::AUTH_CHALLENGE, "AUTH_CHALLENGE"},
+ {RequestType::AUTH_ACK, "AUTH_ACK"},
+ {RequestType::PROPRIETARY, "PROPRIETARY"},
+ {RequestType::QUERY_APPS, "QUERY_APPS"},
+ {RequestType::LAUNCH_APP, "LAUNCH_APP"},
+ {RequestType::LOCK_SCREEN_ICON_URL, "LOCK_SCREEN_ICON_URL"},
+ {RequestType::TRAFFIC_MESSAGE_CHANNEL, "TRAFFIC_MESSAGE_CHANNEL"},
+ {RequestType::DRIVER_PROFILE, "DRIVER_PROFILE"},
+ {RequestType::VOICE_SEARCH, "VOICE_SEARCH"},
+ {RequestType::NAVIGATION, "NAVIGATION"},
+ {RequestType::PHONE, "PHONE"},
+ {RequestType::CLIMATE, "CLIMATE"},
+ {RequestType::SETTINGS, "SETTINGS"},
+ {RequestType::VEHICLE_DIAGNOSTICS, "VEHICLE_DIAGNOSTICS"},
+ {RequestType::EMERGENCY, "EMERGENCY"},
+ {RequestType::MEDIA, "MEDIA"},
+ {RequestType::FOTA, "FOTA"}};
const std::string RequestTypeToString(RequestType::eType type) {
RequestTypeMap::const_iterator it = TypeToString.find(type);
@@ -92,29 +96,47 @@ const std::string RequestTypeToString(RequestType::eType type) {
}
return "";
}
-}
-#define POLICY_LIB_CHECK(return_value) {\
- sync_primitives::AutoReadLock lock(policy_manager_lock_); \
- if (!policy_manager_) {\
- LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded");\
- return return_value;\
- }\
-}
-#define POLICY_LIB_CHECK_VOID() {\
- sync_primitives::AutoReadLock lock(policy_manager_lock_); \
- if (!policy_manager_) {\
- LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded");\
- return;\
- }\
+const policy::DeviceParams GetDeviceParams(
+ connection_handler::DeviceHandle device_handle,
+ const protocol_handler::SessionObserver& session_observer) {
+ CREATE_LOGGERPTR_LOCAL(logger_, "PolicyHandler")
+ policy::DeviceParams device_params;
+ if (-1 ==
+ session_observer.GetDataOnDeviceID(
+ device_handle,
+ &device_params.device_name,
+ NULL,
+ &device_params.device_mac_address,
+ &device_params.device_connection_type)) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to extract information for device " << device_handle);
+ }
+ device_params.device_handle = device_handle;
+ return device_params;
}
+}
+#define POLICY_LIB_CHECK(return_value) \
+ { \
+ sync_primitives::AutoReadLock lock(policy_manager_lock_); \
+ if (!policy_manager_) { \
+ LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); \
+ return return_value; \
+ } \
+ }
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyHandler")
-
+#define POLICY_LIB_CHECK_VOID() \
+ { \
+ sync_primitives::AutoReadLock lock(policy_manager_lock_); \
+ if (!policy_manager_) { \
+ LOG4CXX_DEBUG(logger_, "The shared library of policy is not loaded"); \
+ return; \
+ } \
+ }
struct ApplicationListHmiLevelSorter {
- bool operator() (const application_manager::ApplicationSharedPtr& lhs,
- const application_manager::ApplicationSharedPtr& rhs) {
+ bool operator()(const application_manager::ApplicationSharedPtr& lhs,
+ const application_manager::ApplicationSharedPtr& rhs) {
if (lhs && rhs) {
mobile_apis::HMILevel::eType lhs_hmi_level = lhs->hmi_level();
mobile_apis::HMILevel::eType rhs_hmi_level = rhs->hmi_level();
@@ -128,88 +150,90 @@ struct ApplicationListHmiLevelSorter {
}
};
-typedef std::set<application_manager::ApplicationSharedPtr, ApplicationListHmiLevelSorter>
-HmiLevelOrderedApplicationList;
+typedef std::set<application_manager::ApplicationSharedPtr,
+ ApplicationListHmiLevelSorter> HmiLevelOrderedApplicationList;
struct DeactivateApplication {
- explicit DeactivateApplication(
+ explicit DeactivateApplication(
const connection_handler::DeviceHandle& device_id)
: device_id_(device_id) {}
- void operator()(const ApplicationSharedPtr& app) {
- if (device_id_ == app->device()) {
- ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
- mobile_apis::HMILevel::HMI_NONE,
- mobile_apis::AudioStreamingState::NOT_AUDIBLE);
- }
+ void operator()(const ApplicationSharedPtr& app) {
+ if (device_id_ == app->device()) {
+ ApplicationManagerImpl::instance()->SetState<true>(
+ app->app_id(),
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE);
}
+ }
- private:
- connection_handler::DeviceHandle device_id_;
+ private:
+ connection_handler::DeviceHandle device_id_;
};
struct SDLAlowedNotification {
SDLAlowedNotification(const connection_handler::DeviceHandle& device_id,
PolicyManager* policy_manager)
- : device_id_(device_id),
- policy_manager_(policy_manager){}
+ : device_id_(device_id), policy_manager_(policy_manager) {}
void operator()(const ApplicationSharedPtr& app) {
if (!policy_manager_) {
return;
}
if (device_id_ == app->device()) {
- std::string hmi_level;
- mobile_apis::HMILevel::eType default_mobile_hmi;
- policy_manager_->GetDefaultHmi(app->mobile_app_id(), &hmi_level);
- if ("BACKGROUND" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
- } else if ("FULL" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL;
- } else if ("LIMITED" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED;
- } else if ("NONE" == hmi_level) {
- default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE;
- } else {
- return ;
- }
- ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
- default_mobile_hmi
- );
+ std::string hmi_level;
+ mobile_apis::HMILevel::eType default_mobile_hmi;
+ policy_manager_->GetDefaultHmi(app->mobile_app_id(), &hmi_level);
+ if ("BACKGROUND" == hmi_level) {
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_BACKGROUND;
+ } else if ("FULL" == hmi_level) {
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_FULL;
+ } else if ("LIMITED" == hmi_level) {
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_LIMITED;
+ } else if ("NONE" == hmi_level) {
+ default_mobile_hmi = mobile_apis::HMILevel::HMI_NONE;
+ } else {
+ return;
}
+ ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
+ default_mobile_hmi);
}
- private:
- connection_handler::DeviceHandle device_id_;
- PolicyManager* policy_manager_;
+ }
+
+ private:
+ connection_handler::DeviceHandle device_id_;
+ PolicyManager* policy_manager_;
};
struct LinkAppToDevice {
explicit LinkAppToDevice(
- std::map<std::string, std::string>& app_to_device_link)
- : app_to_device_link_(app_to_device_link) {
+ std::map<std::string, std::string>& app_to_device_link)
+ : app_to_device_link_(app_to_device_link) {
app_to_device_link_.clear();
}
void operator()(const ApplicationSharedPtr& app) {
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Invalid pointer to application was passed."
+ LOG4CXX_WARN(logger_,
+ "Invalid pointer to application was passed."
"Skip current application.");
return;
}
- DeviceParams device_params;
- MessageHelper::GetDeviceInfoForApp(
- app->app_id(),
- &device_params);
+ DeviceParams device_params =
+ GetDeviceParams(app->device(),
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer());
const std::string app_id = app->mobile_app_id();
if (device_params.device_mac_address.empty()) {
- LOG4CXX_WARN(logger_, "Couldn't find device, which hosts application "
- << app_id);
+ LOG4CXX_WARN(logger_,
+ "Couldn't find device, which hosts application " << app_id);
return;
}
app_to_device_link_[app_id] = device_params.device_mac_address;
}
-private:
+ private:
std::map<std::string, std::string>& app_to_device_link_;
};
@@ -220,7 +244,7 @@ struct PermissionsConsolidator {
permissions.begin();
std::vector<policy::FunctionalGroupPermission>::const_iterator it_end =
permissions.end();
- for (;it != it_end; ++it) {
+ for (; it != it_end; ++it) {
std::vector<policy::FunctionalGroupPermission>::iterator it_consolidated =
std::find(consolidated_permissions_.begin(),
consolidated_permissions_.end(),
@@ -248,7 +272,7 @@ struct PermissionsConsolidator {
return consolidated_permissions_;
}
-private:
+ private:
std::vector<policy::FunctionalGroupPermission> consolidated_permissions_;
};
@@ -257,36 +281,34 @@ const std::string PolicyHandler::kLibrary = "libPolicy.so";
PolicyHandler::PolicyHandler()
- : AsyncRunner("PolicyHandler async runner thread"),
- dl_handle_(0),
- last_activated_app_id_(0),
- app_to_device_link_lock_(true),
- statistic_manager_impl_(new StatisticManagerImpl()) {
-}
-
-PolicyHandler::~PolicyHandler() {
+ : AsyncRunner("PolicyHandler async runner thread")
+ , dl_handle_(0)
+ , last_activated_app_id_(0)
+ , app_to_device_link_lock_(true)
+ , statistic_manager_impl_(utils::MakeShared<StatisticManagerImpl>()) {}
-}
+PolicyHandler::~PolicyHandler() {}
bool PolicyHandler::LoadPolicyLibrary() {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoWriteLock lock(policy_manager_lock_);
if (!PolicyEnabled()) {
- LOG4CXX_WARN(logger_, "System is configured to work without policy "
+ LOG4CXX_WARN(logger_,
+ "System is configured to work without policy "
"functionality.");
- policy_manager_ = NULL;
+ policy_manager_.reset();
return NULL;
}
dl_handle_ = dlopen(kLibrary.c_str(), RTLD_LAZY);
- char* error_string = dlerror();
- if (error_string == NULL) {
+ char* error = dlerror();
+ if (!error) {
if (CreateManager()) {
policy_manager_->set_listener(this);
- event_observer_= new PolicyEventObserver(this);
+ event_observer_ = utils::MakeShared<PolicyEventObserver>(this);
}
} else {
- LOG4CXX_ERROR(logger_, error_string);
+ LOG4CXX_ERROR(logger_, error);
}
return policy_manager_.valid();
@@ -298,9 +320,10 @@ bool PolicyHandler::PolicyEnabled() {
bool PolicyHandler::CreateManager() {
typedef PolicyManager* (*CreateManager)();
- CreateManager create_manager = reinterpret_cast<CreateManager>(dlsym(dl_handle_, "CreateManager"));
+ CreateManager create_manager =
+ reinterpret_cast<CreateManager>(dlsym(dl_handle_, "CreateManager"));
char* error_string = dlerror();
- if (error_string == NULL) {
+ if (NULL == error_string) {
policy_manager_ = create_manager();
} else {
LOG4CXX_WARN(logger_, error_string);
@@ -314,9 +337,9 @@ bool PolicyHandler::InitPolicyTable() {
// Subscribing to notification for system readiness to be able to get system
// info necessary for policy table
event_observer_->subscribe_on_event(
- hmi_apis::FunctionID::BasicCommunication_OnReady);
+ hmi_apis::FunctionID::BasicCommunication_OnReady);
std::string preloaded_file =
- profile::Profile::instance()->preloaded_pt_file();
+ profile::Profile::instance()->preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
return policy_manager_->InitPT(preloaded_file);
}
@@ -328,7 +351,7 @@ bool PolicyHandler::ResetPolicyTable() {
LOG4CXX_TRACE(logger_, "Reset policy table.");
POLICY_LIB_CHECK(false);
std::string preloaded_file =
- profile::Profile::instance()->preloaded_pt_file();
+ profile::Profile::instance()->preloaded_pt_file();
if (file_system::FileExists(preloaded_file)) {
return policy_manager_->ResetPT(preloaded_file);
}
@@ -348,14 +371,20 @@ uint32_t PolicyHandler::GetAppIdForSending() {
LOG4CXX_INFO(logger_, "Apps size: " << app_list.size());
- DeviceParams device_param;
for (HmiLevelOrderedApplicationList::const_iterator first = app_list.begin();
- first != app_list.end(); ++first) {
+ first != app_list.end();
+ ++first) {
if ((*first)->IsRegistered()) {
const uint32_t app_id = (*first)->app_id();
- MessageHelper::GetDeviceInfoForApp(app_id, &device_param);
+ DeviceParams device_params =
+ GetDeviceParams((*first)->device(),
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer());
+
if (kDeviceAllowed ==
- policy_manager_->GetUserConsentForDevice(device_param.device_mac_address)) {
+ policy_manager_->GetUserConsentForDevice(
+ device_params.device_mac_address)) {
return app_id;
}
}
@@ -364,8 +393,8 @@ uint32_t PolicyHandler::GetAppIdForSending() {
return 0;
}
-void PolicyHandler::OnAppPermissionConsent(const uint32_t connection_key,
- const PermissionConsent& permissions) {
+void PolicyHandler::OnAppPermissionConsent(
+ const uint32_t connection_key, const PermissionConsent& permissions) {
LOG4CXX_AUTO_TRACE(logger_);
AsyncRun(new AppPermissionDelegate(connection_key, permissions));
}
@@ -374,34 +403,28 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
bool is_allowed) {
POLICY_LIB_CHECK_VOID();
connection_handler::DeviceHandle device_handle;
- ApplicationManagerImpl::instance()->connection_handler()
- ->GetDeviceID(device_id, &device_handle);
+ ApplicationManagerImpl::instance()->connection_handler().GetDeviceID(
+ device_id, &device_handle);
// In case of changed consent for device, related applications will be
// limited to pre_DataConsent permissions, if device disallowed, or switch
// back to their own permissions, if device allowed again, and must be
// notified about these changes
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list =
- accessor.begin();
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list_end =
- accessor.end();
+ ApplicationSetConstIt it_app_list = accessor.begin();
+ ApplicationSetConstIt it_app_list_end = accessor.end();
for (; it_app_list != it_app_list_end; ++it_app_list) {
if (device_handle == (*it_app_list).get()->device()) {
-
- const std::string policy_app_id =
- (*it_app_list)->mobile_app_id();
+ const std::string policy_app_id = (*it_app_list)->mobile_app_id();
// If app has predata policy, which is assigned without device consent or
// with negative data consent, there no necessity to change smth and send
// notification for such app in case of device consent is not allowed
- if (policy_manager_->IsPredataPolicy(policy_app_id) &&
- !is_allowed) {
+ if (policy_manager_->IsPredataPolicy(policy_app_id) && !is_allowed) {
continue;
}
- policy_manager_->ReactOnUserDevConsentForApp(policy_app_id,
- is_allowed);
+ policy_manager_->ReactOnUserDevConsentForApp(policy_app_id, is_allowed);
policy_manager_->SendNotificationOnPermissionsUpdated(policy_app_id);
}
@@ -410,16 +433,16 @@ void PolicyHandler::OnDeviceConsentChanged(const std::string& device_id,
void PolicyHandler::OnPTExchangeNeeded() {
POLICY_LIB_CHECK_VOID();
- policy_manager_->ForcePTExchange();
+ MessageHelper::SendOnStatusUpdate(policy_manager_->ForcePTExchange());
}
void PolicyHandler::GetAvailableApps(std::queue<std::string>& apps) {
LOG4CXX_INFO(logger_, "GetAvailable apps");
ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationManagerImpl::ApplictionSet app_list = accessor.applications();
- ApplicationManagerImpl::ApplictionSetConstIt iter = app_list.begin();
+ const ApplicationSet app_list = accessor.applications();
+ ApplicationSetConstIt iter = app_list.begin();
- for (;app_list.end() != iter; ++iter) {
+ for (; app_list.end() != iter; ++iter) {
LOG4CXX_INFO(logger_, "one more app");
apps.push((*iter)->mobile_app_id());
}
@@ -430,6 +453,13 @@ void PolicyHandler::AddApplication(const std::string& application_id) {
policy_manager_->AddApplication(application_id);
}
+void PolicyHandler::AddDevice(const std::string& device_id,
+ const std::string& connection_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->AddDevice(device_id, connection_type);
+}
+
void PolicyHandler::SetDeviceInfo(std::string& device_id,
const DeviceInfo& device_info) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -438,20 +468,20 @@ void PolicyHandler::SetDeviceInfo(std::string& device_id,
}
void PolicyHandler::OnAppPermissionConsentInternal(
- const uint32_t connection_key, PermissionConsent &permissions) {
+ const uint32_t connection_key, PermissionConsent& permissions) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
if (connection_key) {
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()
- ->application(connection_key);
+ ApplicationManagerImpl::instance()->application(connection_key);
if (app.valid()) {
permissions.policy_app_id = app->mobile_app_id();
- policy::DeviceParams device_params;
- MessageHelper::GetDeviceInfoForHandle(
- app->device(),
- &device_params);
+ DeviceParams device_params =
+ GetDeviceParams(app->device(),
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer());
permissions.device_id = device_params.device_mac_address;
}
@@ -465,7 +495,8 @@ void PolicyHandler::OnAppPermissionConsentInternal(
sync_primitives::AutoLock lock(app_to_device_link_lock_);
if (!app_to_device_link_.size()) {
- LOG4CXX_WARN(logger_, "There are no applications previously stored for "
+ LOG4CXX_WARN(logger_,
+ "There are no applications previously stored for "
"setting common permissions.");
return;
}
@@ -474,26 +505,26 @@ void PolicyHandler::OnAppPermissionConsentInternal(
app_to_device_link_.begin();
std::map<std::string, std::string>::const_iterator it_end =
app_to_device_link_.end();
- for (;it != it_end; ++it) {
+ for (; it != it_end; ++it) {
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->
- application_by_policy_id(it->first);
+ ApplicationManagerImpl::instance()->application_by_policy_id(it->first);
// If list of apps sent to HMI for user consents is not the same as current,
// permissions should be set only for coincident to registered apps
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Invalid pointer to application was passed."
+ LOG4CXX_WARN(logger_,
+ "Invalid pointer to application was passed."
"Permissions setting skipped.");
continue;
}
-
- policy::DeviceParams device_params;
- MessageHelper::GetDeviceInfoForHandle(
- app->device(),
- &device_params);
-
+ DeviceParams device_params =
+ GetDeviceParams(app->device(),
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer());
if (device_params.device_mac_address != it->second) {
- LOG4CXX_WARN(logger_, "Device_id of application is changed."
+ LOG4CXX_WARN(logger_,
+ "Device_id of application is changed."
"Permissions setting skipped.");
continue;
}
@@ -504,20 +535,35 @@ void PolicyHandler::OnAppPermissionConsentInternal(
}
}
+void policy::PolicyHandler::SetDaysAfterEpoch() {
+ POLICY_LIB_CHECK_VOID();
+ TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ const int kSecondsInDay = 60 * 60 * 24;
+ int days_after_epoch = current_time.tv_sec / kSecondsInDay;
+ PTUpdatedAt(Counters::DAYS_AFTER_EPOCH, days_after_epoch);
+}
+
+#ifdef ENABLE_SECURITY
+std::string PolicyHandler::RetrieveCertificate() const {
+ POLICY_LIB_CHECK(std::string(""));
+ return policy_manager_->RetrieveCertificate();
+}
+#endif // ENABLE_SECURITY
+
void PolicyHandler::OnGetUserFriendlyMessage(
- const std::vector<std::string>& message_codes, const std::string& language,
- uint32_t correlation_id) {
+ const std::vector<std::string>& message_codes,
+ const std::string& language,
+ uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
- std::vector<UserFriendlyMessage> result = policy_manager_
- ->GetUserFriendlyMessages(message_codes, language);
+ std::vector<UserFriendlyMessage> result =
+ policy_manager_->GetUserFriendlyMessages(message_codes, language);
// Send response to HMI with gathered data
- MessageHelper::SendGetUserFriendlyMessageResponse(
- result, correlation_id);
+ MessageHelper::SendGetUserFriendlyMessageResponse(result, correlation_id);
}
void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
- const uint32_t correlation_id) {
+ const uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
// If no specific app was passed, get permissions for all currently registered
@@ -526,10 +572,8 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
sync_primitives::AutoLock lock(app_to_device_link_lock_);
LinkAppToDevice linker(app_to_device_link_);
ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetConstIt it_app
- = accessor.begin();
- ApplicationManagerImpl::ApplictionSetConstIt it_app_end
- = accessor.end();
+ ApplicationSetConstIt it_app = accessor.begin();
+ ApplicationSetConstIt it_app_end = accessor.end();
// Add all currently registered applications
std::for_each(it_app, it_app_end, linker);
@@ -538,32 +582,35 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
std::vector<policy::FunctionalGroupPermission> group_permissions;
std::map<std::string, std::string>::const_iterator it =
app_to_device_link_.begin();
- for (;it != app_to_device_link_.end(); ++it) {
- policy_manager_->GetUserConsentForApp(it->second, it->first,
- group_permissions);
+ for (; it != app_to_device_link_.end(); ++it) {
+ policy_manager_->GetUserConsentForApp(
+ it->second, it->first, group_permissions);
consolidator.Consolidate(group_permissions);
}
MessageHelper::SendGetListOfPermissionsResponse(
- consolidator.GetConsolidatedPermissions(), correlation_id);
+ consolidator.GetConsolidatedPermissions(), correlation_id);
return;
}
// Single app only
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(
- connection_key);
+ ApplicationManagerImpl::instance()->application(connection_key);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Connection key '" << connection_key << "' "
- "not found within registered applications.");
+ LOG4CXX_WARN(logger_,
+ "Connection key '"
+ << connection_key
+ << "' "
+ "not found within registered applications.");
return;
}
-
- DeviceParams device_params;
- MessageHelper::GetDeviceInfoForApp(connection_key,
- &device_params);
+ DeviceParams device_params =
+ GetDeviceParams(app->device(),
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer());
std::vector<FunctionalGroupPermission> group_permissions;
if (device_params.device_mac_address.empty()) {
LOG4CXX_WARN(logger_, "Couldn't find device, which hosts application.");
@@ -574,8 +621,8 @@ void PolicyHandler::OnGetListOfPermissions(const uint32_t connection_key,
app->mobile_app_id(),
group_permissions);
- MessageHelper::SendGetListOfPermissionsResponse(
- group_permissions, correlation_id);
+ MessageHelper::SendGetListOfPermissionsResponse(group_permissions,
+ correlation_id);
}
}
@@ -583,7 +630,7 @@ void PolicyHandler::OnGetStatusUpdate(const uint32_t correlation_id) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
MessageHelper::SendGetStatusUpdateResponse(
- policy_manager_->GetPolicyTableStatus(), correlation_id);
+ policy_manager_->GetPolicyTableStatus(), correlation_id);
}
void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
@@ -592,21 +639,26 @@ void PolicyHandler::OnUpdateStatusChanged(const std::string& status) {
}
std::string PolicyHandler::OnCurrentDeviceIdUpdateRequired(
- const std::string& policy_app_id) {
+ const std::string& policy_app_id) {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
+ ApplicationManagerImpl::instance()->application_by_policy_id(
+ policy_app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "Application with id '" << policy_app_id << "' "
- "not found within registered applications.");
+ LOG4CXX_WARN(logger_,
+ "Application with id '"
+ << policy_app_id
+ << "' "
+ "not found within registered applications.");
return "";
}
- DeviceParams device_param;
- MessageHelper::GetDeviceInfoForApp(app->app_id(),
- &device_param);
- return device_param.device_mac_address;
+ DeviceParams device_params =
+ GetDeviceParams(app->device(),
+ ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer());
+ return device_params.device_mac_address;
}
void PolicyHandler::OnSystemInfoChanged(const std::string& language) {
@@ -636,9 +688,7 @@ void PolicyHandler::OnVIIsReady() {
std::vector<std::string> params;
params.push_back(strings::vin);
- MessageHelper::CreateGetVehicleDataRequest(
- correlation_id, params);
-
+ MessageHelper::CreateGetVehicleDataRequest(correlation_id, params);
}
void PolicyHandler::OnVehicleDataUpdated(
@@ -648,29 +698,31 @@ void PolicyHandler::OnVehicleDataUpdated(
void PolicyHandler::OnPendingPermissionChange(
const std::string& policy_app_id) {
- LOG4CXX_DEBUG(logger_, "PolicyHandler::OnPendingPermissionChange for "
- << policy_app_id);
+ LOG4CXX_DEBUG(logger_,
+ "PolicyHandler::OnPendingPermissionChange for "
+ << policy_app_id);
POLICY_LIB_CHECK_VOID();
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
+ ApplicationManagerImpl::instance()->application_by_policy_id(
+ policy_app_id);
if (!app.valid()) {
LOG4CXX_WARN(logger_,
"No app found for " << policy_app_id << " policy app id.");
return;
}
- AppPermissions permissions = policy_manager_->GetAppPermissionsChanges(
- policy_app_id);
+ AppPermissions permissions =
+ policy_manager_->GetAppPermissionsChanges(policy_app_id);
const uint32_t app_id = app->app_id();
if (permissions.appRevoked) {
application_manager::MessageHelper::SendOnAppPermissionsChangedNotification(
- app_id, permissions);
- ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
- mobile_apis::HMILevel::HMI_NONE,
- mobile_apis::AudioStreamingState::NOT_AUDIBLE);
+ app_id, permissions);
+ ApplicationManagerImpl::instance()->SetState<true>(
+ app->app_id(),
+ mobile_apis::HMILevel::HMI_NONE,
+ mobile_apis::AudioStreamingState::NOT_AUDIBLE);
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
return;
}
@@ -678,49 +730,48 @@ void PolicyHandler::OnPendingPermissionChange(
mobile_apis::HMILevel::eType app_hmi_level = app->hmi_level();
switch (app_hmi_level) {
- case mobile_apis::HMILevel::eType::HMI_FULL:
- case mobile_apis::HMILevel::eType::HMI_LIMITED: {
- if (permissions.appPermissionsConsentNeeded) {
- MessageHelper::
- SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
-
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
- // "Break" statement has to be here to continue processing in case of
- // there is another "true" flag in permissions struct
- break;
+ case mobile_apis::HMILevel::eType::HMI_FULL:
+ case mobile_apis::HMILevel::eType::HMI_LIMITED: {
+ if (permissions.appPermissionsConsentNeeded) {
+ MessageHelper::SendOnAppPermissionsChangedNotification(app->app_id(),
+ permissions);
+
+ policy_manager_->RemovePendingPermissionChanges(policy_app_id);
+ // "Break" statement has to be here to continue processing in case of
+ // there is another "true" flag in permissions struct
+ break;
+ }
}
- }
- case mobile_apis::HMILevel::eType::HMI_BACKGROUND: {
- if (permissions.isAppPermissionsRevoked) {
- MessageHelper::
- SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
+ case mobile_apis::HMILevel::eType::HMI_BACKGROUND: {
+ if (permissions.isAppPermissionsRevoked) {
+ MessageHelper::SendOnAppPermissionsChangedNotification(app->app_id(),
+ permissions);
- policy_manager_->RemovePendingPermissionChanges(policy_app_id);
+ policy_manager_->RemovePendingPermissionChanges(policy_app_id);
+ }
+ break;
}
- break;
- }
- default:
- break;
+ default:
+ break;
}
if (permissions.appUnauthorized) {
if (mobile_apis::HMILevel::HMI_FULL == app_hmi_level ||
mobile_apis::HMILevel::HMI_LIMITED == app_hmi_level) {
- MessageHelper::
- SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
+ MessageHelper::SendOnAppPermissionsChangedNotification(app->app_id(),
+ permissions);
}
- MessageHelper::
- SendOnAppInterfaceUnregisteredNotificationToMobile(
- app->app_id(),
- mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
+ MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ app->app_id(),
+ mobile_api::AppInterfaceUnregisteredReason::APP_UNAUTHORIZED);
ApplicationManagerImpl::instance()->OnAppUnauthorized(app->app_id());
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
if (permissions.requestTypeChanged) {
- MessageHelper::
- SendOnAppPermissionsChangedNotification(app->app_id(), permissions);
+ MessageHelper::SendOnAppPermissionsChangedNotification(app->app_id(),
+ permissions);
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
}
}
@@ -730,37 +781,44 @@ bool PolicyHandler::SendMessageToSDK(const BinaryMessage& pt_string,
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
-
- uint32_t app_id = GetAppIdForSending();
+ uint32_t app_id = GetAppIdForSending(); /*last_used_app_ids_.back();*/
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(app_id);
+ ApplicationManagerImpl::instance()->application(app_id);
if (!app.valid()) {
- LOG4CXX_WARN(logger_, "There is no registered application with "
- "connection key '" << app_id << "'");
+ LOG4CXX_WARN(logger_,
+ "There is no registered application with "
+ "connection key '"
+ << app_id
+ << "'");
return false;
}
const std::string& mobile_app_id = app->mobile_app_id();
if (mobile_app_id.empty()) {
- LOG4CXX_WARN(logger_, "Application with connection key '" << app_id << "'"
- " has no application id.");
+ LOG4CXX_WARN(logger_,
+ "Application with connection key '"
+ << app_id
+ << "'"
+ " has no application id.");
return false;
}
- LOG4CXX_DEBUG(logger_, "Update url is " << url << " for application "
- << ApplicationManagerImpl::instance()
- ->application(app_id)->name());
+ LOG4CXX_DEBUG(
+ logger_,
+ "Update url is "
+ << url
+ << " for application "
+ << ApplicationManagerImpl::instance()->application(app_id)->name().c_str());
- MessageHelper::SendPolicySnapshotNotification(
- app_id, pt_string, url, 0);
+ MessageHelper::SendPolicySnapshotNotification(app_id, pt_string, url);
return true;
}
bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
- const BinaryMessage& pt_string) {
+ const BinaryMessage& pt_string) {
POLICY_LIB_CHECK(false);
bool ret = policy_manager_->LoadPT(file, pt_string);
@@ -769,21 +827,22 @@ bool PolicyHandler::ReceiveMessageFromSDK(const std::string& file,
LOG4CXX_INFO(logger_, "PTU was successful.");
policy_manager_->CleanupUnpairedDevices();
int32_t correlation_id =
- ApplicationManagerImpl::instance()
- ->GetNextHMICorrelationID();
+ ApplicationManagerImpl::instance()->GetNextHMICorrelationID();
+
+ SetDaysAfterEpoch();
event_observer_->subscribe_on_event(
#ifdef HMI_DBUS_API
- hmi_apis::FunctionID::VehicleInfo_GetOdometer, correlation_id
+ hmi_apis::FunctionID::VehicleInfo_GetOdometer, correlation_id
#else
- hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id
+ hmi_apis::FunctionID::VehicleInfo_GetVehicleData, correlation_id
#endif
- );
+ );
std::vector<std::string> vehicle_data_args;
vehicle_data_args.push_back(strings::odometer);
- MessageHelper::CreateGetVehicleDataRequest(
- correlation_id, vehicle_data_args);
- } else {
+ MessageHelper::CreateGetVehicleDataRequest(correlation_id,
+ vehicle_data_args);
+ } else {
LOG4CXX_WARN(logger_, "Exchange wasn't successful, trying another one.");
OnPTExchangeNeeded();
}
@@ -807,55 +866,50 @@ bool PolicyHandler::UnloadPolicyLibrary() {
return ret;
}
-void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
- uint32_t device_id) {
+void PolicyHandler::OnAllowSDLFunctionalityNotification(
+ bool is_allowed, const std::string& device_mac) {
LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK_VOID();
// Device ids, need to be changed
- std::set<uint32_t> device_ids;
- bool device_specific = device_id != 0;
+ std::vector<std::string> device_macs;
+ const bool device_specific = !device_mac.empty();
// Common devices consents change
+ connection_handler::ConnectionHandler& connection_handler =
+ application_manager::ApplicationManagerImpl::instance()
+ ->connection_handler();
if (!device_specific) {
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- const ApplicationManagerImpl::ApplictionSet app_list = accessor.applications();
-
- ApplicationManagerImpl::ApplictionSetConstIt it_app_list = app_list.begin();
- ApplicationManagerImpl::ApplictionSetConstIt it_app_end = app_list.end();
-
- for (;it_app_list != it_app_end; ++it_app_list) {
- if (!(*it_app_list).valid()) {
- continue;
- }
- device_ids.insert(it_app_list->get()->device());
- }
+ connection_handler.GetConnectedDevicesMAC(device_macs);
} else {
- device_ids.insert(device_id);
+ device_macs.push_back(device_mac);
}
- std::set<uint32_t>::const_iterator it_ids = device_ids.begin();
- std::set<uint32_t>::const_iterator it_ids_end = device_ids.end();
- for (;it_ids != it_ids_end; ++it_ids) {
- const uint32_t device_id = *it_ids;
-
- DeviceParams device_params;
- MessageHelper::GetDeviceInfoForHandle(device_id,
- &device_params);
- device_params.device_handle = device_id;
- if (kDefaultDeviceMacAddress == device_params.device_mac_address) {
- LOG4CXX_WARN(logger_, "Device with handle " << device_id
- << " wasn't found.");
+ std::vector<std::string>::const_iterator it_ids = device_macs.begin();
+ std::vector<std::string>::const_iterator it_ids_end = device_macs.end();
+ for (; it_ids != it_ids_end; ++it_ids) {
+ const std::string device_id = *it_ids;
+
+ if (kDefaultDeviceMacAddress == device_id) {
+ LOG4CXX_WARN(logger_, "Device with id " << device_id << " wasn't found.");
return;
}
- policy_manager_->SetUserConsentForDevice(device_params.device_mac_address,
- is_allowed);
-
+ policy_manager_->SetUserConsentForDevice(device_id, is_allowed);
+ uint32_t device_handle = 0;
+ if (!connection_handler.GetDeviceID(device_mac, &device_handle)) {
+ LOG4CXX_WARN(logger_,
+ "Device hadle with mac " << device_mac << " wasn't found.");
+ }
}
// Case, when specific device was changed
- if (device_id) {
+ if (device_specific) {
+ uint32_t device_handle = 0;
+ if (!connection_handler.GetDeviceID(device_mac, &device_handle)) {
+ LOG4CXX_WARN(logger_,
+ "Device hadle with mac " << device_mac << " wasn't found.");
+ }
DeviceHandles::iterator it = std::find(pending_device_handles_.begin(),
pending_device_handles_.end(),
- device_id);
+ device_handle);
// If consent done from HMI menu
if (it == pending_device_handles_.end()) {
return;
@@ -863,7 +917,6 @@ void PolicyHandler::OnAllowSDLFunctionalityNotification(bool is_allowed,
pending_device_handles_.erase(it);
}
-
}
void PolicyHandler::OnIgnitionCycleOver() {
@@ -877,8 +930,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(
- connection_key);
+ ApplicationManagerImpl::instance()->application(connection_key);
if (!app.valid()) {
LOG4CXX_WARN(logger_, "Activated App failed: no app found.");
return;
@@ -894,8 +946,7 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
permissions.isSDLAllowed = true;
}
} else {
- permissions = policy_manager_->GetAppPermissionsChanges(
- policy_app_id);
+ permissions = policy_manager_->GetAppPermissionsChanges(policy_app_id);
permissions.isSDLAllowed = true;
policy_manager_->RemovePendingPermissionChanges(policy_app_id);
@@ -903,19 +954,20 @@ void PolicyHandler::OnActivateApp(uint32_t connection_key,
// If application is revoked it should not be activated
// In this case we need to activate application
if (false == permissions.appRevoked && true == permissions.isSDLAllowed) {
- LOG4CXX_INFO(logger_, "Application will be activated");
- if (ApplicationManagerImpl::instance()->ActivateApplication(app)) {
- last_activated_app_id_ = 0;
- }
+ LOG4CXX_INFO(logger_, "Application will be activated");
+ if (ApplicationManagerImpl::instance()->ActivateApplication(app)) {
+ last_activated_app_id_ = 0;
+ }
} else {
- LOG4CXX_INFO(logger_, "Application should not be activated");
+ LOG4CXX_WARN(logger_, "Application should not be activated");
}
MessageHelper::SendSDLActivateAppResponse(permissions, correlation_id);
}
void PolicyHandler::KmsChanged(int kilometers) {
- LOG4CXX_DEBUG(logger_, "PolicyHandler::KmsChanged " << kilometers << " kilometers");
+ LOG4CXX_DEBUG(logger_,
+ "PolicyHandler::KmsChanged " << kilometers << " kilometers");
POLICY_LIB_CHECK_VOID();
policy_manager_->KmsChanged(kilometers);
}
@@ -924,8 +976,7 @@ void PolicyHandler::PTExchangeAtUserRequest(uint32_t correlation_id) {
LOG4CXX_TRACE(logger_, "PT exchange at user request");
POLICY_LIB_CHECK_VOID();
std::string update_status = policy_manager_->ForcePTExchange();
- MessageHelper::SendUpdateSDLResponse(update_status,
- correlation_id);
+ MessageHelper::SendUpdateSDLResponse(update_status, correlation_id);
}
void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
@@ -935,12 +986,12 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
OnPermissionsUpdated(policy_app_id, permissions);
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
+ ApplicationManagerImpl::instance()->application_by_policy_id(
+ policy_app_id);
if (!app.valid()) {
LOG4CXX_WARN(
- logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
return;
}
@@ -948,11 +999,12 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
// level to default
mobile_apis::HMILevel::eType current_hmi_level = app->hmi_level();
mobile_apis::HMILevel::eType hmi_level =
- MessageHelper::StringToHMILevel(default_hmi);
+ MessageHelper::StringToHMILevel(default_hmi);
if (mobile_apis::HMILevel::INVALID_ENUM == hmi_level) {
- LOG4CXX_WARN(logger_, "Couldn't convert default hmi level "
- << default_hmi << " to enum.");
+ LOG4CXX_WARN(logger_,
+ "Couldn't convert default hmi level " << default_hmi
+ << " to enum.");
return;
}
if (current_hmi_level == hmi_level) {
@@ -961,17 +1013,26 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
}
switch (current_hmi_level) {
case mobile_apis::HMILevel::HMI_NONE: {
- LOG4CXX_INFO(logger_, "Changing hmi level of application "
- << policy_app_id
- << " to default hmi level " << default_hmi);
- ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
- mobile_apis::HMILevel::HMI_FULL
- );
+ LOG4CXX_INFO(logger_,
+ "Changing hmi level of application "
+ << policy_app_id
+ << " to default hmi level "
+ << default_hmi);
+
+ if (hmi_level == mobile_apis::HMILevel::HMI_FULL) {
+ ApplicationManagerImpl::instance()->SetState<true>(app->app_id(),
+ hmi_level);
+ } else {
+ ApplicationManagerImpl::instance()->SetState<false>(app->app_id(),
+ hmi_level);
+ }
break;
}
default:
- LOG4CXX_WARN(logger_, "Application " << policy_app_id << " is running."
- "HMI level won't be changed.");
+ LOG4CXX_WARN(logger_,
+ "Application " << policy_app_id
+ << " is running."
+ "HMI level won't be changed.");
break;
}
}
@@ -980,30 +1041,33 @@ void PolicyHandler::OnPermissionsUpdated(const std::string& policy_app_id,
const Permissions& permissions) {
LOG4CXX_AUTO_TRACE(logger_);
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
+ ApplicationManagerImpl::instance()->application_by_policy_id(
+ policy_app_id);
if (!app.valid()) {
LOG4CXX_WARN(
- logger_,
- "Connection_key not found for application_id:" << policy_app_id);
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
return;
}
- MessageHelper::SendOnPermissionsChangeNotification(
- app->app_id(), permissions);
+ MessageHelper::SendOnPermissionsChangeNotification(app->app_id(),
+ permissions);
LOG4CXX_DEBUG(
- logger_,
- "Notification sent for application_id:" << policy_app_id
- << " and connection_key " << app->app_id());
+ logger_,
+ "Notification sent for application_id:" << policy_app_id
+ << " and connection_key "
+ << app->app_id());
}
bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string,
std::string& snap_path) {
using namespace profile;
- const std::string& policy_snapshot_file_name = Profile::instance()->policies_snapshot_file_name();
- const std::string& system_files_path = Profile::instance()->system_files_path();
+ const std::string& policy_snapshot_file_name =
+ Profile::instance()->policies_snapshot_file_name();
+ const std::string& system_files_path =
+ Profile::instance()->system_files_path();
snap_path = system_files_path + '/' + policy_snapshot_file_name;
bool result = false;
@@ -1018,11 +1082,14 @@ bool PolicyHandler::SaveSnapshot(const BinaryMessage& pt_string,
return result;
}
-void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string,
- const std::vector<int>& retry_delay_seconds,
- int timeout_exchange) {
+void PolicyHandler::OnSnapshotCreated(const BinaryMessage& pt_string) {
EndpointUrls urls;
policy_manager_->GetServiceUrls("0x07", urls);
+
+ if (urls.empty()) {
+ LOG4CXX_ERROR(logger_, "Service URLs are empty! NOT sending PT to mobile!");
+ return;
+ }
SendMessageToSDK(pt_string, urls.front().url.front());
}
@@ -1043,7 +1110,7 @@ void PolicyHandler::CheckPermissions(const PTString& app_id,
uint32_t PolicyHandler::GetNotificationsNumber(const std::string& priority) {
POLICY_LIB_CHECK(0);
- return policy_manager_->GetNotificationsNumber(priority);
+ return policy_manager_->GetNotificationsNumber(priority);
}
DeviceConsent PolicyHandler::GetUserConsentForDevice(
@@ -1062,10 +1129,12 @@ bool PolicyHandler::GetInitialAppData(const std::string& application_id,
StringArray* nicknames,
StringArray* app_hmi_types) {
POLICY_LIB_CHECK(false);
- return policy_manager_->GetInitialAppData(application_id, nicknames, app_hmi_types);
+ return policy_manager_->GetInitialAppData(
+ application_id, nicknames, app_hmi_types);
}
-void PolicyHandler::GetServiceUrls(const std::string& service_type, EndpointUrls& end_points) {
+void PolicyHandler::GetServiceUrls(const std::string& service_type,
+ EndpointUrls& end_points) {
POLICY_LIB_CHECK_VOID();
policy_manager_->GetServiceUrls(service_type, end_points);
}
@@ -1080,7 +1149,7 @@ void PolicyHandler::ResetRetrySequence() {
policy_manager_->ResetRetrySequence();
}
-int PolicyHandler::NextRetryTimeout() {
+uint32_t PolicyHandler::NextRetryTimeout() {
POLICY_LIB_CHECK(0);
return policy_manager_->NextRetryTimeout();
}
@@ -1100,17 +1169,23 @@ void PolicyHandler::OnSystemReady() {
policy_manager_->OnSystemReady();
}
-void PolicyHandler::PTUpdatedAt(int kilometers, int days_after_epoch) {
+void PolicyHandler::PTUpdatedAt(Counters counter, int value) {
POLICY_LIB_CHECK_VOID();
- policy_manager_->PTUpdatedAt(kilometers, days_after_epoch);
+ policy_manager_->PTUpdatedAt(counter, value);
}
void PolicyHandler::add_listener(PolicyHandlerObserver* listener) {
+ if (NULL == listener) {
+ return;
+ }
sync_primitives::AutoLock lock(listeners_lock_);
listeners_.push_back(listener);
}
void PolicyHandler::remove_listener(PolicyHandlerObserver* listener) {
+ if (NULL == listener) {
+ return;
+ }
sync_primitives::AutoLock lock(listeners_lock_);
listeners_.remove(listener);
}
@@ -1125,13 +1200,11 @@ void PolicyHandler::AddStatisticsInfo(int type) {
switch (static_cast<hmi_apis::Common_StatisticsType::eType>(type)) {
case hmi_apis::Common_StatisticsType::iAPP_BUFFER_FULL: {
usage_statistics::GlobalCounter count_of_iap_buffer_full(
- GetStatisticManager(), usage_statistics::IAP_BUFFER_FULL);
+ GetStatisticManager(), usage_statistics::IAP_BUFFER_FULL);
++count_of_iap_buffer_full;
break;
}
- default: {
- LOG4CXX_WARN(logger_, "Type of statistics is unknown");
- }
+ default: { LOG4CXX_WARN(logger_, "Type of statistics is unknown"); }
}
}
@@ -1140,37 +1213,36 @@ void PolicyHandler::OnSystemError(int code) {
switch (static_cast<hmi_apis::Common_SystemError::eType>(code)) {
case hmi_apis::Common_SystemError::SYNC_REBOOTED: {
usage_statistics::GlobalCounter count_of_sync_reboots(
- GetStatisticManager(), usage_statistics::SYNC_REBOOTS);
+ GetStatisticManager(), usage_statistics::SYNC_REBOOTS);
++count_of_sync_reboots;
break;
}
case hmi_apis::Common_SystemError::SYNC_OUT_OF_MEMMORY: {
usage_statistics::GlobalCounter count_sync_out_of_memory(
- GetStatisticManager(), usage_statistics::SYNC_OUT_OF_MEMORY);
+ GetStatisticManager(), usage_statistics::SYNC_OUT_OF_MEMORY);
++count_sync_out_of_memory;
break;
}
- default: {
- LOG4CXX_WARN(logger_, "System error is unknown");
- }
+ default: { LOG4CXX_WARN(logger_, "System error is unknown"); }
}
}
-std::string PolicyHandler::GetAppName(const std::string& policy_app_id) {
+custom_str::CustomString PolicyHandler::GetAppName(const std::string& policy_app_id) {
ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()
- ->application_by_policy_id(policy_app_id);
+ ApplicationManagerImpl::instance()->application_by_policy_id(
+ policy_app_id);
if (!app.valid()) {
LOG4CXX_WARN(
- logger_,
- "Connection_key not found for application_id:" << policy_app_id);
- return "";
+ logger_,
+ "Connection_key not found for application_id:" << policy_app_id);
+ return custom_str::CustomString("");
}
- return app->name();
+ return app->name();
}
-void PolicyHandler::OnUpdateHMIAppType(std::map<std::string, StringArray> app_hmi_types) {
+void PolicyHandler::OnUpdateHMIAppType(
+ std::map<std::string, StringArray> app_hmi_types) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(listeners_lock_);
HandlersCollection::const_iterator it = listeners_.begin();
@@ -1197,11 +1269,10 @@ void PolicyHandler::RemoveDevice(const std::string& device_id) {
POLICY_LIB_CHECK_VOID();
policy_manager_->MarkUnpairedDevice(device_id);
-
}
bool PolicyHandler::IsApplicationRevoked(const std::string& app_id) {
- LOG4CXX_TRACE(logger_, "PolicyHandler::IsApplicationRevoked");
+ LOG4CXX_AUTO_TRACE(logger_);
POLICY_LIB_CHECK(false);
return policy_manager_->IsApplicationRevoked(app_id);
@@ -1242,7 +1313,7 @@ bool PolicyHandler::CheckSystemAction(
return false;
}
-uint16_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
+uint32_t PolicyHandler::HeartBeatTimeout(const std::string& app_id) const {
POLICY_LIB_CHECK(0);
return policy_manager_->HeartBeatTimeout(app_id);
}
@@ -1269,13 +1340,17 @@ void policy::PolicyHandler::OnAppsSearchCompleted() {
policy_manager_->OnAppsSearchCompleted();
}
+void PolicyHandler::OnAppRegisteredOnMobile(const std::string& application_id) {
+ POLICY_LIB_CHECK_VOID();
+ policy_manager_->OnAppRegisteredOnMobile(application_id);
+}
+
bool PolicyHandler::IsRequestTypeAllowed(
const std::string& policy_app_id,
mobile_apis::RequestType::eType type) const {
POLICY_LIB_CHECK(false);
using namespace mobile_apis;
-
std::string stringified_type = RequestTypeToString(type);
if (stringified_type.empty()) {
LOG4CXX_ERROR(logger_, "Unknown request type.");
@@ -1301,12 +1376,18 @@ const std::vector<std::string> PolicyHandler::GetAppRequestTypes(
return policy_manager_->GetAppRequestTypes(policy_app_id);
}
+const VehicleInfo policy::PolicyHandler::GetVehicleInfo() const {
+ POLICY_LIB_CHECK(VehicleInfo());
+ return policy_manager_->GetVehicleInfo();
+}
+
void PolicyHandler::Increment(usage_statistics::GlobalCounterId type) {
POLICY_LIB_CHECK();
policy_manager_->Increment(type);
}
-void PolicyHandler::Increment(const std::string& app_id, usage_statistics::AppCounterId type) {
+void PolicyHandler::Increment(const std::string& app_id,
+ usage_statistics::AppCounterId type) {
POLICY_LIB_CHECK();
policy_manager_->Increment(app_id, type);
}
@@ -1326,4 +1407,3 @@ void PolicyHandler::Add(const std::string& app_id,
}
} // namespace policy
-
diff --git a/src/components/application_manager/src/request_controller.cc b/src/components/application_manager/src/request_controller.cc
index 098a55fa73..97f26e24cc 100644
--- a/src/components/application_manager/src/request_controller.cc
+++ b/src/components/application_manager/src/request_controller.cc
@@ -36,6 +36,7 @@
#include "application_manager/commands/command_request_impl.h"
#include "application_manager/commands/hmi/request_to_hmi.h"
#include "utils/make_shared.h"
+#include "utils/timer_task_impl.h"
namespace application_manager {
@@ -43,16 +44,19 @@ namespace request_controller {
using namespace sync_primitives;
-CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController");
+CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController")
RequestController::RequestController()
- : pool_state_(UNDEFINED),
- pool_size_(profile::Profile::instance()->thread_pool_size()),
- timer_("RequestCtrlTimer", this, &RequestController::onTimer, true),
- is_low_voltage_(false) {
+ : pool_state_(UNDEFINED),
+ pool_size_(profile::Profile::instance()->thread_pool_size()),
+ timer_("AM RequestCtrlTimer",
+ new timer::TimerTaskImpl<RequestController>(
+ this,
+ &RequestController::onTimer)),
+ is_low_voltage_(false) {
LOG4CXX_AUTO_TRACE(logger_);
InitializeThreadpool();
- timer_.start(dafault_sleep_time_);
+ timer_.Start(default_sleep_time_, true);
}
RequestController::~RequestController() {
@@ -78,7 +82,7 @@ void RequestController::InitializeThreadpool() {
void RequestController::DestroyThreadpool() {
LOG4CXX_AUTO_TRACE(logger_);
{
- AutoLock auto_lock(mobile_request_info_list_lock_);
+ AutoLock auto_lock(mobile_request_list_lock_);
pool_state_ = TPoolState::STOPPED;
LOG4CXX_DEBUG(logger_, "Broadcasting STOP signal to all threads...");
cond_var_.Broadcast(); // notify all threads we are shutting down
@@ -137,7 +141,7 @@ bool RequestController::CheckPendingRequestsAmount(
const uint32_t& pending_requests_amount) {
LOG4CXX_AUTO_TRACE(logger_);
if (pending_requests_amount > 0) {
- const size_t pending_requests_size = mobile_request_info_list_.size();
+ const size_t pending_requests_size = mobile_request_list_.size();
const bool available_to_add =
pending_requests_amount > pending_requests_size;
if (!available_to_add) {
@@ -163,14 +167,10 @@ RequestController::TResult RequestController::addMobileRequest(
<< "connection_key : " << request->connection_key());
RequestController::TResult result = CheckPosibilitytoAdd(request);
if (SUCCESS ==result) {
- // Temporary set timeout to zero. Correct value will be set at the moment
- // of processing start - in threadMain()
- RequestInfoPtr request_info_ptr(utils::MakeShared<MobileRequestInfo>(request, 0u));
- request_info_ptr->set_hmi_level(hmi_level);
- AutoLock auto_lock_list(mobile_request_info_list_lock_);
- mobile_request_info_list_.push_back(request_info_ptr);
+ AutoLock auto_lock_list(mobile_request_list_lock_);
+ mobile_request_list_.push_back(request);
LOG4CXX_DEBUG(logger_, "Waiting for execution: "
- << mobile_request_info_list_.size());
+ << mobile_request_list_.size());
// wake up one thread that is waiting for a task to be available
}
cond_var_.NotifyOne();
@@ -187,19 +187,17 @@ RequestController::TResult RequestController::addHMIRequest(
}
LOG4CXX_DEBUG(logger_, " correlation_id : " << request->correlation_id());
- const uint32_t timeout_in_seconds =
- request->default_timeout() / date_time::DateTime::MILLISECONDS_IN_SECOND;
+ const uint64_t timeout_in_mseconds = static_cast<uint64_t>(request->default_timeout());
RequestInfoPtr request_info_ptr(new HMIRequestInfo(request,
- timeout_in_seconds));
+ timeout_in_mseconds));
- if (0 != timeout_in_seconds) {
- waiting_for_response_.Add(request_info_ptr);
- LOG4CXX_INFO(logger_, "Waiting for response cont:"
- << waiting_for_response_.Size());
- } else {
- LOG4CXX_INFO(logger_, "Default timeout was set to 0."
+ if (0 == timeout_in_mseconds) {
+ LOG4CXX_DEBUG (logger_, "Default timeout was set to 0."
"RequestController will not track timeout of this request.");
}
+ waiting_for_response_.Add(request_info_ptr);
+ LOG4CXX_DEBUG(logger_, "Waiting for response count:" << waiting_for_response_.Size());
+
UpdateTimer();
return RequestController::SUCCESS;
}
@@ -263,21 +261,20 @@ void RequestController::terminateWaitingForExecutionAppRequests(
const uint32_t& app_id) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "app_id: " << app_id
- << "Waiting for execution" << mobile_request_info_list_.size());
- AutoLock auto_lock(mobile_request_info_list_lock_);
- std::list<RequestInfoPtr>::iterator request_it =
- mobile_request_info_list_.begin();
- while (mobile_request_info_list_.end() != request_it) {
- RequestInfoPtr request_info = (*request_it);
- if ((request_info.valid()) &&
- (request_info->request()->connection_key() == app_id)) {
- mobile_request_info_list_.erase(request_it++);
+ << "Waiting for execution" << mobile_request_list_.size());
+ AutoLock auto_lock(mobile_request_list_lock_);
+ std::list<RequestPtr>::iterator request_it =
+ mobile_request_list_.begin();
+ while (mobile_request_list_.end() != request_it) {
+ RequestPtr request = (*request_it);
+ if ((request.valid()) && (request->connection_key() == app_id)) {
+ mobile_request_list_.erase(request_it++);
} else {
++request_it;
}
}
LOG4CXX_DEBUG(logger_, "Waiting for execution "
- << mobile_request_info_list_.size());
+ << mobile_request_list_.size());
}
void RequestController::terminateWaitingForResponseAppRequests(
@@ -293,7 +290,7 @@ void RequestController::terminateAppRequests(
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "app_id : " << app_id
<< "Requests waiting for execution count : "
- << mobile_request_info_list_.size()
+ << mobile_request_list_.size()
<< "Requests waiting for response count : "
<< waiting_for_response_.Size());
@@ -311,8 +308,8 @@ void RequestController::terminateAllMobileRequests() {
LOG4CXX_AUTO_TRACE(logger_);
waiting_for_response_.RemoveMobileRequests();
LOG4CXX_DEBUG(logger_, "Mobile Requests waiting for response cleared");
- AutoLock waiting_execution_auto_lock(mobile_request_info_list_lock_);
- mobile_request_info_list_.clear();
+ AutoLock waiting_execution_auto_lock(mobile_request_list_lock_);
+ mobile_request_list_.clear();
LOG4CXX_DEBUG(logger_, "Mobile Requests waiting for execution cleared");
UpdateTimer();
}
@@ -322,28 +319,28 @@ void RequestController::updateRequestTimeout(
const uint32_t& correlation_id,
const uint32_t& new_timeout) {
LOG4CXX_AUTO_TRACE(logger_);
+
LOG4CXX_DEBUG(logger_, "app_id : " << app_id
<< " mobile_correlation_id : " << correlation_id
<< " new_timeout : " << new_timeout);
LOG4CXX_DEBUG(logger_, "New_timeout is NULL. RequestCtrl will "
"not manage this request any more");
+
RequestInfoPtr request_info =
waiting_for_response_.Find(app_id, correlation_id);
if (request_info) {
- uint32_t timeout_in_seconds =
- new_timeout/date_time::DateTime::MILLISECONDS_IN_SECOND;
waiting_for_response_.RemoveRequest(request_info);
- request_info->updateTimeOut(timeout_in_seconds);
+ request_info->updateTimeOut(new_timeout);
waiting_for_response_.Add(request_info);
UpdateTimer();
LOG4CXX_INFO(logger_, "Timeout updated for "
- << " app_id " << app_id
- << " correlation_id " << correlation_id
- << " new_timeout " << new_timeout);
+ << " app_id: " << app_id
+ << " correlation_id: " << correlation_id
+ << " new_timeout (ms): " << new_timeout);
} else {
LOG4CXX_ERROR(logger_, "Can't find request with "
- << " app_id " << app_id
- << " correlation_id " << correlation_id);
+ << " app_id: " << app_id
+ << " correlation_id: " << correlation_id);
}
}
@@ -415,10 +412,10 @@ void RequestController::Worker::threadMain() {
AutoLock auto_lock(thread_lock_);
while (!stop_flag_) {
// Try to pick a request
- AutoLock auto_lock(request_controller_->mobile_request_info_list_lock_);
+ AutoLock auto_lock(request_controller_->mobile_request_list_lock_);
while ((request_controller_->pool_state_ != TPoolState::STOPPED) &&
- (request_controller_->mobile_request_info_list_.empty())) {
+ (request_controller_->mobile_request_list_.empty())) {
// Wait until there is a task in the queue
// Unlock mutex while wait, then lock it back when signaled
LOG4CXX_INFO(logger_, "Unlocking and waiting");
@@ -431,26 +428,25 @@ void RequestController::Worker::threadMain() {
break;
}
- if (request_controller_->mobile_request_info_list_.empty()) {
+ if (request_controller_->mobile_request_list_.empty()) {
LOG4CXX_WARN(logger_, "Mobile request list is empty");
break;
}
- RequestInfoPtr request_info_ptr(
- request_controller_->mobile_request_info_list_.front());
- request_controller_->mobile_request_info_list_.pop_front();
- bool init_res = request_info_ptr->request()->Init(); // to setup specific
+ RequestPtr request_ptr( request_controller_->mobile_request_list_.front());
+ request_controller_->mobile_request_list_.pop_front();
+
+ bool init_res = request_ptr->Init(); // to setup specific
// default timeout
- const uint32_t timeout_in_seconds =
- request_info_ptr->request()->default_timeout() /
- date_time::DateTime::MILLISECONDS_IN_SECOND;
- // Start time, end time and timeout need to be updated to appropriate values
- request_info_ptr->update_start_time(date_time::DateTime::getCurrentTime());
- request_info_ptr->updateTimeOut(timeout_in_seconds);
+ const uint32_t timeout_in_mseconds = request_ptr->default_timeout();
+ RequestInfoPtr request_info_ptr(new MobileRequestInfo(request_ptr,
+ timeout_in_mseconds));
request_controller_->waiting_for_response_.Add(request_info_ptr);
- if (0 != timeout_in_seconds) {
+ LOG4CXX_DEBUG(logger_, "timeout_in_mseconds " << timeout_in_mseconds);
+
+ if (0 != timeout_in_mseconds) {
request_controller_->UpdateTimer();
} else {
LOG4CXX_DEBUG(logger_, "Default timeout was set to 0. "
@@ -462,11 +458,11 @@ void RequestController::Worker::threadMain() {
// execute
if ((false == request_controller_->IsLowVoltage()) &&
- request_info_ptr->request()->CheckPermissions() && init_res) {
+ request_ptr->CheckPermissions() && init_res) {
LOG4CXX_DEBUG(logger_, "Execute MobileRequest corr_id = "
<< request_info_ptr->requestId()
- << " with timeout: " << timeout_in_seconds);
- request_info_ptr->request()->Run();
+ << " with timeout: " << timeout_in_mseconds);
+ request_ptr->Run();
}
}
}
@@ -484,23 +480,28 @@ void RequestController::UpdateTimer() {
const TimevalStruct current_time = date_time::DateTime::getCurrentTime();
const TimevalStruct end_time = front->end_time();
if (current_time < end_time) {
- const uint64_t secs = end_time.tv_sec - current_time.tv_sec;
- LOG4CXX_DEBUG(logger_, "Sleep for " << secs << " secs");
+ const uint32_t msecs =static_cast<uint32_t>(date_time::DateTime::getmSecs(end_time - current_time) );
+ LOG4CXX_DEBUG(logger_, "Sleep for " << msecs << " millisecs" );
// Timeout for bigger than 5 minutes is a mistake
- timer_.updateTimeOut(secs);
+ timer_.Start(msecs, true);
} else {
- LOG4CXX_WARN(logger_, "Request app_id = " << front->app_id()
- << "correlation_id = " << front->requestId()
- << "is expired a long time ago: "
- << end_time.tv_sec << " - "
- << current_time.tv_sec << " >= "
- << front->timeout_sec());
- timer_.updateTimeOut(0);
+ LOG4CXX_WARN(logger_, "Request app_id: " << front->app_id()
+ << " correlation_id: " << front->requestId()
+ << " is expired. "
+ << "End time (ms): "
+ << date_time::DateTime::getmSecs(end_time)
+ << " Current time (ms): "
+ << date_time::DateTime::getmSecs(current_time)
+ << " Diff (current - end) (ms): "
+ << date_time::DateTime::getmSecs(current_time - end_time)
+ << " Request timeout (sec): "
+ << front->timeout_msec()/date_time::DateTime::MILLISECONDS_IN_SECOND);
+ timer_.Start(0u, true);
}
} else {
LOG4CXX_DEBUG(logger_, "Sleep for default sleep time "
- << dafault_sleep_time_ << " secs");
- timer_.updateTimeOut(dafault_sleep_time_);
+ << default_sleep_time_ << " milliseconds.");
+ timer_.Start(default_sleep_time_, true);
}
}
diff --git a/src/components/application_manager/src/request_info.cc b/src/components/application_manager/src/request_info.cc
index 26af81ea53..2eb412559f 100644
--- a/src/components/application_manager/src/request_info.cc
+++ b/src/components/application_manager/src/request_info.cc
@@ -40,14 +40,14 @@ namespace application_manager {
namespace request_controller {
-CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController");
+CREATE_LOGGERPTR_GLOBAL(logger_, "RequestController")
uint32_t RequestInfo::HmiConnectoinKey = 0;
HMIRequestInfo::HMIRequestInfo(
RequestPtr request,
- const uint64_t timeout_sec):
- RequestInfo(request, HMIRequest, timeout_sec) {
+ const uint64_t timeout_msec):
+ RequestInfo(request, HMIRequest, timeout_msec) {
correlation_id_ = request_->correlation_id();
app_id_ = RequestInfo::HmiConnectoinKey;
}
@@ -55,16 +55,16 @@ HMIRequestInfo::HMIRequestInfo(
HMIRequestInfo::HMIRequestInfo(
RequestPtr request,
const TimevalStruct &start_time,
- const uint64_t timeout_sec):
- RequestInfo(request, HMIRequest, start_time, timeout_sec) {
+ const uint64_t timeout_msec):
+ RequestInfo(request, HMIRequest, start_time, timeout_msec) {
correlation_id_ = request_->correlation_id();
app_id_ = RequestInfo::HmiConnectoinKey;
}
MobileRequestInfo::MobileRequestInfo(
RequestPtr request,
- const uint64_t timeout_sec):
- RequestInfo(request, MobileRequest, timeout_sec) {
+ const uint64_t timeout_msec):
+ RequestInfo(request, MobileRequest, timeout_msec) {
correlation_id_ = request_.get()->correlation_id();
app_id_ = request_.get()->connection_key();
}
@@ -72,8 +72,8 @@ MobileRequestInfo::MobileRequestInfo(
MobileRequestInfo::MobileRequestInfo(
RequestPtr request,
const TimevalStruct &start_time,
- const uint64_t timeout_sec):
- RequestInfo(request, MobileRequest, start_time, timeout_sec) {
+ const uint64_t timeout_msec):
+ RequestInfo(request, MobileRequest, start_time, timeout_msec) {
correlation_id_ = request_.get()->correlation_id();
app_id_ = request_.get()->connection_key();
}
@@ -81,10 +81,10 @@ MobileRequestInfo::MobileRequestInfo(
RequestInfo::RequestInfo(RequestPtr request,
const RequestInfo::RequestType requst_type,
const TimevalStruct& start_time,
- const uint64_t timeout_sec):
+ const uint64_t timeout_msec):
request_(request),
start_time_(start_time),
- timeout_sec_(timeout_sec) {
+ timeout_msec_(timeout_msec) {
updateEndTime();
requst_type_ = requst_type;
correlation_id_ = request_->correlation_id();
@@ -93,23 +93,17 @@ RequestInfo::RequestInfo(RequestPtr request,
void application_manager::request_controller::RequestInfo::updateEndTime() {
end_time_ = date_time::DateTime::getCurrentTime();
- end_time_.tv_sec += timeout_sec_;
-
- // possible delay during IPC
- const uint32_t hmi_delay_sec = 1;
- end_time_.tv_sec += hmi_delay_sec;
+ date_time::DateTime::AddMilliseconds( end_time_, timeout_msec_ );
}
-void RequestInfo::updateTimeOut(const uint64_t& timeout_sec) {
- timeout_sec_ = timeout_sec;
+void RequestInfo::updateTimeOut(const uint64_t& timeout_msec) {
+ timeout_msec_ = timeout_msec;
updateEndTime();
}
bool RequestInfo::isExpired() {
TimevalStruct curr_time = date_time::DateTime::getCurrentTime();
- return end_time_.tv_sec <= curr_time.tv_sec;
- // TODO(AKutsan) APPLINK-9711 Need to use compareTime method when timer will support millisecconds
- // return date_time::GREATER == date_time::DateTime::compareTime(end_time_, curr_time);
+ return date_time::DateTime::getmSecs(end_time_) <= date_time::DateTime::getmSecs(curr_time);
}
uint64_t RequestInfo::hash() {
@@ -189,7 +183,7 @@ RequestInfoPtr RequestInfoSet::FrontWithNotNullTimeout() {
TimeSortedRequestInfoSet::iterator it = time_sorted_pending_requests_.begin();
while (it != time_sorted_pending_requests_.end()) {
RequestInfoPtr tmp = *it;
- if (0 == tmp ->timeout_sec()) {
+ if (0 == tmp ->timeout_msec()) {
++it;
} else {
result = tmp;
diff --git a/src/components/application_manager/src/resume_ctrl.cpp b/src/components/application_manager/src/resume_ctrl.cpp
deleted file mode 100644
index 983699e020..0000000000
--- a/src/components/application_manager/src/resume_ctrl.cpp
+++ /dev/null
@@ -1,1311 +0,0 @@
-/*
- Copyright (c) 2015, Ford Motor Company
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- Redistributions of source code must retain the above copyright notice, this
- list of conditions and the following disclaimer.
-
- Redistributions in binary form must reproduce the above copyright notice,
- this list of conditions and the following
- disclaimer in the documentation and/or other materials provided with the
- distribution.
-
- Neither the name of the Ford Motor Company nor the names of its contributors
- may be used to endorse or promote products derived from this software
- without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
- */
-#include "application_manager/resume_ctrl.h"
-
-#include <fstream>
-#include <algorithm>
-
-#include "config_profile/profile.h"
-#include "utils/file_system.h"
-#include "connection_handler/connection_handler_impl.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application.h"
-#include "application_manager/message_helper.h"
-#include "smart_objects/smart_object.h"
-#include "connection_handler/connection.h"
-#include "formatters/CFormatterJsonBase.hpp"
-#include "application_manager/commands/command_impl.h"
-#include "resumption/last_state.h"
-#include "policy/policy_manager_impl.h"
-#include "application_manager/policies/policy_handler.h"
-#include "application_manager/state_controller.h"
-
-namespace application_manager {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "ResumeCtrl")
-
-namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-
-ResumeCtrl::ResumeCtrl(ApplicationManagerImpl* app_mngr)
- : resumtion_lock_(true),
- app_mngr_(app_mngr),
- save_persistent_data_timer_("RsmCtrlPercist",
- this, &ResumeCtrl::SaveDataOnTimer, true),
- restore_hmi_level_timer_("RsmCtrlRstore",
- this, &ResumeCtrl::ApplicationResumptiOnTimer),
- is_resumption_active_(false),
- is_data_saved(true),
- launch_time_(time(NULL)) {
- LoadResumeData();
- save_persistent_data_timer_.start(profile::Profile::instance()->app_resumption_save_persistent_data_timeout());
-}
-
-void ResumeCtrl::SaveAllApplications() {
- LOG4CXX_AUTO_TRACE(logger_);
- std::set<ApplicationSharedPtr> apps(retrieve_application());
- std::for_each(apps.begin(),
- apps.end(),
- std::bind1st(std::mem_fun(&ResumeCtrl::SaveApplication), this));
- // remove old
-}
-
-void ResumeCtrl::SaveApplication(ApplicationConstSharedPtr application) {
- DCHECK(application.get());
-
- if (!application) {
- LOG4CXX_FATAL(logger_, "Application object is NULL.");
- return;
- }
-
- const std::string& m_app_id = application->mobile_app_id();
- LOG4CXX_TRACE(logger_, "ENTER app_id : " << application->app_id()
- << " mobile app_id : " << m_app_id);
-
- const std::string hash = application->curHash(); // let's make a copy not to depend on application
- const uint32_t grammar_id = application->get_grammar_id();
- const uint32_t time_stamp = (uint32_t)time(NULL);
-
- const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
-
- resumtion_lock_.Acquire();
- Json::Value& json_app = GetFromSavedOrAppend(m_app_id);
-
- json_app[strings::device_mac] =
- MessageHelper::GetDeviceMacAddressForHandle(application->device());
- json_app[strings::app_id] = m_app_id;
- json_app[strings::grammar_id] = grammar_id;
- json_app[strings::connection_key] = application->app_id();
- json_app[strings::hmi_app_id] = application->hmi_app_id();
- json_app[strings::is_media_application] = application->IsAudioApplication();
- json_app[strings::hmi_level] = static_cast<int32_t> (hmi_level);
- json_app[strings::ign_off_count] = 0;
- json_app[strings::suspend_count] = 0;
- json_app[strings::hash_id] = hash;
- json_app[strings::application_commands] =
- GetApplicationCommands(application);
- json_app[strings::application_submenus] =
- GetApplicationSubMenus(application);
- json_app[strings::application_choise_sets] =
- GetApplicationInteractionChoiseSets(application);
- json_app[strings::application_global_properties] =
- GetApplicationGlobalProperties(application);
- json_app[strings::application_subscribtions] =
- GetApplicationSubscriptions(application);
- json_app[strings::application_files] = GetApplicationFiles(application);
- json_app[strings::time_stamp] = time_stamp;
- LOG4CXX_DEBUG(logger_, "SaveApplication : " << json_app.toStyledString());
-
- resumtion_lock_.Release();
-}
-
-void ResumeCtrl::on_event(const event_engine::Event& event) {
- LOG4CXX_TRACE(logger_, "Response from HMI command");
-}
-
-bool ResumeCtrl::RestoreAppHMIState(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- using namespace mobile_apis;
- if (!application) {
- LOG4CXX_ERROR(logger_, " RestoreApplicationHMILevel() application pointer in invalid");
- return false;
- }
- LOG4CXX_DEBUG(logger_, "ENTER app_id : " << application->app_id());
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(application->mobile_app_id());
- if (-1 != idx) {
- const Json::Value& json_app = GetSavedApplications()[idx];
- if (json_app.isMember(strings::hmi_level)) {
-
- const HMILevel::eType saved_hmi_level =
- static_cast<mobile_apis::HMILevel::eType>(
- json_app[strings::hmi_level].asInt());
- LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level);
- return SetAppHMIState(application, saved_hmi_level);
- } else {
- LOG4CXX_FATAL(logger_, "There are some unknown keys among the stored apps");
- }
- }
- LOG4CXX_INFO(logger_, "Failed to restore application HMILevel");
- return false;
-}
-
-bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
- DCHECK_OR_RETURN(application, false);
- LOG4CXX_AUTO_TRACE(logger_);
- mobile_apis::HMILevel::eType default_hmi =
- ApplicationManagerImpl::instance()-> GetDefaultHmiLevel(application);
- bool result = SetAppHMIState(application, default_hmi, false);
- return result;
-}
-
-bool ResumeCtrl::SetAppHMIState(ApplicationSharedPtr application,
- const mobile_apis::HMILevel::eType hmi_level,
- bool check_policy) {
- using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
- if (false == application.valid()) {
- LOG4CXX_ERROR(logger_, "Application pointer in invalid");
- return false;
- }
- LOG4CXX_TRACE(logger_, " app_id : ( " << application->app_id()
- << ", hmi_level : " << hmi_level
- << ", check_policy : " << check_policy << " )");
- const std::string device_id =
- MessageHelper::GetDeviceMacAddressForHandle(application->device());
-
- if (check_policy &&
- policy::PolicyHandler::instance()->GetUserConsentForDevice(device_id)
- != policy::DeviceConsent::kDeviceAllowed) {
- LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed");
- SetupDefaultHMILevel(application);
- return false;
- }
- HMILevel::eType restored_hmi_level = hmi_level;
-
- if ((hmi_level == application->hmi_level()) &&
- (hmi_level != mobile_apis::HMILevel::HMI_NONE)) {
- LOG4CXX_DEBUG(logger_, "Hmi level " << hmi_level << " should not be set to "
- << application->mobile_app_id()
- <<" current hmi_level is " << application->hmi_level());
- return false;
- }
-
- if (HMILevel::HMI_FULL == hmi_level) {
- restored_hmi_level = app_mngr_->IsHmiLevelFullAllowed(application);
- } else if (HMILevel::HMI_LIMITED == hmi_level) {
- bool allowed_limited = application->is_media_application();
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSetConstIt it = accessor.begin();
- for (; accessor.end() != it && allowed_limited; ++it) {
- const ApplicationSharedPtr curr_app = *it;
- if (curr_app->is_media_application()) {
- if (curr_app->hmi_level() == HMILevel::HMI_FULL ||
- curr_app->hmi_level() == HMILevel::HMI_LIMITED) {
- allowed_limited = false;
- }
- }
- }
- if (allowed_limited) {
- restored_hmi_level = HMILevel::HMI_LIMITED;
- } else {
- restored_hmi_level =
- ApplicationManagerImpl::instance()->GetDefaultHmiLevel(application);
- }
- }
- if (HMILevel::HMI_LIMITED == restored_hmi_level) {
- MessageHelper::SendOnResumeAudioSourceToHMI(application->app_id());
- }
-
- const AudioStreamingState::eType restored_audio_state =
- application->is_media_application() &&
- (HMILevel::HMI_FULL == restored_hmi_level ||
- HMILevel::HMI_LIMITED == restored_hmi_level)
- ? AudioStreamingState::AUDIBLE : AudioStreamingState::NOT_AUDIBLE;
-
- if (restored_hmi_level == HMILevel::HMI_FULL) {
- ApplicationManagerImpl::instance()->SetState<true>(application->app_id(),
- restored_hmi_level,
- restored_audio_state);
- } else {
- ApplicationManagerImpl::instance()->SetState<false>(application->app_id(),
- restored_hmi_level,
- restored_audio_state);
- }
- LOG4CXX_INFO(logger_, "Set up application "
- << application->mobile_app_id()
- << " to HMILevel " << hmi_level);
- return true;
-}
-
-bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!application.valid()) {
- LOG4CXX_ERROR(logger_, "Application pointer in invalid");
- return false;
- }
-
- LOG4CXX_DEBUG(logger_, "ENTER app_id : " << application->app_id());
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(application->mobile_app_id());
- if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
- return false;
- }
-
- const Json::Value& saved_app = GetSavedApplications()[idx];
- if(saved_app.isMember(strings::grammar_id)) {
- const uint32_t app_grammar_id = saved_app[strings::grammar_id].asUInt();
- application->set_grammar_id(app_grammar_id);
-
- AddFiles(application, saved_app);
- AddSubmenues(application, saved_app);
- AddCommands(application, saved_app);
- AddChoicesets(application, saved_app);
- SetGlobalProperties(application, saved_app);
- AddSubscriptions(application, saved_app);
- }
- return true;
-}
-
-bool ResumeCtrl::IsHMIApplicationIdExist(uint32_t hmi_app_id) {
- LOG4CXX_TRACE(logger_, "ENTER hmi_app_id :" << hmi_app_id);
- sync_primitives::AutoLock lock(resumtion_lock_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if ((*it).isMember(strings::hmi_app_id)) {
- if ((*it)[strings::hmi_app_id].asUInt() == hmi_app_id) {
- return true;
- }
- }
- }
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- ApplicationManagerImpl::ApplictionSet apps(accessor.applications());
- ApplicationManagerImpl::ApplictionSetIt it = apps.begin();
- ApplicationManagerImpl::ApplictionSetIt it_end = apps.end();
-
- for (;it != it_end; ++it) {
- if (hmi_app_id == (*it)->hmi_app_id()) {
- LOG4CXX_TRACE(logger_, "EXIT result = true");
- return true;
- }
- }
- LOG4CXX_TRACE(logger_, "EXIT result = false");
- return false;
-}
-
-bool ResumeCtrl::IsApplicationSaved(const std::string& mobile_app_id) {
- LOG4CXX_TRACE(logger_, "ENTER mobile_app_id :" << mobile_app_id);
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- int index = GetObjectIndex(mobile_app_id);
- if (-1 == index) {
- return false;
- }
-
- if (!IsResumptionDataValid(index)) {
- LOG4CXX_INFO(logger_, "Resumption data for app " << mobile_app_id <<
- " is corrupted. Remove application from resumption list");
- RemoveApplicationFromSaved(mobile_app_id);
- return false;
- }
-
- return true;
-}
-
-uint32_t ResumeCtrl::GetHMIApplicationID(const std::string& mobile_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- uint32_t hmi_app_id = 0;
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(mobile_app_id);
- if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
- return hmi_app_id;
- }
-
- const Json::Value& json_app = GetSavedApplications()[idx];
- if (json_app.isMember(strings::app_id)) {
- hmi_app_id = json_app[strings::hmi_app_id].asUInt();
- }
- LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
- return hmi_app_id;
-}
-
-bool ResumeCtrl::RemoveApplicationFromSaved(const std::string& mobile_app_id) {
- LOG4CXX_TRACE(logger_, "Remove mobile_app_id " << mobile_app_id);
- sync_primitives::AutoLock lock(resumtion_lock_);
- bool result = false;
- std::vector<Json::Value> temp;
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if ((*it).isMember(strings::app_id)) {
- const std::string& saved_m_app_id = (*it)[strings::app_id].asString();
-
- if (saved_m_app_id != mobile_app_id) {
- temp.push_back((*it));
- } else {
- result = true;
- }
- }
- }
-
- if (false == result) {
- LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
- return result;
- }
-
- GetSavedApplications().clear();
- for (std::vector<Json::Value>::iterator it = temp.begin();
- it != temp.end(); ++it) {
- GetSavedApplications().append((*it));
- }
- LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
- return result;
-}
-
-void ResumeCtrl::Suspend() {
- LOG4CXX_AUTO_TRACE(logger_);
- StopRestoreHmiLevelTimer();
- StopSavePersistentDataTimer();
- SaveAllApplications();
- Json::Value to_save;
- sync_primitives::AutoLock lock(resumtion_lock_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if ((*it).isMember(strings::suspend_count)) {
- const uint32_t suspend_count = (*it)[strings::suspend_count].asUInt();
- (*it)[strings::suspend_count] = suspend_count + 1;
- } else {
- LOG4CXX_WARN(logger_, "Unknown key among saved applications");
- (*it)[strings::suspend_count] = 1;
- }
- if ((*it).isMember(strings::ign_off_count)) {
- const uint32_t ign_off_count = (*it)[strings::ign_off_count].asUInt();
- if (ign_off_count < kApplicationLifes) {
- (*it)[strings::ign_off_count] = ign_off_count + 1;
- to_save.append(*it);
- }
- } else {
- LOG4CXX_WARN(logger_, "Unknown key among saved applications");
- (*it)[strings::ign_off_count] = 1;
- }
- }
- SetSavedApplication(to_save);
- SetLastIgnOffTime(time(NULL));
- LOG4CXX_DEBUG(logger_,
- GetResumptionData().toStyledString());
- resumption::LastState::instance()->SaveToFileSystem();
-}
-
-void ResumeCtrl::OnAwake() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if ((*it).isMember(strings::ign_off_count)) {
- const uint32_t ign_off_count = (*it)[strings::ign_off_count].asUInt();
- (*it)[strings::ign_off_count] = ign_off_count - 1;
- } else {
- LOG4CXX_WARN(logger_, "Unknown key among saved applications");
- (*it)[strings::ign_off_count] = 0;
- }
- }
- ResetLaunchTime();
- StartSavePersistentDataTimer();
-}
-
-
-
-void ResumeCtrl::StartSavePersistentDataTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!save_persistent_data_timer_.isRunning()) {
- save_persistent_data_timer_.start(
- profile::Profile::instance()->app_resumption_save_persistent_data_timeout());
- }
-}
-
-void ResumeCtrl::StopSavePersistentDataTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (save_persistent_data_timer_.isRunning()) {
- save_persistent_data_timer_.stop();
- }
-}
-
-
-void ResumeCtrl::StopRestoreHmiLevelTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (restore_hmi_level_timer_.isRunning()) {
- restore_hmi_level_timer_.stop();
- }
-}
-
-
-bool ResumeCtrl::StartResumption(ApplicationSharedPtr application,
- const std::string& hash) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!application) {
- LOG4CXX_WARN(logger_, "Application not exist");
- return false;
- }
-
- LOG4CXX_DEBUG(logger_, " Resume app_id = " << application->app_id()
- << " hmi_app_id = " << application->hmi_app_id()
- << " mobile_id = " << application->mobile_app_id()
- << "received hash = " << hash);
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(application->mobile_app_id());
- if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
- return false;
- }
-
- const Json::Value& json_app = GetSavedApplications()[idx];
- LOG4CXX_DEBUG(logger_, "Saved_application_data: " << json_app.toStyledString());
- if (json_app.isMember(strings::hash_id) && json_app.isMember(strings::time_stamp)) {
- const std::string& saved_hash = json_app[strings::hash_id].asString();
-
- if (saved_hash == hash) {
- RestoreApplicationData(application);
- }
- application->UpdateHash();
-
- queue_lock_.Acquire();
- waiting_for_timer_.push_back(application->app_id());
- queue_lock_.Release();
- if (!is_resumption_active_) {
- is_resumption_active_ = true;
- restore_hmi_level_timer_.start(
- profile::Profile::instance()->app_resuming_timeout());
- }
- } else {
- LOG4CXX_INFO(logger_, "There are some unknown keys in the dictionary.");
- return false;
- }
-
- return true;
-}
-
-void ResumeCtrl::StartAppHmiStateResumption(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- using namespace profile;
- using namespace date_time;
- DCHECK_OR_RETURN_VOID(application);
- const int idx = GetObjectIndex(application->mobile_app_id());
- DCHECK_OR_RETURN_VOID(idx != -1);
- const Json::Value& json_app = GetSavedApplications()[idx];
-
- if (!json_app.isMember(strings::ign_off_count)) {
- LOG4CXX_INFO(logger_, "Do not need to resume application "
- << application->app_id());
- SetupDefaultHMILevel(application);
- return;
- }
-
- // check if if is resumption during one IGN cycle
- const uint32_t ign_off_count = json_app[strings::ign_off_count].asUInt();
-
- if (0 == ign_off_count) {
- if (CheckAppRestrictions(application, json_app)) {
- LOG4CXX_INFO(logger_, "Resume application after short IGN cycle");
- RestoreAppHMIState(application);
- RemoveApplicationFromSaved(application->mobile_app_id());
- } else {
- LOG4CXX_INFO(logger_, "Do not need to resume application "
- << application->app_id());
- }
- } else {
- if (CheckIgnCycleRestrictions(json_app) &&
- CheckAppRestrictions(application, json_app)) {
- LOG4CXX_INFO(logger_, "Resume application after IGN cycle");
- RestoreAppHMIState(application);
- RemoveApplicationFromSaved(application->mobile_app_id());
- } else {
- LOG4CXX_INFO(logger_, "Do not need to resume application "
- << application->app_id());
- }
- }
-}
-
-std::set<ApplicationSharedPtr> ResumeCtrl::retrieve_application() {
- ApplicationManagerImpl::ApplicationListAccessor accessor;
- return std::set<ApplicationSharedPtr>(accessor.begin(), accessor.end());
-}
-
-bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (!application.valid()) {
- LOG4CXX_WARN(logger_, "Application do not exists");
- return false;
- }
-
- LOG4CXX_DEBUG(logger_, "ENTER app_id = " << application->app_id()
- << "mobile_id = "
- << application->mobile_app_id());
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(application->mobile_app_id());
- if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
- return false;
- }
-
- queue_lock_.Acquire();
- waiting_for_timer_.push_back(application->app_id());
- queue_lock_.Release();
- if (!is_resumption_active_) {
- is_resumption_active_ = true;
- restore_hmi_level_timer_.start(
- profile::Profile::instance()->app_resuming_timeout());
- }
-
- return true;
-}
-
-bool ResumeCtrl::CheckPersistenceFilesForResumption(ApplicationSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (!application.valid()) {
- LOG4CXX_WARN(logger_, "Application do not exists");
- return false;
- }
- LOG4CXX_DEBUG(logger_, "Process app_id = " << application->app_id());
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(application->mobile_app_id());
- if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
- return false;
- }
-
- const Json::Value& saved_app = GetSavedApplications()[idx];
-
- if (!saved_app.isMember(strings::application_commands) ||
- !saved_app.isMember(strings::application_choise_sets)) {
- LOG4CXX_WARN(logger_, "application_commands or "
- "application_choise_sets are not exists");
- return false;
- }
-
- if (!CheckIcons(application, saved_app[strings::application_commands])) {
- return false;
- }
- if (!CheckIcons(application, saved_app[strings::application_choise_sets])) {
- return false;
- }
- LOG4CXX_DEBUG(logger_, " result = true");
- return true;
-}
-
-bool ResumeCtrl::CheckApplicationHash(ApplicationSharedPtr application,
- const std::string& hash) {
- if (!application) {
- LOG4CXX_ERROR(logger_, "Application pointer is invalid");
- return false;
- }
-
- LOG4CXX_DEBUG(logger_, "ENTER app_id : " << application->app_id()
- << " hash : " << hash);
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const int idx = GetObjectIndex(application->mobile_app_id());
- if (-1 == idx) {
- LOG4CXX_WARN(logger_, "Application not saved");
- return false;
- }
-
- const Json::Value& json_app = GetSavedApplications()[idx];
-
- if (json_app.isMember(strings::hash_id)) {
- const std::string& saved_hash = json_app[strings::hash_id].asString();
-
- LOG4CXX_TRACE(logger_, "Found saved application : " << json_app.toStyledString());
- LOG4CXX_INFO(logger_, "received hash = " << hash);
- LOG4CXX_INFO(logger_, "saved hash = " << saved_hash);
- if (hash == saved_hash) {
- return true;
- }
- }
-
- return false;
-}
-
-void ResumeCtrl::SaveDataOnTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (is_resumption_active_) {
- LOG4CXX_WARN(logger_, "Resumption timer is active skip saving");
- return;
- }
-
- if (false == is_data_saved) {
- SaveAllApplications();
- is_data_saved = true;
- resumption::LastState::instance()->SaveToFileSystem();
- }
-}
-
-bool ResumeCtrl::IsDeviceMacAddressEqual(ApplicationSharedPtr application,
- const std::string& saved_device_mac) {
- const std::string device_mac =
- MessageHelper::GetDeviceMacAddressForHandle(application->device());
- return device_mac == saved_device_mac;
-}
-
-Json::Value&ResumeCtrl::GetResumptionData() {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value& last_state = resumption::LastState::instance()->dictionary;
- if (!last_state.isMember(strings::resumption)) {
- last_state[strings::resumption] = Json::Value(Json::objectValue);
- LOG4CXX_WARN(logger_, "resumption section is missed");
- }
- Json::Value& resumption = last_state[strings::resumption];
- if (!resumption.isObject()) {
- LOG4CXX_ERROR(logger_, "resumption type INVALID rewrite");
- resumption = Json::Value(Json::objectValue);
- }
- return resumption;
-}
-
-Json::Value& ResumeCtrl::GetSavedApplications() {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value& resumption = GetResumptionData();
- if (!resumption.isMember(strings::resume_app_list)) {
- resumption[strings::resume_app_list] = Json::Value(Json::arrayValue);
- LOG4CXX_WARN(logger_, "app_list section is missed");
- }
- Json::Value& resume_app_list = resumption[strings::resume_app_list];
- if (!resume_app_list.isArray()) {
- LOG4CXX_ERROR(logger_, "resume_app_list type INVALID rewrite");
- resume_app_list = Json::Value(Json::arrayValue);
- }
- return resume_app_list;
-}
-
-time_t ResumeCtrl::GetIgnOffTime() {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value& resumption = GetResumptionData();
- if (!resumption.isMember(strings::last_ign_off_time)) {
- resumption[strings::last_ign_off_time] = 0;
- LOG4CXX_WARN(logger_, "last_save_time section is missed");
- }
- time_t last_ign_off = static_cast<time_t>(
- resumption[strings::last_ign_off_time].asUInt());
- return last_ign_off;
-}
-
-void ResumeCtrl::SetLastIgnOffTime(time_t ign_off_time) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_WARN(logger_, "ign_off_time = " << ign_off_time);
- Json::Value& resumption = GetResumptionData();
- resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time);
-}
-
-
-void ResumeCtrl::SetSavedApplication(Json::Value& apps_json) {
- Json::Value& app_list = GetSavedApplications();
- app_list = apps_json;
-}
-
-void ResumeCtrl::ClearResumptionInfo() {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value empty_json;
-
- SetSavedApplication(empty_json);
- resumption::LastState::instance()->SaveToFileSystem();
-}
-
-Json::Value ResumeCtrl::GetApplicationCommands(
- ApplicationConstSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value result;
- DCHECK(application.get());
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
- return result;
- }
- const DataAccessor<CommandsMap> accessor = application->commands_map();
- const CommandsMap& commands = accessor.GetData();
- CommandsMap::const_iterator it = commands.begin();
- for (;it != commands.end(); ++it) {
- smart_objects::SmartObject* so = it->second;
- Json::Value curr;
- Formatters::CFormatterJsonBase::objToJsonValue(*so, curr);
- result.append(curr);
- }
- return result;
-}
-
-Json::Value ResumeCtrl::GetApplicationSubMenus(
- ApplicationConstSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value result;
- DCHECK(application.get());
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
- return result;
- }
- const DataAccessor<SubMenuMap> accessor = application->sub_menu_map();
- const SubMenuMap& sub_menus = accessor.GetData();
- SubMenuMap::const_iterator it = sub_menus.begin();
- for (;it != sub_menus.end(); ++it) {
- smart_objects::SmartObject* so = it->second;
- Json::Value curr;
- Formatters::CFormatterJsonBase::objToJsonValue(*so, curr);
- result.append(curr);
- }
- return result;
-}
-
-Json::Value ResumeCtrl::GetApplicationInteractionChoiseSets(
- ApplicationConstSharedPtr application) {
- DCHECK(application.get());
- LOG4CXX_TRACE(logger_, "ENTER app_id:"
- << application->app_id());
-
- Json::Value result;
- const DataAccessor<ChoiceSetMap> accessor = application->choice_set_map();
- const ChoiceSetMap& choices = accessor.GetData();
- ChoiceSetMap::const_iterator it = choices.begin();
- for ( ;it != choices.end(); ++it) {
- smart_objects::SmartObject* so = it->second;
- Json::Value curr;
- Formatters::CFormatterJsonBase::objToJsonValue(*so, curr);
- result.append(curr);
- }
- return result;
-}
-
-Json::Value ResumeCtrl::GetApplicationGlobalProperties(
- ApplicationConstSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value sgp;
- DCHECK(application.get());
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
- return sgp;
- }
-
- const smart_objects::SmartObject* help_promt = application->help_prompt();
- const smart_objects::SmartObject* timeout_prompt = application->timeout_prompt();
- const smart_objects::SmartObject* vr_help = application->vr_help();
- const smart_objects::SmartObject* vr_help_title = application->vr_help_title();
- const smart_objects::SmartObject* vr_synonyms = application->vr_synonyms();
- const smart_objects::SmartObject* keyboard_props = application->keyboard_props();
- const smart_objects::SmartObject* menu_title = application->menu_title();
- const smart_objects::SmartObject* menu_icon = application->menu_icon();
-
- sgp[strings::help_prompt] = JsonFromSO(help_promt);
- sgp[strings::timeout_prompt] = JsonFromSO(timeout_prompt);
- sgp[strings::vr_help] = JsonFromSO(vr_help);
- sgp[strings::vr_help_title] = JsonFromSO(vr_help_title);
- sgp[strings::vr_synonyms] = JsonFromSO(vr_synonyms);
- sgp[strings::keyboard_properties] = JsonFromSO(keyboard_props);
- sgp[strings::menu_title] = JsonFromSO(menu_title);
- sgp[strings::menu_icon] = JsonFromSO(menu_icon);
- return sgp;
-}
-
-Json::Value ResumeCtrl::GetApplicationSubscriptions(
- ApplicationConstSharedPtr application) {
- LOG4CXX_AUTO_TRACE(logger_);
- Json::Value result;
- DCHECK(application.get());
- if (!application) {
- LOG4CXX_ERROR(logger_, "NULL Pointer App");
- return result;
- }
- LOG4CXX_DEBUG(logger_, "app_id:" << application->app_id());
- LOG4CXX_DEBUG(logger_, "SubscribedButtons:" << application->SubscribedButtons().size());
- Append(application->SubscribedButtons().begin(),
- application->SubscribedButtons().end(),
- strings::application_buttons, result);
- LOG4CXX_DEBUG(logger_, "SubscribesIVI:" << application->SubscribesIVI().size());
- Append(application->SubscribesIVI().begin(),
- application->SubscribesIVI().end(),
- strings::application_vehicle_info, result);
- return result;
-}
-
-Json::Value ResumeCtrl::GetApplicationFiles(
- ApplicationConstSharedPtr application) {
- DCHECK(application.get());
- LOG4CXX_TRACE(logger_, "ENTER app_id:"
- << application->app_id());
-
- Json::Value result;
- const AppFilesMap& app_files = application->getAppFiles();
- for(AppFilesMap::const_iterator file_it = app_files.begin();
- file_it != app_files.end(); file_it++) {
- const AppFile& file = file_it->second;
- if (file.is_persistent) {
- Json::Value file_data;
- file_data[strings::persistent_file] = file.is_persistent;
- file_data[strings::is_download_complete] = file.is_download_complete;
- file_data[strings::sync_file_name] = file.file_name;
- file_data[strings::file_type] = file.file_type;
- result.append(file_data);
- }
- }
- return result;
-}
-
-Json::Value ResumeCtrl::GetApplicationShow(
- ApplicationConstSharedPtr application) {
- DCHECK(application.get());
- LOG4CXX_TRACE(logger_, "ENTER app_id:"
- << application->app_id());
-
- Json::Value result;
- const smart_objects::SmartObject* show_so = application->show_command();
- if (!show_so) {
- return result;
- }
- result = JsonFromSO(show_so);
- return result;
-}
-
-Json::Value ResumeCtrl::JsonFromSO(const smart_objects::SmartObject *so) {
- Json::Value temp;
- if (so) {
- Formatters::CFormatterJsonBase::objToJsonValue(*so, temp);
- }
- return temp;
-}
-
-bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request,
- bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (use_events) {
- const hmi_apis::FunctionID::eType function_id =
- static_cast<hmi_apis::FunctionID::eType>(
- (*request)[strings::function_id].asInt());
-
- const int32_t hmi_correlation_id =
- (*request)[strings::correlation_id].asInt();
- subscribe_on_event(function_id, hmi_correlation_id);
- }
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(request)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
- return true;
- }
- return false;
-}
-
-void ResumeCtrl::AddFiles(ApplicationSharedPtr application, const Json::Value& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (saved_app.isMember(strings::application_files)) {
- const Json::Value& application_files = saved_app[strings::application_files];
- for (Json::Value::iterator json_it = application_files.begin();
- json_it != application_files.end(); ++json_it) {
- const Json::Value& file_data = *json_it;
-
- const bool is_persistent = file_data.isMember(strings::persistent_file) &&
- file_data[strings::persistent_file].asBool();
- if (is_persistent) {
- AppFile file;
- file.is_persistent = is_persistent;
- file.is_download_complete = file_data[strings::is_download_complete].asBool();
- file.file_name = file_data[strings::sync_file_name].asString();
- file.file_type = static_cast<mobile_apis::FileType::eType> (
- file_data[strings::file_type].asInt());
- application->AddFile(file);
- }
- }
- } else {
- LOG4CXX_FATAL(logger_, "application_files section is not exists");
- }
-}
-
-void ResumeCtrl::AddSubmenues(ApplicationSharedPtr application, const Json::Value& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (saved_app.isMember(strings::application_submenus)) {
- const Json::Value& app_submenus = saved_app[strings::application_submenus];
- for (Json::Value::iterator json_it = app_submenus.begin();
- json_it != app_submenus.end(); ++json_it) {
- const Json::Value& json_submenu = *json_it;
- smart_objects::SmartObject message(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_submenu, message);
- application->AddSubMenu(message[strings::menu_id].asUInt(), message);
- }
-
- ProcessHMIRequests(MessageHelper::CreateAddSubMenuRequestToHMI(application));
- } else {
- LOG4CXX_FATAL(logger_, "application_submenus section is not exists");
- }
-}
-
-void ResumeCtrl::AddCommands(ApplicationSharedPtr application, const Json::Value& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (saved_app.isMember(strings::application_commands)) {
- const Json::Value& app_commands = saved_app[strings::application_commands];
- for (Json::Value::iterator json_it = app_commands.begin();
- json_it != app_commands.end(); ++json_it) {
- const Json::Value& json_command = *json_it;
- smart_objects::SmartObject message(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_command, message);
- application->AddCommand(message[strings::cmd_id].asUInt(), message);
- }
-
- ProcessHMIRequests(MessageHelper::CreateAddCommandRequestToHMI(application));
- } else {
- LOG4CXX_FATAL(logger_, "application_commands section is not exists");
- }
-}
-
-void ResumeCtrl::AddChoicesets(ApplicationSharedPtr application, const Json::Value& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (saved_app.isMember(strings::application_choise_sets)) {
- const Json::Value& app_choise_sets = saved_app[strings::application_choise_sets];
- for (Json::Value::iterator json_it = app_choise_sets.begin();
- json_it != app_choise_sets.end(); ++json_it) {
- const Json::Value& json_choiset = *json_it;
- smart_objects::SmartObject msg_param(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_choiset , msg_param);
- const int32_t choice_set_id = msg_param
- [strings::interaction_choice_set_id].asInt();
- uint32_t choice_grammar_id = msg_param[strings::grammar_id].asUInt();
- application->AddChoiceSet(choice_set_id, msg_param);
-
- const size_t size = msg_param[strings::choice_set].length();
- for (size_t j = 0; j < size; ++j) {
- smart_objects::SmartObject choise_params(smart_objects::SmartType_Map);
- choise_params[strings::app_id] = application->app_id();
- choise_params[strings::cmd_id] =
- msg_param[strings::choice_set][j][strings::choice_id];
- choise_params[strings::vr_commands] = smart_objects::SmartObject(
- smart_objects::SmartType_Array);
- choise_params[strings::vr_commands] =
- msg_param[strings::choice_set][j][strings::vr_commands];
-
- choise_params[strings::type] = hmi_apis::Common_VRCommandType::Choice;
- choise_params[strings::grammar_id] = choice_grammar_id;
- SendHMIRequest(hmi_apis::FunctionID::VR_AddCommand, &choise_params);
- }
- }
- } else {
- LOG4CXX_FATAL(logger_, "There is no any choicesets");
- }
-}
-
-void ResumeCtrl::SetGlobalProperties(ApplicationSharedPtr application, const Json::Value& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- const Json::Value& global_properties = saved_app[strings::application_global_properties];
- if (!global_properties.isNull()) {
- smart_objects::SmartObject properties_so(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(global_properties , properties_so);
- application->load_global_properties(properties_so);
- MessageHelper::SendGlobalPropertiesToHMI(application);
- }
-}
-
-void ResumeCtrl::AddSubscriptions(ApplicationSharedPtr application, const Json::Value& saved_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (saved_app.isMember(strings::application_subscribtions)) {
- const Json::Value& subscribtions = saved_app[strings::application_subscribtions];
-
- if (subscribtions.isMember(strings::application_buttons)) {
- const Json::Value& subscribtions_buttons = subscribtions[strings::application_buttons];
- mobile_apis::ButtonName::eType btn;
- for (Json::Value::iterator json_it = subscribtions_buttons.begin();
- json_it != subscribtions_buttons.end(); ++json_it) {
- btn = static_cast<mobile_apis::ButtonName::eType>((*json_it).asInt());
- application->SubscribeToButton(btn);
- }
- }
- if (subscribtions.isMember(strings::application_vehicle_info)) {
- const Json::Value& subscribtions_ivi= subscribtions[strings::application_vehicle_info];
- VehicleDataType ivi;
- for (Json::Value::iterator json_it = subscribtions_ivi.begin();
- json_it != subscribtions_ivi.end(); ++json_it) {
- ivi = static_cast<VehicleDataType>((*json_it).asInt());
- application->SubscribeToIVI(ivi);
- }
- }
- ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests(application));
- MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(application);
- }
-}
-
-void ResumeCtrl::ProcessHMIRequests(const smart_objects::SmartObjectList& requests) {
- for (smart_objects::SmartObjectList::const_iterator it = requests.begin(),
- total = requests.end();
- it != total; ++it) {
- ProcessHMIRequest(*it, true);
- }
-}
-
-bool ResumeCtrl::CheckIcons(ApplicationSharedPtr application,
- const Json::Value& json_object) {
- LOG4CXX_AUTO_TRACE(logger_);
- bool result = true;
- if (!json_object.isNull()) {
- Json::Value::const_iterator json_it = json_object.begin();
- for (;json_it != json_object.end() && result; ++json_it) {
- const Json::Value& json_command = *json_it;
- if (!json_command.isNull()) {
- smart_objects::SmartObject message(smart_objects::SmartType::SmartType_Map);
- Formatters::CFormatterJsonBase::jsonValueToObj(json_command, message);
- const mobile_apis::Result::eType verify_images =
- MessageHelper::VerifyImageFiles(message, application);
- result = (mobile_apis::Result::INVALID_DATA != verify_images);
- } else {
- LOG4CXX_WARN(logger_, "Invalid json object");
- }
- }
- } else {
- LOG4CXX_WARN(logger_, "Passed json object is null");
- }
- LOG4CXX_DEBUG(logger_, "CheckIcons result " << result);
- return result;
-}
-
-Json::Value& ResumeCtrl::GetFromSavedOrAppend(const std::string& mobile_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
- for (Json::Value::iterator it = GetSavedApplications().begin();
- it != GetSavedApplications().end(); ++it) {
- if (mobile_app_id == (*it)[strings::app_id].asString()) {
- return *it;
- }
- }
-
- return GetSavedApplications().append(Json::Value());
-}
-
-bool ResumeCtrl::CheckIgnCycleRestrictions(const Json::Value& json_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- bool result = true;
-
- if (!CheckDelayAfterIgnOn()) {
- LOG4CXX_INFO(logger_, "Application was connected long after ign on");
- result = false;
- }
-
- if (!DisconnectedJustBeforeIgnOff(json_app)) {
- LOG4CXX_INFO(logger_, "Application was dissconnected long before ign off");
- result = false;
- }
- return result;
-}
-
-bool ResumeCtrl::DisconnectedInLastIgnCycle(const Json::Value& json_app) {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN(json_app.isMember(strings::suspend_count), false);
- const uint32_t suspend_count = json_app[strings::suspend_count].asUInt();
- LOG4CXX_DEBUG(logger_, " suspend_count " << suspend_count);
- return (1 == suspend_count);
-}
-
-bool ResumeCtrl::DisconnectedJustBeforeIgnOff(const Json::Value& json_app) {
- using namespace date_time;
- using namespace profile;
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN(json_app.isMember(strings::time_stamp), false);
-
- const time_t time_stamp =
- static_cast<time_t>(json_app[strings::time_stamp].asUInt());
- time_t ign_off_time = GetIgnOffTime();
- const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
- LOG4CXX_DEBUG(logger_,"ign_off_time " << ign_off_time
- << "; app_disconnect_time " << time_stamp
- << "; sec_spent_before_ign " << sec_spent_before_ign
- << "; resumption_delay_before_ign " <<
- Profile::instance()->resumption_delay_before_ign());
- return sec_spent_before_ign <=
- Profile::instance()->resumption_delay_before_ign();
-}
-
-bool ResumeCtrl::CheckDelayAfterIgnOn() {
- using namespace date_time;
- using namespace profile;
- LOG4CXX_AUTO_TRACE(logger_);
- time_t curr_time = time(NULL);
- time_t sdl_launch_time = launch_time();
- const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time);
- const uint32_t wait_time =
- Profile::instance()->resumption_delay_after_ign();
- LOG4CXX_DEBUG(logger_, "curr_time " << curr_time
- << "; sdl_launch_time " << sdl_launch_time
- << "; seconds_from_sdl_start " << seconds_from_sdl_start
- << "; wait_time " << wait_time);
- return seconds_from_sdl_start <= wait_time;
-}
-
-bool ResumeCtrl::CheckAppRestrictions(ApplicationSharedPtr application,
- const Json::Value& json_app) {
- using namespace mobile_apis;
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK_OR_RETURN(json_app.isMember(strings::hmi_level), false);
-
- const bool is_media_app = application->is_media_application();
- const HMILevel::eType hmi_level =
- static_cast<HMILevel::eType>(json_app[strings::hmi_level].asInt());
- LOG4CXX_DEBUG(logger_, "is_media_app " << is_media_app
- << "; hmi_level " << hmi_level);
-
- if (is_media_app) {
- if (hmi_level == HMILevel::HMI_FULL ||
- hmi_level == HMILevel::HMI_LIMITED) {
- return true;
- }
- }
- return false;
-}
-
-int ResumeCtrl::GetObjectIndex(const std::string& mobile_app_id) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- sync_primitives::AutoLock lock(resumtion_lock_);
- const Json::Value& apps = GetSavedApplications();
- const Json::ArrayIndex size = apps.size();
- Json::ArrayIndex idx = 0;
- for (; idx != size; ++idx) {
- const std::string& saved_app_id = apps[idx][strings::app_id].asString();
- if (mobile_app_id == saved_app_id) {
- LOG4CXX_DEBUG(logger_, "Found " << idx);
- return idx;
- }
- }
- return -1;
-}
-time_t ResumeCtrl::launch_time() const {
- return launch_time_;
-}
-
-void ResumeCtrl::ResetLaunchTime() {
- launch_time_ = time(NULL);
-}
-
-void ResumeCtrl::ApplicationResumptiOnTimer() {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock auto_lock(queue_lock_);
- is_resumption_active_ = false;
- std::vector<uint32_t>::iterator it = waiting_for_timer_.begin();
-
- for (; it != waiting_for_timer_.end(); ++it) {
- ApplicationSharedPtr app =
- ApplicationManagerImpl::instance()->application(*it);
- if (!app.get()) {
- LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it);
- continue;
- }
-
- StartAppHmiStateResumption(app);
- }
-
- waiting_for_timer_.clear();
-}
-
-void ResumeCtrl::LoadResumeData() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- sync_primitives::AutoLock lock(resumtion_lock_);
-
- Json::Value& resume_app_list = GetSavedApplications();
- Json::Value::iterator full_app = resume_app_list.end();
- time_t time_stamp_full = 0;
- Json::Value::iterator limited_app = resume_app_list.end();
- time_t time_stamp_limited = 0;
-
- Json::Value::iterator it = resume_app_list.begin();
- for (; it != resume_app_list.end(); ++it) {
- if ((*it).isMember(strings::ign_off_count) &&
- (*it).isMember(strings::hmi_level)) {
-
- // only apps with first IGN should be resumed
- const int32_t first_ign = 1;
- if (first_ign == (*it)[strings::ign_off_count].asInt()) {
-
- const mobile_apis::HMILevel::eType saved_hmi_level =
- static_cast<mobile_apis::HMILevel::eType>((*it)[strings::hmi_level].asInt());
-
- const time_t saved_time_stamp =
- static_cast<time_t>((*it)[strings::time_stamp].asUInt());
-
- if (mobile_apis::HMILevel::HMI_FULL == saved_hmi_level) {
- if (time_stamp_full < saved_time_stamp) {
- time_stamp_full = saved_time_stamp;
- full_app = it;
- }
- }
-
- if (mobile_apis::HMILevel::HMI_LIMITED == saved_hmi_level) {
- if (time_stamp_limited < saved_time_stamp) {
- time_stamp_limited = saved_time_stamp;
- limited_app = it;
- }
- }
- }
-
- // set invalid HMI level for all
- (*it)[strings::hmi_level] =
- static_cast<int32_t>(mobile_apis::HMILevel::INVALID_ENUM);
- }
- }
-
- if (full_app != resume_app_list.end()) {
- (*full_app)[strings::hmi_level] =
- static_cast<int32_t>(mobile_apis::HMILevel::HMI_FULL);
- }
-
- if (limited_app != resume_app_list.end()) {
- (*limited_app)[strings::hmi_level] =
- static_cast<int32_t>(mobile_apis::HMILevel::HMI_LIMITED);
- }
- LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString());
-}
-
-bool ResumeCtrl::IsResumptionDataValid(uint32_t index) {
- const Json::Value& json_app = GetSavedApplications()[index];
- if (!json_app.isMember(strings::app_id) ||
- !json_app.isMember(strings::ign_off_count) ||
- !json_app.isMember(strings::hmi_level) ||
- !json_app.isMember(strings::hmi_app_id) ||
- !json_app.isMember(strings::time_stamp)) {
- LOG4CXX_ERROR(logger_, "Wrong resumption data");
- return false;
- }
-
- if (json_app.isMember(strings::hmi_app_id) &&
- 0 >= json_app[strings::hmi_app_id].asUInt()) {
- LOG4CXX_ERROR(logger_, "Wrong resumption hmi app ID");
- return false;
- }
-
- return true;
-}
-
-uint32_t ResumeCtrl::SendHMIRequest(
- const hmi_apis::FunctionID::eType& function_id,
- const smart_objects::SmartObject* msg_params, bool use_events) {
- LOG4CXX_AUTO_TRACE(logger_);
- smart_objects::SmartObjectSPtr result =
- MessageHelper::CreateModuleInfoSO(function_id);
- uint32_t hmi_correlation_id =
- (*result)[strings::params][strings::correlation_id].asUInt();
- if (use_events) {
- subscribe_on_event(function_id, hmi_correlation_id);
- }
-
- if (msg_params) {
- (*result)[strings::msg_params] = *msg_params;
- }
-
- if (!ApplicationManagerImpl::instance()->ManageHMICommand(result)) {
- LOG4CXX_ERROR(logger_, "Unable to send request");
- }
- return hmi_correlation_id;
-}
-
-} // namespace application_manager
diff --git a/src/components/application_manager/src/resumption/resume_ctrl.cc b/src/components/application_manager/src/resumption/resume_ctrl.cc
new file mode 100644
index 0000000000..7bec944d44
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resume_ctrl.cc
@@ -0,0 +1,776 @@
+/*
+ Copyright (c) 2015, Ford Motor Company
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ Redistributions of source code must retain the above copyright notice, this
+ list of conditions and the following disclaimer.
+
+ Redistributions in binary form must reproduce the above copyright notice,
+ this list of conditions and the following
+ disclaimer in the documentation and/or other materials provided with the
+ distribution.
+
+ Neither the name of the Ford Motor Company nor the names of its contributors
+ may be used to endorse or promote products derived from this software
+ without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "application_manager/resumption/resume_ctrl.h"
+
+#include <fstream>
+#include <algorithm>
+
+#include "application_manager/application_manager_impl.h"
+
+#include "config_profile/profile.h"
+#include "utils/file_system.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "application_manager/message_helper.h"
+#include "connection_handler/connection.h"
+#include "application_manager/commands/command_impl.h"
+#include "resumption/last_state.h"
+#include "policy/policy_manager_impl.h"
+#include "application_manager/policies/policy_handler.h"
+#include "utils/helpers.h"
+#include "application_manager/resumption/resumption_data_db.h"
+#include "application_manager/resumption/resumption_data_json.h"
+#include "utils/make_shared.h"
+#include "utils/timer_task_impl.h"
+
+namespace resumption {
+using namespace application_manager;
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumeCtrl::ResumeCtrl()
+ : queue_lock_(false),
+ restore_hmi_level_timer_(
+ "RsmCtrlRstore", new timer::TimerTaskImpl<ResumeCtrl>(
+ this, &ResumeCtrl::ApplicationResumptiOnTimer)),
+ save_persistent_data_timer_(
+ "RsmCtrlPercist",
+ new timer::TimerTaskImpl<ResumeCtrl>(this, &ResumeCtrl::SaveDataOnTimer)),
+ is_resumption_active_(false),
+ is_data_saved_(false),
+ launch_time_(time(NULL)) {}
+
+bool ResumeCtrl::Init() {
+ using namespace profile;
+ bool use_db = Profile::instance()->use_db_for_resumption();
+ if (use_db) {
+ resumption_storage_.reset(new ResumptionDataDB());
+ if (!resumption_storage_->Init()) {
+ return false;
+ }
+
+ ResumptionDataDB* db =
+ dynamic_cast<ResumptionDataDB*>(resumption_storage_.get());
+
+ if (!db->IsDBVersionActual()) {
+ LOG4CXX_INFO(logger_,
+ "DB version had been changed. "
+ "Rebuilding resumption DB.");
+
+ smart_objects::SmartObject data;
+ db->GetAllData(data);
+
+ if (!db->RefreshDB()) {
+ return false;
+ }
+
+ db->SaveAllData(data);
+ db->UpdateDBVersion();
+ }
+ } else {
+ resumption_storage_.reset(new ResumptionDataJson());
+ }
+ LoadResumeData();
+ save_persistent_data_timer_.Start(
+ profile::Profile::instance()
+ ->app_resumption_save_persistent_data_timeout(),
+ true);
+ return true;
+}
+
+ResumeCtrl::~ResumeCtrl() {}
+
+void ResumeCtrl::SaveAllApplications() {
+ ApplicationManagerImpl::ApplicationListAccessor accessor;
+ std::for_each(accessor.GetData().begin(),
+ accessor.GetData().end(),
+ std::bind1st(std::mem_fun(&ResumeCtrl::SaveApplication), this));
+}
+
+void ResumeCtrl::SaveApplication(ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(application);
+ LOG4CXX_INFO(logger_,
+ "application with appID " << application->app_id()
+ << " will be saved");
+ resumption_storage_->SaveApplication(application);
+}
+
+void ResumeCtrl::on_event(const event_engine::Event& event) {
+ LOG4CXX_DEBUG(logger_, "Event received" << event.id());
+}
+
+bool ResumeCtrl::RestoreAppHMIState(ApplicationSharedPtr application) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ LOG4CXX_DEBUG(logger_,
+ "app_id : " << application->app_id() << "; policy_app_id : "
+ << application->mobile_app_id());
+ const std::string& device_mac = application->mac_address();
+ smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(), device_mac, saved_app);
+ if (result) {
+ DCHECK_OR_RETURN(application, false);
+ if (saved_app.keyExists(strings::hmi_level)) {
+ const HMILevel::eType saved_hmi_level =
+ static_cast<mobile_apis::HMILevel::eType>(
+ saved_app[strings::hmi_level].asInt());
+ LOG4CXX_DEBUG(logger_, "Saved HMI Level is : " << saved_hmi_level);
+ return SetAppHMIState(application, saved_hmi_level, true);
+ } else {
+ result = false;
+ LOG4CXX_ERROR(logger_, "saved app data corrupted");
+ }
+ } else {
+ LOG4CXX_ERROR(logger_, "Application not saved");
+ }
+ return result;
+}
+
+bool ResumeCtrl::SetupDefaultHMILevel(ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ mobile_apis::HMILevel::eType default_hmi =
+ ApplicationManagerImpl::instance()->GetDefaultHmiLevel(application);
+ return SetAppHMIState(application, default_hmi, false);
+}
+
+void ResumeCtrl::ApplicationResumptiOnTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(queue_lock_);
+ WaitingForTimerList::iterator it = waiting_for_timer_.begin();
+
+ for (; it != waiting_for_timer_.end(); ++it) {
+ ApplicationSharedPtr app =
+ ApplicationManagerImpl::instance()->application(*it);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Invalid app_id = " << *it);
+ continue;
+ }
+ StartAppHmiStateResumption(app);
+ }
+ is_resumption_active_ = false;
+ waiting_for_timer_.clear();
+ StartSavePersistentDataTimer();
+}
+
+void ResumeCtrl::OnAppActivated(ApplicationSharedPtr application) {
+ if (is_resumption_active_) {
+ RemoveFromResumption(application->app_id());
+ }
+}
+
+void ResumeCtrl::RemoveFromResumption(uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ queue_lock_.Acquire();
+ waiting_for_timer_.remove(app_id);
+ queue_lock_.Release();
+}
+
+bool ResumeCtrl::SetAppHMIState(ApplicationSharedPtr application,
+ const mobile_apis::HMILevel::eType hmi_level,
+ bool check_policy) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ LOG4CXX_TRACE(
+ logger_,
+ " app_id : " << application->app_id() << ", hmi_level : " << hmi_level
+ << ", check_policy : "
+ << check_policy);
+ const std::string& device_mac = application->mac_address();
+ if (check_policy &&
+ policy::PolicyHandler::instance()->GetUserConsentForDevice(device_mac) !=
+ policy::DeviceConsent::kDeviceAllowed) {
+ LOG4CXX_ERROR(logger_, "Resumption abort. Data consent wasn't allowed");
+ SetupDefaultHMILevel(application);
+ return false;
+ }
+ application->set_is_resuming(true);
+ ApplicationManagerImpl::instance()->SetHmiState(application->app_id(),
+ hmi_level);
+ LOG4CXX_INFO(logger_,
+ "Application with policy id " << application->mobile_app_id()
+ << " got HMI level "
+ << hmi_level);
+ return true;
+}
+
+bool ResumeCtrl::IsHMIApplicationIdExist(uint32_t hmi_app_id) {
+ LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
+ return resumption_storage_->IsHMIApplicationIdExist(hmi_app_id);
+}
+
+bool ResumeCtrl::IsApplicationSaved(const std::string& policy_app_id,
+ const std::string& device_id) {
+ return -1 !=
+ resumption_storage_->IsApplicationSaved(policy_app_id, device_id);
+}
+
+uint32_t ResumeCtrl::GetHMIApplicationID(const std::string& policy_app_id,
+ const std::string& device_mac) const {
+ return resumption_storage_->GetHMIApplicationID(policy_app_id, device_mac);
+}
+
+bool ResumeCtrl::RemoveApplicationFromSaved(
+ ApplicationConstSharedPtr application) {
+ const std::string device_mac = application->mac_address();
+ return resumption_storage_->RemoveApplicationFromSaved(
+ application->mobile_app_id(), device_mac);
+}
+
+void ResumeCtrl::OnSuspend() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StopSavePersistentDataTimer();
+ SaveAllApplications();
+ return resumption_storage_->OnSuspend();
+}
+
+void ResumeCtrl::OnAwake() {
+ return resumption_storage_->OnAwake();
+ ResetLaunchTime();
+ StartSavePersistentDataTimer();
+}
+
+void ResumeCtrl::StartSavePersistentDataTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!save_persistent_data_timer_.IsRunning()) {
+ save_persistent_data_timer_.Start(
+ profile::Profile::instance()
+ ->app_resumption_save_persistent_data_timeout(),
+ true);
+ }
+}
+
+void ResumeCtrl::StopSavePersistentDataTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (save_persistent_data_timer_.IsRunning()) {
+ save_persistent_data_timer_.Stop();
+ }
+}
+
+bool ResumeCtrl::StartResumption(ApplicationSharedPtr application,
+ const std::string& hash) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ LOG4CXX_DEBUG(logger_,
+ " Resume app_id = " << application->app_id() << " hmi_app_id = "
+ << application->hmi_app_id()
+ << " policy_id = "
+ << application->mobile_app_id()
+ << " received hash = "
+ << hash);
+ SetupDefaultHMILevel(application);
+ smart_objects::SmartObject saved_app;
+ const std::string& device_mac = application->mac_address();
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(),
+ device_mac,
+ saved_app);
+ if (result) {
+ const std::string& saved_hash = saved_app[strings::hash_id].asString();
+ result = saved_hash == hash ? RestoreApplicationData(application) : false;
+ application->UpdateHash();
+ AddToResumptionTimerQueue(application->app_id());
+ }
+ return result;
+}
+
+bool ResumeCtrl::StartResumptionOnlyHMILevel(ApplicationSharedPtr application) {
+ // sync_primitives::AutoLock lock(resumtion_lock_);
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!application) {
+ LOG4CXX_WARN(logger_, "Application does not exist.");
+ return false;
+ }
+ LOG4CXX_DEBUG(logger_,
+ "HMI level resumption requested for application id "
+ << application->app_id()
+ << "with hmi_app_id "
+ << application->hmi_app_id()
+ << ", policy_app_id "
+ << application->mobile_app_id());
+ SetupDefaultHMILevel(application);
+ const std::string& device_mac = application->mac_address();
+ smart_objects::SmartObject saved_app;
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(),
+ device_mac,
+ saved_app);
+ if (result) {
+ // sync_primitives::AutoUnlock unlock(lock);
+ AddToResumptionTimerQueue(application->app_id());
+ }
+ LOG4CXX_INFO(logger_, "StartResumptionOnlyHMILevel::Result = " << result);
+ return result;
+}
+
+void ResumeCtrl::StartAppHmiStateResumption(ApplicationSharedPtr application) {
+ using namespace profile;
+ using namespace date_time;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(application);
+ smart_objects::SmartObject saved_app;
+ const std::string& device_mac = application->mac_address();
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(),
+ device_mac,
+ saved_app);
+ DCHECK_OR_RETURN_VOID(result);
+ const uint32_t ign_off_count = saved_app[strings::ign_off_count].asUInt();
+ bool restore_data_allowed = false;
+ restore_data_allowed =
+ CheckAppRestrictions(application, saved_app) &&
+ ((0 == ign_off_count) || CheckIgnCycleRestrictions(saved_app));
+ if (restore_data_allowed) {
+ LOG4CXX_INFO(logger_,
+ "Resume application " << application->mobile_app_id());
+ RestoreAppHMIState(application);
+ RemoveApplicationFromSaved(application);
+ } else {
+ LOG4CXX_INFO(logger_,
+ "Do not need to resume application "
+ << application->mobile_app_id());
+ }
+}
+
+void ResumeCtrl::ResetLaunchTime() {
+ launch_time_ = time(NULL);
+}
+
+bool ResumeCtrl::CheckPersistenceFilesForResumption(
+ ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ LOG4CXX_DEBUG(logger_,
+ " Resume app_id = " << application->app_id() << " policy_id = "
+ << application->mobile_app_id());
+ smart_objects::SmartObject saved_app;
+ const std::string& device_mac = application->mac_address();
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(),
+ device_mac,
+ saved_app);
+ if (result) {
+ if (!CheckIcons(application, saved_app[strings::application_commands])) {
+ return false;
+ }
+ if (!CheckIcons(application, saved_app[strings::application_choice_sets])) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ResumeCtrl::CheckApplicationHash(ApplicationSharedPtr application,
+ const std::string& hash) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ LOG4CXX_DEBUG(logger_,
+ "app_id : " << application->app_id() << " hash : " << hash);
+ smart_objects::SmartObject saved_app;
+ const std::string& device_mac = application->mac_address();
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(),
+ device_mac,
+ saved_app);
+ return result ? saved_app[strings::hash_id].asString() == hash : false;
+}
+
+void ResumeCtrl::SaveDataOnTimer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (is_resumption_active_) {
+ LOG4CXX_WARN(logger_, "Resumption timer is active skip saving");
+ return;
+ }
+
+ if (false == is_data_saved_) {
+ SaveAllApplications();
+ is_data_saved_ = true;
+ if (!(profile::Profile::instance()->use_db_for_resumption())) {
+ resumption::LastState::instance()->SaveToFileSystem();
+ }
+ }
+}
+
+bool ResumeCtrl::IsDeviceMacAddressEqual(ApplicationSharedPtr application,
+ const std::string& saved_device_mac) {
+ const std::string device_mac = application->mac_address();
+ return device_mac == saved_device_mac;
+}
+
+bool ResumeCtrl::RestoreApplicationData(ApplicationSharedPtr application) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(application, false);
+ LOG4CXX_DEBUG(logger_, "app_id : " << application->app_id());
+
+ smart_objects::SmartObject saved_app(smart_objects::SmartType_Map);
+ const std::string& device_mac = application->mac_address();
+ bool result = resumption_storage_->GetSavedApplication(
+ application->mobile_app_id(),
+ device_mac,
+ saved_app);
+ if (result) {
+ if (saved_app.keyExists(strings::grammar_id)) {
+ const uint32_t app_grammar_id = saved_app[strings::grammar_id].asUInt();
+ application->set_grammar_id(app_grammar_id);
+ AddFiles(application, saved_app);
+ AddSubmenues(application, saved_app);
+ AddCommands(application, saved_app);
+ AddChoicesets(application, saved_app);
+ SetGlobalProperties(application, saved_app);
+ AddSubscriptions(application, saved_app);
+ result = true;
+ } else {
+ LOG4CXX_WARN(logger_,
+ "Saved data of application does not contain grammar_id");
+ result = false;
+ }
+ } else {
+ LOG4CXX_WARN(logger_, "Application not saved");
+ }
+ return result;
+}
+
+void ResumeCtrl::AddFiles(ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (saved_app.keyExists(strings::application_files)) {
+ const smart_objects::SmartObject& application_files =
+ saved_app[strings::application_files];
+ for (size_t i = 0; i < application_files.length(); ++i) {
+ const smart_objects::SmartObject& file_data = application_files[i];
+ const bool is_persistent =
+ file_data.keyExists(strings::persistent_file) &&
+ file_data[strings::persistent_file].asBool();
+ if (is_persistent) {
+ AppFile file;
+ file.is_persistent = is_persistent;
+ file.is_download_complete =
+ file_data[strings::is_download_complete].asBool();
+ file.file_name = file_data[strings::sync_file_name].asString();
+ file.file_type = static_cast<mobile_apis::FileType::eType>(
+ file_data[strings::file_type].asInt());
+ application->AddFile(file);
+ }
+ }
+ } else {
+ LOG4CXX_FATAL(logger_, "application_files section is not exists");
+ }
+}
+
+void ResumeCtrl::AddSubmenues(ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (saved_app.keyExists(strings::application_submenus)) {
+ const smart_objects::SmartObject& app_submenus =
+ saved_app[strings::application_submenus];
+ for (size_t i = 0; i < app_submenus.length(); ++i) {
+ const smart_objects::SmartObject& submenu = app_submenus[i];
+ application->AddSubMenu(submenu[strings::menu_id].asUInt(), submenu);
+ }
+ ProcessHMIRequests(
+ MessageHelper::CreateAddSubMenuRequestToHMI(application));
+ } else {
+ LOG4CXX_FATAL(logger_, "application_submenus section is not exists");
+ }
+}
+
+void ResumeCtrl::AddCommands(ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (saved_app.keyExists(strings::application_commands)) {
+ const smart_objects::SmartObject& app_commands =
+ saved_app[strings::application_commands];
+ for (size_t i = 0; i < app_commands.length(); ++i) {
+ const smart_objects::SmartObject& command = app_commands[i];
+
+ application->AddCommand(command[strings::cmd_id].asUInt(), command);
+ }
+ ProcessHMIRequests(
+ MessageHelper::CreateAddCommandRequestToHMI(application));
+ } else {
+ LOG4CXX_FATAL(logger_, "application_commands section is not exists");
+ }
+}
+
+void ResumeCtrl::AddChoicesets(ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (saved_app.keyExists(strings::application_choice_sets)) {
+ const smart_objects::SmartObject& app_choice_sets =
+ saved_app[strings::application_choice_sets];
+ for (size_t i = 0; i < app_choice_sets.length(); ++i) {
+ const smart_objects::SmartObject& choice_set = app_choice_sets[i];
+ const int32_t choice_set_id =
+ choice_set[strings::interaction_choice_set_id].asInt();
+ application->AddChoiceSet(choice_set_id, choice_set);
+ }
+ ProcessHMIRequests(
+ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(application));
+ } else {
+ LOG4CXX_FATAL(logger_, "There is no any choicesets");
+ }
+}
+
+void ResumeCtrl::SetGlobalProperties(
+ ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (saved_app.keyExists(strings::application_global_properties)) {
+ const smart_objects::SmartObject& properties_so =
+ saved_app[strings::application_global_properties];
+ application->load_global_properties(properties_so);
+ MessageHelper::SendGlobalPropertiesToHMI(application);
+ }
+}
+
+void ResumeCtrl::AddSubscriptions(ApplicationSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (saved_app.keyExists(strings::application_subscribtions)) {
+ const smart_objects::SmartObject& subscribtions =
+ saved_app[strings::application_subscribtions];
+
+ if (subscribtions.keyExists(strings::application_buttons)) {
+ const smart_objects::SmartObject& subscribtions_buttons =
+ subscribtions[strings::application_buttons];
+ mobile_apis::ButtonName::eType btn;
+ for (size_t i = 0; i < subscribtions_buttons.length(); ++i) {
+ btn = static_cast<mobile_apis::ButtonName::eType>(
+ (subscribtions_buttons[i]).asInt());
+ application->SubscribeToButton(btn);
+ }
+ }
+ MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(application);
+
+ if (subscribtions.keyExists(strings::application_vehicle_info)) {
+ const smart_objects::SmartObject& subscribtions_ivi =
+ subscribtions[strings::application_vehicle_info];
+ VehicleDataType ivi;
+ for (size_t i = 0; i < subscribtions_ivi.length(); ++i) {
+ ivi = static_cast<VehicleDataType>((subscribtions_ivi[i]).asInt());
+ application->SubscribeToIVI(ivi);
+ }
+ }
+ ProcessHMIRequests(MessageHelper::GetIVISubscriptionRequests(application));
+ }
+}
+
+bool ResumeCtrl::CheckIgnCycleRestrictions(
+ const smart_objects::SmartObject& saved_app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool result = true;
+
+ if (!CheckDelayAfterIgnOn()) {
+ LOG4CXX_INFO(logger_, "Application was connected long after ign on");
+ result = false;
+ }
+
+ if (!DisconnectedJustBeforeIgnOff(saved_app)) {
+ LOG4CXX_INFO(logger_, "Application was dissconnected long before ign off");
+ result = false;
+ }
+ return result;
+}
+
+bool ResumeCtrl::DisconnectedJustBeforeIgnOff(
+ const smart_objects::SmartObject& saved_app) {
+ using namespace date_time;
+ using namespace profile;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(saved_app.keyExists(strings::time_stamp), false);
+
+ const time_t time_stamp =
+ static_cast<time_t>(saved_app[strings::time_stamp].asUInt());
+ time_t ign_off_time =
+ static_cast<time_t>(resumption_storage_->GetIgnOffTime());
+ const uint32_t sec_spent_before_ign = labs(ign_off_time - time_stamp);
+ LOG4CXX_DEBUG(
+ logger_,
+ "ign_off_time " << ign_off_time << "; app_disconnect_time " << time_stamp
+ << "; sec_spent_before_ign "
+ << sec_spent_before_ign
+ << "; resumption_delay_before_ign "
+ << Profile::instance()->resumption_delay_before_ign());
+ return sec_spent_before_ign <=
+ Profile::instance()->resumption_delay_before_ign();
+}
+
+bool ResumeCtrl::CheckAppRestrictions(
+ ApplicationConstSharedPtr application,
+ const smart_objects::SmartObject& saved_app) {
+ using namespace mobile_apis;
+ using namespace helpers;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(saved_app.keyExists(strings::hmi_level), false);
+
+ const bool is_media_app = application->is_media_application();
+ const HMILevel::eType hmi_level =
+ static_cast<HMILevel::eType>(saved_app[strings::hmi_level].asInt());
+ const bool result = Compare<HMILevel::eType, EQ, ONE>(
+ hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)
+ ? true
+ : false;
+ LOG4CXX_DEBUG(logger_,
+ "is_media_app " << is_media_app << "; hmi_level " << hmi_level
+ << " result "
+ << result);
+ return result;
+}
+
+bool ResumeCtrl::CheckIcons(ApplicationSharedPtr application,
+ smart_objects::SmartObject& obj) {
+ using namespace smart_objects;
+ LOG4CXX_AUTO_TRACE(logger_);
+ const mobile_apis::Result::eType verify_images =
+ MessageHelper::VerifyImageFiles(obj, application);
+ return mobile_apis::Result::INVALID_DATA != verify_images;
+}
+
+bool ResumeCtrl::CheckDelayAfterIgnOn() {
+ using namespace date_time;
+ using namespace profile;
+ LOG4CXX_AUTO_TRACE(logger_);
+ const time_t curr_time = time(NULL);
+ const time_t sdl_launch_time = launch_time();
+ const uint32_t seconds_from_sdl_start = labs(curr_time - sdl_launch_time);
+ const uint32_t wait_time = Profile::instance()->resumption_delay_after_ign();
+ LOG4CXX_DEBUG(logger_,
+ "curr_time " << curr_time << "; sdl_launch_time "
+ << sdl_launch_time
+ << "; seconds_from_sdl_start "
+ << seconds_from_sdl_start
+ << "; wait_time "
+ << wait_time);
+ return seconds_from_sdl_start <= wait_time;
+}
+
+time_t ResumeCtrl::launch_time() const {
+ return launch_time_;
+}
+
+time_t ResumeCtrl::GetIgnOffTime() {
+ return resumption_storage_->GetIgnOffTime();
+}
+
+bool ResumeCtrl::ProcessHMIRequest(smart_objects::SmartObjectSPtr request,
+ bool use_events) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (use_events) {
+ const hmi_apis::FunctionID::eType function_id =
+ static_cast<hmi_apis::FunctionID::eType>(
+ (*request)[strings::function_id].asInt());
+
+ const int32_t hmi_correlation_id =
+ (*request)[strings::correlation_id].asInt();
+ subscribe_on_event(function_id, hmi_correlation_id);
+ }
+ if (!ApplicationManagerImpl::instance()->ManageHMICommand(request)) {
+ LOG4CXX_ERROR(logger_, "Unable to send request");
+ return false;
+ }
+ return true;
+}
+
+void ResumeCtrl::ProcessHMIRequests(
+ const smart_objects::SmartObjectList& requests) {
+ for (smart_objects::SmartObjectList::const_iterator it = requests.begin(),
+ total = requests.end();
+ it != total;
+ ++it) {
+ ProcessHMIRequest(*it, true);
+ }
+}
+
+void ResumeCtrl::AddToResumptionTimerQueue(uint32_t app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ queue_lock_.Acquire();
+ waiting_for_timer_.push_back(app_id);
+ queue_lock_.Release();
+ if (!is_resumption_active_) {
+ is_resumption_active_ = true;
+ restore_hmi_level_timer_.Start(
+ profile::Profile::instance()->app_resuming_timeout(), false);
+ }
+}
+
+void ResumeCtrl::LoadResumeData() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject so_applications_data;
+ resumption_storage_->GetDataForLoadResumeData(so_applications_data);
+ size_t length = so_applications_data.length();
+ for (size_t i = 0; i < length; ++i) {
+ smart_objects::SmartObject& application = so_applications_data[i];
+ if (IsAppDataResumptionExpired(application)) {
+ const std::string device_id = application[strings::device_id].asString();
+ const std::string app_id = application[strings::app_id].asString();
+ LOG4CXX_INFO(logger_, "Data resumption is expired.");
+ LOG4CXX_DEBUG(logger_, "Resumption data for application " << app_id
+ << " and device id " << device_id
+ << " will be dropped.");
+ resumption_storage_->DropAppDataResumption(device_id, app_id);
+ continue;
+ }
+ }
+}
+
+void ResumeCtrl::OnAppRegistrationStart(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (IsApplicationSaved(policy_app_id, device_id)) {
+ LOG4CXX_INFO(logger_, "Application is found in resumption "
+ "data and will try to resume. Stopping resume data persistent timer");
+ StopSavePersistentDataTimer();
+ }
+}
+
+void ResumeCtrl::OnAppRegistrationEnd() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ StartSavePersistentDataTimer();
+}
+
+bool ResumeCtrl::IsAppDataResumptionExpired(
+ const smart_objects::SmartObject& application) const {
+ const int32_t max_ign_off_count = 3;
+ return max_ign_off_count <= application[strings::ign_off_count].asInt();
+}
+
+
+
+} // namespce resumption
diff --git a/src/components/application_manager/src/resumption/resumption_data.cc b/src/components/application_manager/src/resumption/resumption_data.cc
new file mode 100644
index 0000000000..dfa19550c2
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data.cc
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/resumption/resumption_data.h"
+#include "utils/logger.h"
+#include "application_manager/smart_object_keys.h"
+#include "application_manager/vehicle_info_data.h"
+
+namespace resumption {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumptionData::ResumptionData():
+ resumption_lock_(true) {
+}
+
+bool ResumptionData::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return true;
+}
+
+smart_objects::SmartObject ResumptionData::GetApplicationCommands(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject commands_array(smart_objects::SmartType_Array);
+ DCHECK_OR_RETURN(application, commands_array);
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return commands_array;
+ }
+ const DataAccessor<CommandsMap> accessor = application->commands_map();
+ const CommandsMap& commands = accessor.GetData();
+ CommandsMap::const_iterator it = commands.begin();
+ for (int i = 0; it != commands.end(); ++it, ++i) {
+ commands_array[i] = *(it->second);
+ }
+ return commands_array;
+}
+
+smart_objects::SmartObject ResumptionData::GetApplicationSubMenus(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK(application.get());
+ smart_objects::SmartObject submenues_array = smart_objects::SmartObject(
+ smart_objects::SmartType_Array);
+
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return submenues_array;
+ }
+ const DataAccessor<SubMenuMap> accessor = application->sub_menu_map();
+ const SubMenuMap& sub_menus = accessor.GetData();
+ SubMenuMap::const_iterator it = sub_menus.begin();
+ for (int i = 0;it != sub_menus.end(); ++it, ++i) {
+ submenues_array[i] = *(it->second);
+ }
+ return submenues_array;
+}
+
+smart_objects::SmartObject ResumptionData::GetApplicationInteractionChoiseSets(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK(application.get());
+ smart_objects::SmartObject interaction_choice_set_array =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return interaction_choice_set_array;
+ }
+ const DataAccessor<ChoiceSetMap> accessor = application->choice_set_map();
+ const ChoiceSetMap& choices = accessor.GetData();
+ ChoiceSetMap::const_iterator it = choices.begin();
+ for (int i = 0; it != choices.end(); ++it, ++i) {
+ interaction_choice_set_array[i] = *(it->second);
+ }
+ return interaction_choice_set_array;
+}
+
+smart_objects::SmartObject ResumptionData::GetApplicationGlobalProperties(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK(application.get());
+ smart_objects::SmartObject global_properties =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return global_properties;
+ }
+
+ global_properties[strings::help_prompt] =
+ PointerToSmartObj(application->help_prompt());
+ global_properties[strings::timeout_prompt] =
+ PointerToSmartObj(application->timeout_prompt());
+ global_properties[strings::vr_help] =
+ PointerToSmartObj(application->vr_help());
+ global_properties[strings::vr_help_title] =
+ PointerToSmartObj(application->vr_help_title());
+ global_properties[strings::vr_synonyms] =
+ PointerToSmartObj(application->vr_synonyms());
+ global_properties[strings::keyboard_properties] =
+ PointerToSmartObj(application->keyboard_props());
+ global_properties[strings::menu_title] =
+ PointerToSmartObj(application->menu_title());
+ global_properties[strings::menu_icon] =
+ PointerToSmartObj(application->menu_icon());
+ return global_properties;
+}
+
+smart_objects::SmartObject ResumptionData::GetApplicationSubscriptions(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(application.get());
+ smart_objects::SmartObject subscriptions =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return subscriptions;
+ }
+ LOG4CXX_DEBUG(logger_, "app_id:" << application->app_id());
+
+ DataAccessor<ButtonSubscriptions> button_accessor =
+ application->SubscribedButtons();
+
+ const ButtonSubscriptions& button_subscriptions = button_accessor.GetData();
+
+ LOG4CXX_DEBUG(logger_, "SubscribedButtons:" << button_subscriptions.size());
+ Append(button_subscriptions.begin(), button_subscriptions.end(),
+ strings::application_buttons, subscriptions);
+
+ DataAccessor<VehicleInfoSubscriptions> vi_accessor =
+ application->SubscribedIVI();
+
+ const VehicleInfoSubscriptions& vi_subscription = vi_accessor.GetData();
+
+ LOG4CXX_DEBUG(logger_, "SubscribedIVI:" << vi_subscription.size());
+ Append(vi_subscription.begin(), vi_subscription.end(),
+ strings::application_vehicle_info, subscriptions);
+ return subscriptions;
+}
+
+smart_objects::SmartObject ResumptionData::GetApplicationFiles(
+ app_mngr::ApplicationConstSharedPtr application) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(application.get());
+ LOG4CXX_TRACE(logger_, "ENTER app_id:"
+ << application->app_id());
+
+ smart_objects::SmartObject files =
+ smart_objects::SmartObject(smart_objects::SmartType_Array);
+ if (!application) {
+ LOG4CXX_ERROR(logger_, "NULL Pointer App");
+ return files;
+ }
+
+ const AppFilesMap& app_files = application->getAppFiles();
+ int i = 0;
+ for(AppFilesMap::const_iterator file_it = app_files.begin();
+ file_it != app_files.end(); file_it++) {
+ const AppFile& file = file_it->second;
+ if (file.is_persistent) {
+ smart_objects::SmartObject file_data =
+ smart_objects::SmartObject(smart_objects::SmartType_Map);
+ file_data[strings::persistent_file] = file.is_persistent;
+ file_data[strings::is_download_complete] = file.is_download_complete;
+ file_data[strings::sync_file_name] = file.file_name;
+ file_data[strings::file_type] = file.file_type;
+ files[i++] = file_data;
+ }
+ }
+ return files;
+}
+
+smart_objects::SmartObject ResumptionData::PointerToSmartObj(
+ const smart_objects::SmartObject* ptr) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObject temp;
+ if (ptr != NULL) {
+ temp = *ptr;
+ }
+ return temp;
+}
+} // 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
new file mode 100644
index 0000000000..5f11dca2a0
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data_db.cc
@@ -0,0 +1,2838 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <string>
+#include <unistd.h>
+
+#include "application_manager/resumption/resumption_data_db.h"
+#include "application_manager/resumption/resumption_sql_queries.h"
+#include "application_manager/smart_object_keys.h"
+#include "config_profile/profile.h"
+#include "application_manager/message_helper.h"
+#include "utils/helpers.h"
+#include "utils/gen_hash.h"
+#include "utils/scope_guard.h"
+
+namespace {
+const std::string kDatabaseName = "resumption";
+}
+
+namespace resumption {
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumptionDataDB::ResumptionDataDB()
+ : db_(new utils::dbms::SQLDatabase(kDatabaseName)) {
+#ifndef __QNX__
+ std::string path = profile::Profile::instance()->app_storage_folder();
+ if (!path.empty()) {
+ db_->set_path(path + "/");
+ }
+#endif // __QNX__
+}
+
+ResumptionDataDB::~ResumptionDataDB() {
+ db_->Close();
+ delete db_;
+}
+
+bool ResumptionDataDB::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!db_->Open()) {
+ LOG4CXX_ERROR(logger_, "Failed opening database.");
+ LOG4CXX_INFO(logger_, "Starting opening retries.");
+ const uint16_t attempts =
+ profile::Profile::instance()->attempts_to_open_resumption_db();
+ LOG4CXX_DEBUG(logger_, "Total attempts number is: " << attempts);
+ bool is_opened = false;
+ const uint16_t open_attempt_timeout_ms =
+ profile::Profile::instance()->open_attempt_timeout_ms_resumption_db();
+ const useconds_t sleep_interval_mcsec = open_attempt_timeout_ms * 1000;
+ LOG4CXX_DEBUG(logger_,
+ "Open attempt timeout(ms) is: " << open_attempt_timeout_ms);
+ for (int i = 0; i < attempts; ++i) {
+ usleep(sleep_interval_mcsec);
+ LOG4CXX_INFO(logger_, "Attempt: " << i + 1);
+ if (db_->Open()) {
+ LOG4CXX_INFO(logger_, "Database opened.");
+ is_opened = true;
+ break;
+ }
+ }
+ if (!is_opened) {
+ LOG4CXX_ERROR(logger_,
+ "Open retry sequence failed. Tried "
+ << attempts
+ << " attempts with "
+ << open_attempt_timeout_ms
+ << " open timeout(ms) for each.");
+ return false;
+ }
+ }
+#ifndef __QNX__
+ if (!db_->IsReadWrite()) {
+ LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
+ return false;
+ }
+#endif // __QNX__
+ utils::dbms::SQLQuery query(db());
+ if (!query.Exec(kCreateSchema)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed creating schema of database: " << query.LastError().text());
+ return false;
+ }
+ utils::dbms::SQLQuery query_checks_resumption(db());
+ if (!query_checks_resumption.Prepare(kChecksResumptionData) ||
+ !query_checks_resumption.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed verification or execution query kChecksResumptionData"
+ << query_checks_resumption.LastError().text());
+ return false;
+ }
+ if (0 == query_checks_resumption.GetInteger(0)) {
+ utils::dbms::SQLQuery query_insert_resumption(db());
+ if (!query_insert_resumption.Prepare(kInsertInitData) ||
+ !query_insert_resumption.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed insert init data to database: "
+ << query_insert_resumption.LastError().text());
+ return false;
+ }
+ }
+ return true;
+}
+
+void ResumptionDataDB::SaveApplication(
+ app_mngr::ApplicationSharedPtr application) {
+ using namespace app_mngr;
+ using namespace mobile_api;
+ using namespace helpers;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(application);
+ bool application_exist = false;
+ const std::string& policy_app_id = application->mobile_app_id();
+ const std::string& device_mac = application->mac_address();
+ LOG4CXX_INFO(logger_,
+ "app_id : " << application->app_id() << " policy_app_id : "
+ << policy_app_id
+ << " device_id : "
+ << device_mac);
+
+ if (!CheckExistenceApplication(policy_app_id, device_mac, application_exist)) {
+ LOG4CXX_ERROR(logger_, "Problem with access to DB");
+ return;
+ }
+
+ if (application->is_application_data_changed()) {
+ if (application_exist) {
+ if (!DeleteSavedApplication(policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Deleting of application data is not finished");
+ return;
+ }
+ }
+
+ if (!SaveApplicationToDB(application, policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Saving of application data is not finished");
+ return;
+ }
+ LOG4CXX_INFO(logger_, "All data from application were saved successfully");
+ application->set_is_application_data_changed(false);
+ } else {
+ if (application_exist) {
+ if (!UpdateApplicationData(application, policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Updating application data is failed");
+ return;
+ }
+ LOG4CXX_INFO(logger_, "Application data were updated successfully");
+ } else {
+ if (Compare<HMILevel::eType, EQ, ONE>(application->hmi_level(),
+ HMILevel::HMI_FULL,
+ HMILevel::HMI_LIMITED)) {
+ if (!InsertApplicationData(application, policy_app_id, device_mac)) {
+ LOG4CXX_ERROR(logger_, "Saving data of application is failed");
+ return;
+ }
+ }
+ }
+ }
+ WriteDb();
+}
+
+int32_t ResumptionDataDB::GetStoredHMILevel(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ int hmi_level;
+ if (SelectHMILevel(policy_app_id, device_id, hmi_level)) {
+ LOG4CXX_INFO(
+ logger_,
+ "Application with policy application id = " << policy_app_id
+ << " and device id = "
+ << device_id
+ << "has hmi level = "
+ << hmi_level);
+ return hmi_level;
+ }
+ LOG4CXX_FATAL(logger_, "HMI level doesn't exists in saved data");
+ return -1;
+}
+
+bool ResumptionDataDB::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ return CheckExistenceHMIId(hmi_app_id);
+}
+
+bool ResumptionDataDB::CheckSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool application_exist = false;
+ if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) ||
+ !application_exist) {
+ LOG4CXX_WARN(logger_,
+ "Problem with access to DB or application does not exist");
+ return false;
+ }
+ LOG4CXX_INFO(logger_,
+ "Application with policy_app_id = " << policy_app_id
+ << " and device_id = "
+ << device_id
+ << " does exist");
+ return true;
+}
+
+uint32_t ResumptionDataDB::GetHMIApplicationID(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ uint32_t hmi_app_id = 0;
+ SelectHMIId(policy_app_id, device_id, hmi_app_id);
+ return hmi_app_id;
+}
+
+void ResumptionDataDB::OnSuspend() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::dbms::SQLQuery query_update_suspend_data(db());
+ utils::dbms::SQLQuery query_update_last_ign_off_time(db());
+ /*
+ application_lifes - contains amount of ignition cycles during which
+ db stores data of application
+ */
+ const int application_lifes = 3;
+
+ if (DeleteAppWithIgnCount(application_lifes)) {
+ LOG4CXX_INFO(logger_,
+ "Saved application with ign_off_count = " << application_lifes
+ << " was deleted");
+ } else {
+ LOG4CXX_WARN(logger_, "Problem with removing applications");
+ }
+
+ if (query_update_suspend_data.Prepare(kUpdateSuspendData)) {
+ if (query_update_suspend_data.Exec()) {
+ LOG4CXX_INFO(logger_,
+ "Data ign_off_count and suspend_count were updated");
+ }
+ }
+
+ if (query_update_last_ign_off_time.Prepare(KUpdateLastIgnOffTime)) {
+ query_update_last_ign_off_time.Bind(0, static_cast<int64_t>(time(NULL)));
+ if (query_update_last_ign_off_time.Exec()) {
+ LOG4CXX_INFO(logger_, "Data last_ign_off_time was updated");
+ }
+ }
+ WriteDb();
+}
+
+bool ResumptionDataDB::DeleteAppWithIgnCount(const int application_lifes) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery select_apps_for_removing(db());
+ utils::dbms::SQLQuery count_app(db());
+
+ if (!select_apps_for_removing.Prepare(kSelectApplicationsIgnOffCount) ||
+ !count_app.Prepare(kCountApplicationsIgnOff)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification query select_apps_for_removing or"
+ " query count_app");
+ return false;
+ }
+ /* Positions of binding data for "query count_app" :
+ field "ign_off_count" from table "application" = 0*/
+ count_app.Bind(0, application_lifes);
+ if (!count_app.Exec() || !count_app.GetInteger(0)) {
+ LOG4CXX_WARN(logger_, "Problem with execution or count app=0");
+ return false;
+ }
+ std::string policy_app_id;
+ std::string device_id;
+ /* Positions of binding data for "select_apps_for_removing" :
+ field "ign_off_count" from table "application" = 0*/
+ select_apps_for_removing.Bind(0, application_lifes);
+ while (select_apps_for_removing.Next()) {
+ device_id = select_apps_for_removing.GetString(0);
+ policy_app_id = select_apps_for_removing.GetString(1);
+ if (!DeleteSavedApplication(policy_app_id, device_id)) {
+ LOG4CXX_WARN(logger_, "Problem with removing application data");
+ return false;
+ }
+ }
+ LOG4CXX_WARN(logger_, "Applications data were removed successfully");
+ WriteDb();
+ return true;
+}
+
+bool ResumptionDataDB::GetHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ std::string& hash_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ return SelectHashId(policy_app_id, device_id, hash_id);
+}
+
+void ResumptionDataDB::OnAwake() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ UpdateDataOnAwake();
+}
+
+bool ResumptionDataDB::GetSavedApplication(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool application_exist = false;
+
+ if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) ||
+ !application_exist) {
+ LOG4CXX_ERROR(logger_,
+ "Problem with access to DB or application does not exists");
+ return false;
+ }
+
+ if (!SelectDataFromAppTable(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_,
+ "Problem with restoring of data from application table");
+ return false;
+ }
+
+ if (!SelectFilesData(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_, "Problem with restoring of files data");
+ return false;
+ }
+
+ if (!SelectSubmenuData(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_, "Problem with restoring of submenu data");
+ return false;
+ }
+
+ if (!SelectCommandData(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_, "Problem with restoring of command data");
+ return false;
+ }
+
+ if (!SelectSubscriptionsData(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_, "Problem with restoring of subscriptions data");
+ return false;
+ }
+
+ if (!SelectChoiceSetData(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_, "Problem with restoring of choice set data");
+ return false;
+ }
+
+ if (!SelectGlobalPropertiesData(policy_app_id, device_id, saved_app)) {
+ LOG4CXX_ERROR(logger_, "Problem with restoring of global properties data");
+ return false;
+ }
+ LOG4CXX_INFO(logger_,
+ "Application data were successfully fetched from data base");
+ return true;
+}
+
+bool ResumptionDataDB::RemoveApplicationFromSaved(
+ const std::string& policy_app_id, const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool application_exist = false;
+ if (!CheckExistenceApplication(policy_app_id, device_id, application_exist) ||
+ !application_exist) {
+ LOG4CXX_ERROR(logger_,
+ "Problem with access to DB or application does not"
+ " exist");
+ return false;
+ }
+ bool result = false;
+ if (DeleteSavedApplication(policy_app_id, device_id)) {
+ WriteDb();
+ result = true;
+ }
+ return result;
+}
+
+uint32_t ResumptionDataDB::GetIgnOffTime() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ return SelectIgnOffTime();
+}
+
+ssize_t ResumptionDataDB::IsApplicationSaved(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool application_exist = false;
+ if (CheckExistenceApplication(policy_app_id, device_id, application_exist) &&
+ application_exist) {
+ LOG4CXX_INFO(logger_, "Application exists in stored data");
+ return 0;
+ }
+ return -1;
+}
+
+void ResumptionDataDB::GetDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ SelectDataForLoadResumeData(saved_data);
+}
+
+bool ResumptionDataDB::SelectHMILevel(const std::string& policy_app_id,
+ const std::string& device_id,
+ int& hmi_level) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query_count(db());
+ utils::dbms::SQLQuery query_select(db());
+ if (query_count.Prepare(kSelectCountHMILevel) &&
+ query_select.Prepare(kSelectHMILevel)) {
+ /* Positions of binding data for "query_count" and "query_select" :
+ field "deviceID" from table "application" = 0
+ field "appID" from table "application" = 1 */
+ query_count.Bind(0, device_id);
+ query_count.Bind(1, policy_app_id);
+ query_select.Bind(0, device_id);
+ query_select.Bind(1, policy_app_id);
+ /* Position of data in "query_select" :
+ field "hmiLevel" from table "application" = 0 */
+ if (query_count.Exec() && query_count.GetInteger(0) &&
+ query_select.Exec()) {
+ hmi_level = query_select.GetInteger(0);
+ return true;
+ }
+ }
+ return false;
+}
+
+bool ResumptionDataDB::CheckExistenceHMIId(uint32_t hmi_app_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::dbms::SQLQuery query(db());
+ if (query.Prepare(kCheckHMIId)) {
+ query.Bind(0, static_cast<int64_t>(hmi_app_id));
+ if (query.Exec() && (query.GetInteger(0))) {
+ LOG4CXX_INFO(logger_, "Saved data has HMI appID = " << hmi_app_id);
+ return true;
+ }
+ }
+ LOG4CXX_FATAL(logger_,
+ "HMI appID = " << hmi_app_id << " doesn't exist in saved data");
+ return false;
+}
+
+void ResumptionDataDB::SelectHMIId(const std::string& policy_app_id,
+ const std::string& device_id,
+ uint32_t& hmi_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::dbms::SQLQuery query_select(db());
+ utils::dbms::SQLQuery query_check(db());
+ /* Positions of binding data for "query_select" and "query_check" :
+ field "deviceID" from table "application" = 0
+ field "appID" from table "application" = 1 */
+ if (query_select.Prepare(kSelectHMIId) &&
+ query_check.Prepare(kSelectCountHMIId)) {
+ query_select.Bind(0, device_id);
+ query_select.Bind(1, policy_app_id);
+ query_check.Bind(0, device_id);
+ query_check.Bind(1, policy_app_id);
+ /* Position of data in "query_select" :
+ field "hmiAppID" from table "application" = 0 */
+ if (query_check.Exec() && query_check.GetInteger(0) &&
+ query_select.Exec()) {
+ hmi_id = query_select.GetUInteger(0);
+ LOG4CXX_INFO(logger_, "HMI appID = " << hmi_id);
+ return;
+ }
+ }
+ LOG4CXX_FATAL(logger_,
+ "Saved data doesn't have application with "
+ "device id = "
+ << device_id
+ << " and policy appID = "
+ << policy_app_id);
+}
+
+bool ResumptionDataDB::SelectHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ std::string& hash_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery count(db());
+ utils::dbms::SQLQuery select_hash(db());
+ if (!select_hash.Prepare(kSelectHashId) || !count.Prepare(kCountHashId)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification count query or"
+ " select_hash query");
+ return false;
+ }
+ /* Positions of binding data for "count" and "select_hash" :
+ field "deviceID" from table "application" = 0
+ field "appID" from table "application" = 1 */
+ count.Bind(0, device_id);
+ count.Bind(1, policy_app_id);
+ select_hash.Bind(0, device_id);
+ select_hash.Bind(1, policy_app_id);
+ /* Position of data in "select_hash" :
+ field "hashID" from table "application" = 0 */
+ if (count.Exec() && count.GetInteger(0) && select_hash.Exec()) {
+ hash_id = select_hash.GetString(0);
+ LOG4CXX_INFO(logger_, "Saved hash ID = " << hash_id);
+ return true;
+ }
+ LOG4CXX_WARN(logger_,
+ "Saved data doesn't have application with "
+ "device id = "
+ << device_id
+ << " and policy appID = "
+ << policy_app_id
+ << "or hashID");
+ return false;
+}
+
+uint32_t ResumptionDataDB::SelectIgnOffTime() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ uint32_t ignOffTime = 0;
+ utils::dbms::SQLQuery query(db());
+ if (query.Prepare(kSelectIgnOffTime)) {
+ if (query.Exec()) {
+ ignOffTime = query.GetUInteger(0);
+ LOG4CXX_INFO(logger_, "Last ign off time = " << ignOffTime);
+ return ignOffTime;
+ }
+ }
+ LOG4CXX_ERROR(logger_, "Problem with prepare query");
+ return ignOffTime;
+}
+
+bool ResumptionDataDB::CheckExistenceApplication(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ bool& application_exist) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool result = false;
+ utils::dbms::SQLQuery query(db());
+ /* Positions of binding data for "query":
+ field "deviceID" from table "application" = 0
+ field "appID" from table "application" = 1 */
+ if (query.Prepare(kCheckApplication)) {
+ query.Bind(0, device_id);
+ query.Bind(1, policy_app_id);
+ result = query.Exec();
+ }
+ /* Position of data in "query" :
+ amount of application = 0 */
+ if (result && query.GetInteger(0)) {
+ LOG4CXX_INFO(
+ logger_,
+ "Saved data has application with policy appID = " << policy_app_id
+ << " and deviceID = "
+ << device_id);
+ application_exist = true;
+ } else if (result) {
+ LOG4CXX_INFO(logger_, "Saved data does not contain application");
+ application_exist = false;
+ } else {
+ LOG4CXX_ERROR(logger_, "Problem with access DB");
+ }
+ return result;
+}
+
+void ResumptionDataDB::SelectDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const {
+ using namespace app_mngr;
+ using namespace smart_objects;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::dbms::SQLQuery select_data(db());
+ utils::dbms::SQLQuery count_application(db());
+ if (!select_data.Prepare(kSelectDataForLoadResumeData) ||
+ !count_application.Prepare(kCountApplications)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification select_data query"
+ " or count application");
+ return;
+ }
+
+ if (!count_application.Exec() || !count_application.GetInteger(0)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with execution count_application query"
+ " or appliction table does not contain data");
+ return;
+ }
+ SmartObject so_array_data(SmartType_Array);
+ uint32_t i = 0;
+ /* Position of data in "select_data" :
+ field "hmiLevel" from table "application" = 0
+ field "ign_off_count" from table "application" = 1
+ field "timeStamp" from table "application" = 2
+ field "appID" from table "application" = 3
+ field "deviceID" from table "application" = 4 */
+ while (select_data.Next()) {
+ SmartObject so_obj(SmartType_Map);
+ so_obj[strings::hmi_level] = select_data.GetInteger(0);
+ so_obj[strings::ign_off_count] = select_data.GetInteger(1);
+ so_obj[strings::time_stamp] = select_data.GetUInteger(2);
+ so_obj[strings::app_id] = select_data.GetString(3);
+ so_obj[strings::device_id] = select_data.GetString(4);
+ so_array_data[i++] = so_obj;
+ }
+ saved_data = so_array_data;
+}
+
+void ResumptionDataDB::UpdateHmiLevel(const std::string& policy_app_id,
+ const std::string& device_id,
+ mobile_apis::HMILevel::eType hmi_level) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::dbms::SQLQuery query(db());
+ /* Positions of binding data for "query":
+ field "hmiLevel" from table "application" = 0
+ field "deviceID" from table "application" = 1
+ field "appID" from table "application" = 2 */
+ if (query.Prepare(kUpdateHMILevel)) {
+ query.Bind(0, hmi_level);
+ query.Bind(1, device_id);
+ query.Bind(2, policy_app_id);
+ if (query.Exec()) {
+ LOG4CXX_INFO(logger_,
+ "Saved data has application with policy appID = "
+ << policy_app_id
+ << " and deviceID = "
+ << device_id
+ << " has new HMI level = "
+ << hmi_level);
+ WriteDb();
+ }
+ }
+}
+
+bool ResumptionDataDB::RefreshDB() const {
+ utils::dbms::SQLQuery query(db());
+ if (!query.Exec(resumption::kDropSchema)) {
+ LOG4CXX_WARN(logger_,
+ "Failed dropping database: " << query.LastError().text());
+ return false;
+ }
+ if (!query.Exec(resumption::kCreateSchema)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed creating schema of database: " << query.LastError().text());
+ return false;
+ }
+ if (!query.Exec(resumption::kInsertInitData)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Failed insert init data to database: " << query.LastError().text());
+ return false;
+ }
+ return true;
+}
+
+bool ResumptionDataDB::GetAllData(smart_objects::SmartObject& data) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(resumption::kSelectAllApps)) {
+ LOG4CXX_ERROR(logger_, "Can't get applications data from DB.");
+ return false;
+ }
+
+ data = smart_objects::SmartObject(smart_objects::SmartType_Array);
+
+ uint32_t index = 0;
+ while (query.Next()) {
+ const std::string app_id = query.GetString(0);
+ const std::string device_id = query.GetString(1);
+ if (GetSavedApplication(app_id, device_id, data[index])) {
+ ++index;
+ }
+ }
+ return true;
+}
+
+bool ResumptionDataDB::SaveAllData(const smart_objects::SmartObject& data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (smart_objects::SmartType_Array != data.getType()) {
+ LOG4CXX_ERROR(logger_, "Unexpected type for resumption data.");
+ return false;
+ }
+ const smart_objects::SmartArray* apps = data.asArray();
+ smart_objects::SmartArray::const_iterator it_apps = apps->begin();
+ for (; apps->end() != it_apps; ++it_apps) {
+ if (!SaveApplicationToDB((*it_apps),
+ (*it_apps)["appID"].asString(),
+ (*it_apps)["deviceID"].asString())) {
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ResumptionDataDB::IsDBVersionActual() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(resumption::kSelectDBVersion) || !query.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "Failed to get DB version: " << query.LastError().text());
+ return false;
+ }
+
+ const int32_t saved_db_version = query.GetInteger(0);
+ const int32_t current_db_version = GetDBVersion();
+ LOG4CXX_DEBUG(logger_,
+ "Saved DB version is: " << saved_db_version
+ << ". Current DB vesion is: "
+ << current_db_version);
+
+ return current_db_version == saved_db_version;
+}
+
+bool ResumptionDataDB::UpdateDBVersion() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(resumption::kUpdateDBVersion)) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Incorrect DB version update query: " << query.LastError().text());
+ return false;
+ }
+
+ query.Bind(0, GetDBVersion());
+
+ if (!query.Exec()) {
+ LOG4CXX_ERROR(logger_,
+ "DB version update failed: " << query.LastError().text());
+ return false;
+ }
+
+ return true;
+}
+
+bool ResumptionDataDB::DropAppDataResumption(const std::string& device_id,
+ const std::string& app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::ScopeGuard guard = utils::MakeObjGuard(
+ *db_,
+ &utils::dbms::SQLDatabase::RollbackTransaction);
+
+ db_->BeginTransaction();
+ if (!DeleteSavedFiles(app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedSubMenu(app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedSubscriptions(app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedCommands(app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedChoiceSet(app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedGlobalProperties(app_id, device_id)) {
+ return false;
+ }
+ if(!UpdateGrammarID(app_id, device_id, 0)) {
+ return false;
+ }
+ db_->CommitTransaction();
+
+ guard.Dismiss();
+ return true;
+}
+
+const int32_t ResumptionDataDB::GetDBVersion() const {
+ return utils::Djb2HashFromString(resumption::kCreateSchema);
+}
+
+bool ResumptionDataDB::SelectFilesData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountFiles, policy_app_id, device_id)) {
+ return false;
+ }
+
+ saved_app[strings::application_files] = SmartObject(SmartType_Array);
+
+ if (0 == count_item) {
+ LOG4CXX_INFO(logger_, "Application does not contain files data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_files(db());
+ if (!PrepareSelectQuery(
+ select_files, policy_app_id, device_id, kSelectFiles)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_files");
+ return false;
+ }
+ saved_app[strings::application_files] = SmartObject(SmartType_Array);
+ /* Position of data in "select_files" :
+ field "fileType" from table "file" = 0
+ field "is_download_complete" from table "file" = 1
+ field "persistentFile" from table "file" = 2
+ field "syncFileName" from table "file" = 3*/
+ uint32_t i = 0;
+ while (select_files.Next()) {
+ SmartObject array_item(SmartType_Map);
+ array_item[strings::file_type] = select_files.GetInteger(0);
+ array_item[strings::is_download_complete] = select_files.GetBoolean(1);
+ array_item[strings::persistent_file] = select_files.GetBoolean(2);
+ array_item[strings::sync_file_name] = select_files.GetString(3);
+ saved_app[strings::application_files][i++] = array_item;
+ }
+ LOG4CXX_INFO(logger_, "File data was restored successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectSubmenuData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountSubMenu, policy_app_id, device_id)) {
+ return false;
+ }
+
+ saved_app[strings::application_submenus] = SmartObject(SmartType_Array);
+
+ if (0 == count_item) {
+ LOG4CXX_INFO(logger_, "Application does not contain submenu data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_sub_menu(db());
+ if (!PrepareSelectQuery(
+ select_sub_menu, policy_app_id, device_id, kSelectSubMenu)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_sub_menu");
+ return false;
+ }
+ saved_app[strings::application_submenus] = SmartObject(SmartType_Array);
+ /* Position of data in "select_sub_menu" :
+ field "menuID" from table "subMenu" = 0
+ field "menuName" from table "subMenu" = 1
+ field "position" from table "subMenu" = 2*/
+ uint32_t i = 0;
+ while (select_sub_menu.Next()) {
+ SmartObject array_item(SmartType_Map);
+ array_item[strings::menu_id] = select_sub_menu.GetInteger(0);
+ array_item[strings::menu_name] = select_sub_menu.GetString(1);
+ if (!(select_sub_menu.IsNull(2))) {
+ array_item[strings::position] = select_sub_menu.GetInteger(2);
+ }
+ saved_app[strings::application_submenus][i++] = array_item;
+ }
+ LOG4CXX_INFO(logger_, "Sub menu data was restored successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectCommandData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountCommands, policy_app_id, device_id)) {
+ return false;
+ }
+
+ saved_app[strings::application_commands] = SmartObject(SmartType_Array);
+
+ if (0 == count_item) {
+ LOG4CXX_INFO(logger_, "Application does not contain commands data");
+ return true;
+ }
+
+ utils::dbms::SQLQuery select_commands(db());
+ if (!PrepareSelectQuery(
+ select_commands, policy_app_id, device_id, kSelectCommands)) {
+ return false;
+ }
+ int64_t command_key = 0;
+ int32_t command_idx = -1;
+ size_t vr_cmd_idx = 0;
+ bool vr_command_exist = false;
+ /* Position of data in "select_commands" :
+ field "idcommand" from table "command" = 0
+ field "cmdID" from table "command" = 1
+ field "menuName" from table "command" = 2
+ field "parentID" from table "command" = 3
+ field "position" from table "command" = 4
+ field "value" from table "image" = 5
+ field "imageType" from table "image" = 6
+ field "vrCommand" from table "vrCommandsArray" = 7*/
+ while (select_commands.Next()) {
+ if (command_key != select_commands.GetLongInt(0)) {
+ ++command_idx;
+ saved_app[strings::application_commands][command_idx] =
+ SmartObject(SmartType_Map);
+ SmartObject& so_item =
+ saved_app[strings::application_commands][command_idx];
+ so_item[strings::cmd_id] = select_commands.GetInteger(1);
+ SmartObject menu_params(SmartType_Map);
+ SmartObject cmd_icon(SmartType_Map);
+ if (!(select_commands.IsNull(2))) {
+ menu_params[strings::menu_name] = select_commands.GetString(2);
+ }
+ if (!(select_commands.IsNull(3))) {
+ menu_params[hmi_request::parent_id] = select_commands.GetInteger(3);
+ }
+ if (!(select_commands.IsNull(4))) {
+ menu_params[strings::position] = select_commands.GetInteger(4);
+ }
+ if (!menu_params.empty()) {
+ so_item[strings::menu_params] = menu_params;
+ }
+ if (!(select_commands.IsNull(5))) {
+ cmd_icon[strings::value] = select_commands.GetString(5);
+ }
+ if (!(select_commands.IsNull(6))) {
+ cmd_icon[strings::image_type] = select_commands.GetInteger(6);
+ }
+ if (!cmd_icon.empty()) {
+ so_item[strings::cmd_icon] = cmd_icon;
+ }
+ if (!(select_commands.IsNull(7))) {
+ vr_command_exist = true;
+ so_item[strings::vr_commands] = SmartObject(SmartType_Array);
+ } else {
+ vr_command_exist = false;
+ }
+ vr_cmd_idx = 0;
+ command_key = select_commands.GetLongInt(0);
+ }
+ if (vr_command_exist) {
+ saved_app[strings::application_commands][command_idx]
+ [strings::vr_commands][vr_cmd_idx++] =
+ select_commands.GetString(7);
+ }
+ }
+ LOG4CXX_INFO(logger_, "Commands were restored from DB successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectSubscriptionsData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountSubscriptions, policy_app_id, device_id)) {
+ return false;
+ }
+
+ saved_app[strings::application_subscribtions] = SmartObject(SmartType_Map);
+
+ if (0 == count_item) {
+ LOG4CXX_INFO(logger_, "Application does not contain subscriptions data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_subscriptions(db());
+ if (!PrepareSelectQuery(select_subscriptions,
+ policy_app_id,
+ device_id,
+ kSelectSubscriptions)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_subscriptions");
+ return false;
+ }
+ SmartObject application_buttons(SmartType_Array);
+ SmartObject application_vehicle_info(SmartType_Array);
+ size_t buttons_idx = 0;
+ size_t vi_idx = 0;
+ /* Position of data in "select_subscriptions" :
+ field "vehicleValue" from table "applicationSubscribtionsArray" = 0
+ field "ButtonNameValue" from table "applicationSubscribtionsArray" = 1*/
+ while (select_subscriptions.Next()) {
+ if (!select_subscriptions.IsNull(0)) {
+ application_vehicle_info[vi_idx++] = select_subscriptions.GetInteger(0);
+ }
+ if (!select_subscriptions.IsNull(1)) {
+ application_buttons[buttons_idx++] = select_subscriptions.GetInteger(1);
+ }
+ }
+ if (!application_buttons.empty()) {
+ saved_app[strings::application_subscribtions]
+ [strings::application_buttons] = application_buttons;
+ }
+
+ if (!application_vehicle_info.empty()) {
+ saved_app[strings::application_subscribtions]
+ [strings::application_vehicle_info] = application_vehicle_info;
+ }
+ LOG4CXX_INFO(logger_, "Subscriptions were restored from DB successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectChoiceSetData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountChoiceSet, policy_app_id, device_id)) {
+ return false;
+ }
+
+ saved_app[strings::application_choice_sets] = SmartObject(SmartType_Array);
+
+ if (0 == count_item) {
+ LOG4CXX_INFO(logger_, "Application does not contain choice set data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_choice_set(db());
+ if (!PrepareSelectQuery(
+ select_choice_set, policy_app_id, device_id, kSelectChoiceSets)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_choice_set");
+ return false;
+ }
+
+ int64_t application_choice_set_key = 0;
+ int64_t choice_key = 0;
+ int32_t choice_set_idx = -1;
+ int32_t choice_idx = -1;
+ size_t vr_cmd_idx = 0;
+ /* Position of data in "select_choice_set" :
+ field "idapplicationChoiceSet" from table "applicationChoiceSet" = 0
+ field "grammarID" from table "applicationChoiceSet" = 1
+ field "interactionChoiceSetID" from table "applicationChoiceSet" = 2
+ field "idchoice" from table "choice" = 3
+ field "choiceID" from table "choice" = 4
+ field "menuName" from table "choice" = 5
+ field "secondaryText" from table "choice" = 6
+ field "tertiaryText" from table "choice" = 7
+ field "idimage" from table "choice" = 8
+ field "idsecondaryImage" from table "choice" = 9
+ field "vrCommand" from table "vrCommandsArray" = 10*/
+ while (select_choice_set.Next()) {
+ if (application_choice_set_key != select_choice_set.GetLongInt(0)) {
+ ++choice_set_idx;
+ saved_app[strings::application_choice_sets][choice_set_idx] =
+ SmartObject(SmartType_Map);
+ SmartObject& choice_set_item =
+ saved_app[strings::application_choice_sets][choice_set_idx];
+ choice_set_item[strings::grammar_id] = select_choice_set.GetInteger(1);
+ choice_set_item[strings::interaction_choice_set_id] =
+ select_choice_set.GetInteger(2);
+ saved_app[strings::application_choice_sets][choice_set_idx]
+ [strings::choice_set] = SmartObject(SmartType_Array);
+ application_choice_set_key = select_choice_set.GetLongInt(0);
+ choice_idx = -1;
+ }
+ if (choice_key != select_choice_set.GetLongInt(3)) {
+ ++choice_idx;
+ choice_key = select_choice_set.GetLongInt(3);
+
+ saved_app[strings::application_choice_sets][choice_set_idx]
+ [strings::choice_set][choice_idx] = SmartObject(SmartType_Map);
+ SmartObject& choice_item =
+ saved_app[strings::application_choice_sets][choice_set_idx]
+ [strings::choice_set][choice_idx];
+ choice_item[strings::choice_id] = select_choice_set.GetUInteger(4);
+ choice_item[strings::menu_name] = select_choice_set.GetString(5);
+ if (!(select_choice_set.IsNull(6))) {
+ choice_item[strings::secondary_text] = select_choice_set.GetString(6);
+ }
+ if (!(select_choice_set.IsNull(7))) {
+ choice_item[strings::tertiary_text] = select_choice_set.GetString(7);
+ }
+ if (!(select_choice_set.IsNull(8))) {
+ SmartObject image(SmartType_Map);
+ if (!SelectImageData(select_choice_set.GetLongInt(8), image)) {
+ return false;
+ }
+ choice_item[strings::image] = image;
+ }
+ if (!(select_choice_set.IsNull(9))) {
+ SmartObject secondary_image(SmartType_Map);
+ if (!SelectImageData(select_choice_set.GetLongInt(9),
+ secondary_image)) {
+ return false;
+ }
+ choice_item[strings::secondary_image] = secondary_image;
+ }
+ choice_item[strings::vr_commands] = SmartObject(SmartType_Array);
+ vr_cmd_idx = 0;
+ }
+ saved_app[strings::application_choice_sets][choice_set_idx]
+ [strings::choice_set][choice_idx][strings::vr_commands]
+ [vr_cmd_idx++] = select_choice_set.GetString(10);
+ }
+
+ LOG4CXX_INFO(logger_, "Choice sets were restored from DB successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectGlobalPropertiesData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ uint32_t count_item = 0;
+ if (!SelectCountFromArray(
+ count_item, kSelectCountGlobalProperties, policy_app_id, device_id)) {
+ return false;
+ }
+
+ saved_app[strings::application_global_properties] =
+ SmartObject(SmartType_Map);
+
+ if (0 == count_item) {
+ LOG4CXX_INFO(logger_,
+ "Application does not contain global properties data");
+ return true;
+ }
+ utils::dbms::SQLQuery select_globalproperties(db());
+ if (!PrepareSelectQuery(select_globalproperties,
+ policy_app_id,
+ device_id,
+ kSelectGlobalProperties)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_globalproperties");
+ return false;
+ }
+ saved_app[strings::application_global_properties] =
+ SmartObject(SmartType_Map);
+ SmartObject& global_properties =
+ saved_app[strings::application_global_properties];
+ SmartObject keyboard_properties(SmartType_Map);
+ SmartObject help_prompt(SmartType_Array);
+ SmartObject timeout_prompt(SmartType_Array);
+ size_t help_prompt_idx = 0;
+ size_t timeout_prompt_idx = 0;
+ int64_t global_properties_key = 0;
+ /* Position of data in "select_globalproperties" :
+ field "idglobalProperties" from table "globalProperties" = 0
+ field "vrHelpTitle" from table "globalProperties" = 1
+ field "menuTitle" from table "globalProperties" = 2
+ field "idmenuIcon" from table "globalProperties" = 3
+ field "language" from table "globalProperties" = 4
+ field "keyboardLayout" from table "globalProperties" = 5
+ field "keypressMode" from table "globalProperties" = 6
+ field "autoCompleteText" from table "globalProperties" = 7
+ field "idhelpPrompt" from table "helpTimeoutPromptArray" = 8
+ field "idtimeoutPrompt" from table "helpTimeoutPromptArray" = 9*/
+ while (select_globalproperties.Next()) {
+ if (global_properties_key != select_globalproperties.GetLongInt(0)) {
+ global_properties_key = select_globalproperties.GetLongInt(0);
+ if (!select_globalproperties.IsNull(1)) {
+ global_properties[strings::vr_help_title] =
+ select_globalproperties.GetString(1);
+ }
+ if (!select_globalproperties.IsNull(2)) {
+ global_properties[strings::menu_title] =
+ select_globalproperties.GetString(2);
+ }
+ if (!select_globalproperties.IsNull(3)) {
+ SmartObject image(SmartType_Map);
+ if (!SelectImageData(select_globalproperties.GetLongInt(3), image)) {
+ return false;
+ }
+ global_properties[strings::menu_icon] = image;
+ }
+ if (!select_globalproperties.IsNull(4)) {
+ keyboard_properties[strings::language] =
+ select_globalproperties.GetInteger(4);
+ }
+ if (!select_globalproperties.IsNull(5)) {
+ keyboard_properties[hmi_request::keyboard_layout] =
+ select_globalproperties.GetInteger(5);
+ }
+ if (!select_globalproperties.IsNull(6)) {
+ keyboard_properties[strings::key_press_mode] =
+ select_globalproperties.GetInteger(6);
+ }
+ if (!select_globalproperties.IsNull(7)) {
+ keyboard_properties[strings::auto_complete_text] =
+ select_globalproperties.GetString(7);
+ }
+ }
+ if (!select_globalproperties.IsNull(8)) {
+ SmartObject tts_chunk(SmartType_Map);
+ if (!SelectTTSChunkData(select_globalproperties.GetLongInt(8),
+ tts_chunk)) {
+ return false;
+ }
+ help_prompt[help_prompt_idx++] = tts_chunk;
+ }
+ if (!select_globalproperties.IsNull(9)) {
+ SmartObject tts_chunk(SmartType_Map);
+ if (!SelectTTSChunkData(select_globalproperties.GetLongInt(9),
+ tts_chunk)) {
+ return false;
+ }
+ timeout_prompt[timeout_prompt_idx++] = tts_chunk;
+ }
+ }
+ if (help_prompt_idx != 0) {
+ global_properties[strings::help_prompt] = help_prompt;
+ }
+ if (timeout_prompt_idx != 0) {
+ global_properties[strings::timeout_prompt] = timeout_prompt;
+ }
+ if (!keyboard_properties.empty()) {
+ global_properties[strings::keyboard_properties] = keyboard_properties;
+ if (!SelectCharactersData(
+ global_properties_key,
+ global_properties[strings::keyboard_properties])) {
+ return false;
+ }
+ }
+ if (!SelectVrHelpItemsData(global_properties_key, global_properties)) {
+ return false;
+ }
+ return true;
+}
+
+bool ResumptionDataDB::SelectVrHelpItemsData(
+ int64_t global_properties_key,
+ smart_objects::SmartObject& global_properties) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ utils::dbms::SQLQuery checks_vrhelp_item(db());
+ if (!checks_vrhelp_item.Prepare(kChecksVrHelpItem)) {
+ LOG4CXX_WARN(logger_, "Problem with verification checks_vrhelp_item query");
+ return false;
+ }
+ checks_vrhelp_item.Bind(0, global_properties_key);
+ if (!checks_vrhelp_item.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution checks_vrhelp_item query");
+ return false;
+ }
+ if (0 == checks_vrhelp_item.GetInteger(0)) {
+ LOG4CXX_INFO(logger_, "Global properties doesn't contain vr help item");
+ return true;
+ }
+ utils::dbms::SQLQuery select_vrhelp_item(db());
+ if (!select_vrhelp_item.Prepare(kSelectVrHelpItem)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_vrhelp_item query");
+ return false;
+ }
+ global_properties[strings::vr_help] = SmartObject(SmartType_Array);
+ SmartObject& vr_help_items = global_properties[strings::vr_help];
+ select_vrhelp_item.Bind(0, global_properties_key);
+ size_t vr_help_item_idx = 0;
+ /* Position of data in "select_vrhelp_item" :
+ field "text" from table "vrHelpItem" = 0
+ field "position" from table "vrHelpItem" = 1
+ field "imageType" from table "image" = 2
+ field "value" from table "image" = 3*/
+ while (select_vrhelp_item.Next()) {
+ SmartObject item(SmartType_Map);
+ item[strings::text] = select_vrhelp_item.GetString(0);
+ item[strings::position] = select_vrhelp_item.GetInteger(1);
+ if (!select_vrhelp_item.IsNull(2) && !select_vrhelp_item.IsNull(3)) {
+ SmartObject image(SmartType_Map);
+ image[strings::image_type] = select_vrhelp_item.GetInteger(2);
+ image[strings::value] = select_vrhelp_item.GetString(3);
+ item[strings::image] = image;
+ }
+ vr_help_items[vr_help_item_idx++] = item;
+ }
+ LOG4CXX_INFO(logger_, "VR Help items were restored successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectCharactersData(
+ int64_t global_properties_key,
+ smart_objects::SmartObject& keyboard_properties) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ utils::dbms::SQLQuery checks_characters(db());
+ if (!checks_characters.Prepare(kChecksCharacter)) {
+ LOG4CXX_WARN(logger_, "Problem with verification checks_characters query");
+ return false;
+ }
+ checks_characters.Bind(0, global_properties_key);
+ if (!checks_characters.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution checks_characters query");
+ return false;
+ }
+ if (0 == checks_characters.GetInteger(0)) {
+ LOG4CXX_INFO(
+ logger_,
+ "Keyboard properties doesn't contain table limited character list");
+ return true;
+ }
+ utils::dbms::SQLQuery select_characters(db());
+ if (!select_characters.Prepare(kSelectCharacter)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_characters query");
+ return false;
+ }
+
+ keyboard_properties[strings::limited_character_list] =
+ SmartObject(SmartType_Array);
+ SmartObject& characters =
+ keyboard_properties[strings::limited_character_list];
+ select_characters.Bind(0, global_properties_key);
+ size_t characters_idx = 0;
+ /* Position of data in "select_characters" :
+ field "limitedCharacterList" from table "tableLimitedCharacterList" = 0*/
+ while (select_characters.Next()) {
+ characters[characters_idx++] = select_characters.GetString(0);
+ }
+ return true;
+}
+
+bool ResumptionDataDB::SelectImageData(
+ int64_t image_key, smart_objects::SmartObject& image) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery select_image(db());
+
+ if (!select_image.Prepare(kSelectImage)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_image query");
+ return false;
+ }
+ select_image.Bind(0, image_key);
+ if (!select_image.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution select_image query");
+ return false;
+ }
+ /* Position of data in "select_image" :
+ field "imageType" from table "image" = 0
+ field "value" from table "image" = 1*/
+ image[strings::image_type] = select_image.GetInteger(0);
+ image[strings::value] = select_image.GetString(1);
+ return true;
+}
+
+bool ResumptionDataDB::SelectTTSChunkData(
+ int64_t tts_chunk_key, smart_objects::SmartObject& tts_chunk) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery select_tts_chunk(db());
+
+ if (!select_tts_chunk.Prepare(kSelectTTSChunk)) {
+ LOG4CXX_WARN(logger_, "Problem with verification select_tts_chunk query");
+ return false;
+ }
+ select_tts_chunk.Bind(0, tts_chunk_key);
+ if (!select_tts_chunk.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution select_tts_chunk query");
+ return false;
+ }
+ /* Position of data in "select_tts_chunk" :
+ field "text" from table "TTSChunk" = 0
+ field "type" from table "TTSChunk" = 1*/
+ tts_chunk[strings::text] = select_tts_chunk.GetString(0);
+ tts_chunk[strings::type] = select_tts_chunk.GetInteger(1);
+ return true;
+}
+
+bool ResumptionDataDB::SelectDataFromAppTable(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(kSelectAppTable)) {
+ LOG4CXX_WARN(logger_, "Problem with verification kSelectAppTable query");
+ return false;
+ }
+ query.Bind(0, policy_app_id);
+ query.Bind(1, device_id);
+ if (!query.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution kSelectAppTable query");
+ return false;
+ }
+ /* Position of data in "query" :
+ field "appID" from table "application" = 0
+ field "connection_key" from table "application" = 1
+ field "grammarID" from table "application" = 2
+ field "hashID" from table "application" = 3
+ field "hmiAppID" from table "application" = 4
+ field "hmiLevel" from table "application" = 5
+ field "ign_off_count" from table "application" = 6
+ field "suspend_count" from table "application" = 7
+ field "timeStamp" from table "application" = 7
+ field "deviceID" from table "application" = 8
+ field "isMediaApplication" from table "application" = 9
+ */
+ saved_app[strings::app_id] = query.GetString(0);
+ saved_app[strings::connection_key] = query.GetUInteger(1);
+ uint32_t grammarID = query.GetUInteger(2);
+ if (grammarID) {
+ saved_app[strings::grammar_id] = grammarID;
+ }
+ saved_app[strings::hash_id] = query.GetString(3);
+ saved_app[strings::hmi_app_id] = query.GetUInteger(4);
+ saved_app[strings::hmi_level] = query.GetInteger(5);
+ saved_app[strings::ign_off_count] = query.GetInteger(6);
+ saved_app[strings::suspend_count] = query.GetInteger(7);
+ saved_app[strings::time_stamp] = query.GetUInteger(8);
+ saved_app[strings::device_id] = query.GetString(9);
+ saved_app[strings::is_media_application] = query.GetBoolean(10);
+
+ LOG4CXX_INFO(logger_,
+ "Data from application table was restored successfully");
+ return true;
+}
+
+bool ResumptionDataDB::SelectCountFromArray(
+ uint32_t& count_item,
+ const std::string& text_query,
+ const std::string& policy_app_id,
+ const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(text_query)) {
+ LOG4CXX_WARN(logger_, "Problem with verification query");
+ return false;
+ }
+ query.Bind(0, policy_app_id);
+ query.Bind(1, device_id);
+ if (!query.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution query");
+ return false;
+ }
+ count_item = query.GetInteger(0);
+ LOG4CXX_INFO(logger_, "count_item=" << count_item);
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::ScopeGuard guard = utils::MakeObjGuard(
+ *db_,
+ &utils::dbms::SQLDatabase::RollbackTransaction);
+
+ db_->BeginTransaction();
+ if (!DeleteSavedFiles(policy_app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedSubMenu(policy_app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedSubscriptions(policy_app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedCommands(policy_app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedChoiceSet(policy_app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteSavedGlobalProperties(policy_app_id, device_id)) {
+ return false;
+ }
+ if (!DeleteDataFromApplicationTable(policy_app_id, device_id)) {
+ return false;
+ }
+ db_->CommitTransaction();
+
+ guard.Dismiss();
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedFiles(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteFile)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from file.");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationFilesArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from applicationFilesArray.");
+ return false;
+ }
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedSubMenu(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteSubMenu)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from subMenu.");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationSubMenuArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from applicationSubMenuArray.");
+ return false;
+ }
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedSubscriptions(
+ const std::string& policy_app_id, const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationSubscribtionsArray)) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect delete from applicationSubscribtionsArray.");
+ return false;
+ }
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedCommands(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteImageFromCommands)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete image from commands.");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteVrCommands)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete vrcommands from commands.");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCommands)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete commands.");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationCommandsArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete applicationCommandsArray.");
+ return false;
+ }
+
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedChoiceSet(const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ExecUnionQueryToDeleteData(
+ policy_app_id, device_id, kDeleteImageFromChoiceSet)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete image from choice set");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteVrCommandsFromChoiceSet)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete vrCommands from choice set");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoice)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete choiceSet");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteChoiceArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from choiceArray");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationChoiceSet)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete applicationChoiceSet");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteApplicationChoiceSetArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from ApplicationChoiceSetArray");
+ return false;
+ }
+
+ return true;
+}
+
+bool ResumptionDataDB::DeleteSavedGlobalProperties(
+ const std::string& policy_app_id, const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ExecUnionQueryToDeleteData(
+ policy_app_id, device_id, kDeleteImageFromGlobalProperties)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete image from globalProperties");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeletevrHelpItem)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete vrHelpItem");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeletevrHelpItemArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete vrHelpItemArray");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteTableLimitedCharacterList)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from tableLimitedCharacterList");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(policy_app_id, device_id, kDeleteCharacterArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from characterArray");
+ return false;
+ }
+
+ if (!ExecUnionQueryToDeleteData(policy_app_id, device_id, kDeleteTTSChunk)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from TTSChunk");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteHelpTimeoutPromptArray)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from HelpTimeoutPromptArray");
+ return false;
+ }
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteGlobalProperties)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete from GlobalProperties");
+ return false;
+ }
+
+ return true;
+}
+
+bool ResumptionDataDB::DeleteDataFromApplicationTable(
+ const std::string& policy_app_id, const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!ExecQueryToDeleteData(
+ policy_app_id, device_id, kDeleteFromApplicationTable)) {
+ LOG4CXX_WARN(logger_, "Incorrect delete data from application table");
+ return false;
+ }
+
+ return true;
+}
+
+bool ResumptionDataDB::ExecQueryToDeleteData(const std::string& policy_app_id,
+ const std::string& device_id,
+ const std::string& text_query) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ bool result = query.Prepare(text_query);
+ if (result) {
+ query.Bind(0, policy_app_id);
+ query.Bind(1, device_id);
+ result = query.Exec();
+ }
+ return result;
+}
+
+bool ResumptionDataDB::ExecUnionQueryToDeleteData(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ const std::string& text_query) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ bool result = query.Prepare(text_query);
+ if (result) {
+ query.Bind(0, policy_app_id);
+ query.Bind(1, device_id);
+ query.Bind(2, policy_app_id);
+ query.Bind(3, device_id);
+ result = query.Exec();
+ }
+ return result;
+}
+
+bool ResumptionDataDB::ExecInsertImage(
+ int64_t& image_primary_key, const smart_objects::SmartObject& image) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery count_image_query(db());
+ utils::dbms::SQLQuery query(db());
+ uint16_t count_image = 0;
+ bool result = count_image_query.Prepare(kSelectCountImage);
+ if (result) {
+ count_image_query.Bind(0, image[strings::value].asString());
+ result = count_image_query.Exec();
+ if (result) {
+ count_image = count_image_query.GetInteger(0);
+ }
+ }
+ if (!result) {
+ LOG4CXX_WARN(logger_,
+ "Problem with preparing or execution count_image_query.");
+ return false;
+ }
+ if (count_image) {
+ result = query.Prepare(kSelectPrimaryKeyImage);
+ if (result) {
+ query.Bind(0, image[strings::value].asString());
+ result = query.Exec();
+ if (result) {
+ image_primary_key = query.GetLongInt(0);
+ }
+ }
+ if (!result) {
+ LOG4CXX_WARN(logger_,
+ "Problem with preparing or execution "
+ "query for select primary key of image");
+ }
+ } else {
+ result = query.Prepare(kInsertImage);
+ if (result) {
+ query.Bind(0, image[strings::image_type].asInt());
+ query.Bind(1, image[strings::value].asString());
+ result = query.Exec();
+ if (result) {
+ image_primary_key = query.LastInsertId();
+ }
+ }
+ if (!result) {
+ LOG4CXX_WARN(logger_,
+ "Problem with preparing or execution "
+ "query for insert image to image table");
+ }
+ }
+ return result;
+}
+
+bool ResumptionDataDB::ExecInsertChoice(
+ int64_t choice_set_key,
+ const smart_objects::SmartObject& choice_array) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery insert_choice(db());
+
+ if (!insert_choice.Prepare(kInsertChoice)) {
+ LOG4CXX_WARN(logger_, "Incorrect preparation insert_choice query");
+ return false;
+ }
+ /* Positions of binding data for "insert_choice":
+ field "choiceID" from table "choice" = 0
+ field "menuName" from table "choice" = 1
+ field "secondaryText" from table "choice" = 2
+ field "tertiaryText" from table "choice" = 3
+ field "idimage" from table "choice" = 4
+ field "idsecondaryImage" from table "choice" = 5*/
+ int64_t image_primary_key = 0;
+ int64_t choice_primary_key = 0;
+ size_t length_choice_array = choice_array.length();
+ for (size_t i = 0; i < length_choice_array; ++i) {
+ insert_choice.Bind(0, (choice_array[i][strings::choice_id]).asInt());
+ insert_choice.Bind(1, (choice_array[i][strings::menu_name]).asString());
+
+ CustomBind(strings::secondary_text, choice_array[i], insert_choice, 2);
+ CustomBind(strings::tertiary_text, choice_array[i], insert_choice, 3);
+
+ if (choice_array[i].keyExists(strings::image)) {
+ if (!ExecInsertImage(image_primary_key,
+ choice_array[i][strings::image])) {
+ LOG4CXX_WARN(logger_, "Problem with insert image to choice");
+ return false;
+ }
+ insert_choice.Bind(4, image_primary_key);
+ } else {
+ insert_choice.Bind(4);
+ }
+ if (choice_array[i].keyExists(strings::secondary_image)) {
+ if (!ExecInsertImage(image_primary_key,
+ choice_array[i][strings::secondary_image])) {
+ LOG4CXX_WARN(logger_, "Problem with insert secondary_image to choice");
+ return false;
+ }
+ insert_choice.Bind(5, image_primary_key);
+ } else {
+ insert_choice.Bind(5);
+ }
+ if (!insert_choice.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution insert_choice query");
+ return false;
+ }
+ choice_primary_key = insert_choice.LastInsertId();
+
+ if ((!ExecInsertVrCommands(choice_primary_key,
+ choice_array[i][strings::vr_commands],
+ kVRCommandFromChoice)) ||
+ !insert_choice.Reset()) {
+ LOG4CXX_WARN(logger_, "problemm with add vr commands to choice");
+ return false;
+ }
+
+ if (!ExecInsertDataToArray(
+ choice_set_key, choice_primary_key, kInsertChoiceArray)) {
+ LOG4CXX_INFO(logger_, "Problem with insertion data to choiceArray table");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_, "Choice data were saved to DB successfully");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertVrCommands(
+ const int64_t primary_key,
+ const smart_objects::SmartObject& vr_commands_array,
+ AccessoryVRCommand value) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery insert_vr_command(db());
+
+ if (!insert_vr_command.Prepare(kInsertVrCommand)) {
+ LOG4CXX_WARN(logger_, "Incorrect preparation insert_vr_command query");
+ return false;
+ }
+ size_t length_vr_commands = vr_commands_array.length();
+
+ /* Positions of binding data for "insert_vr_command":
+ field "vrCommand" from table "vrCommandsArray" = 0
+ field "idcommand" from table "vrCommandsArray" = 1
+ field "idchoice" from table "vrCommandsArray" = 2*/
+ for (size_t i = 0; i < length_vr_commands; ++i) {
+ insert_vr_command.Bind(0, vr_commands_array[i].asString());
+ if (AccessoryVRCommand::kVRCommandFromCommand == value) {
+ insert_vr_command.Bind(1, primary_key);
+ insert_vr_command.Bind(2);
+ } else if (AccessoryVRCommand::kVRCommandFromChoice == value) {
+ insert_vr_command.Bind(1);
+ insert_vr_command.Bind(2, primary_key);
+ }
+ if (!insert_vr_command.Exec() || !insert_vr_command.Reset()) {
+ LOG4CXX_WARN(logger_, "Problem with insert vr_command to DB");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_, "Insertion of Vr command were executed successfully");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertDataToArray(
+ int64_t first_primary_key,
+ int64_t second_primary_key,
+ const std::string& text_query) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ bool result;
+ utils::dbms::SQLQuery query_insert_array(db());
+ result = query_insert_array.Prepare(text_query);
+ if (result) {
+ query_insert_array.Bind(0, first_primary_key);
+ query_insert_array.Bind(1, second_primary_key);
+ result = query_insert_array.Exec();
+ }
+ return result;
+}
+
+bool ResumptionDataDB::SaveApplicationToDB(
+ app_mngr::ApplicationSharedPtr application,
+ const std::string& policy_app_id,
+ const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ int64_t application_primary_key = 0;
+ int64_t global_properties_key = 0;
+ db_->BeginTransaction();
+ if (!InsertGlobalPropertiesData(GetApplicationGlobalProperties(application),
+ global_properties_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert globalProperties data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ ApplicationParams app(application);
+ if (!InsertApplicationData(app,
+ policy_app_id,
+ device_id,
+ &application_primary_key,
+ global_properties_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert application data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertFilesData(GetApplicationFiles(application),
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert file data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+
+ if (!InsertSubMenuData(GetApplicationSubMenus(application),
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert submenu data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertCommandsData(GetApplicationCommands(application),
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert commands data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertSubscriptionsData(GetApplicationSubscriptions(application),
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert subscribtions data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertChoiceSetData(GetApplicationInteractionChoiseSets(application),
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert choiceset data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ db_->CommitTransaction();
+ return true;
+}
+
+bool ResumptionDataDB::SaveApplicationToDB(
+ const smart_objects::SmartObject& application,
+ const std::string& policy_app_id,
+ const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ int64_t application_primary_key = 0;
+ int64_t global_properties_key = 0;
+ db_->BeginTransaction();
+ if (!InsertGlobalPropertiesData(application["globalProperties"],
+ global_properties_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert globalProperties data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertApplicationData(application,
+ policy_app_id,
+ device_id,
+ &application_primary_key,
+ global_properties_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert application data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertFilesData(application["applicationFiles"],
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert file data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+
+ if (!InsertSubMenuData(application["applicationSubMenus"],
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert submenu data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertCommandsData(application["applicationCommands"],
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert commands data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertSubscriptionsData(application["subscribtions"],
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert subscribtions data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ if (!InsertChoiceSetData(application["applicationChoiceSets"],
+ application_primary_key)) {
+ LOG4CXX_WARN(logger_, "Incorrect insert choiceset data to DB.");
+ db_->RollbackTransaction();
+ return false;
+ }
+ db_->CommitTransaction();
+ return true;
+}
+
+bool ResumptionDataDB::InsertFilesData(const smart_objects::SmartObject& files,
+ int64_t application_primary_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ const size_t length_files_array = files.length();
+ if (0 == length_files_array) {
+ LOG4CXX_INFO(logger_, "Application doesn't contain files");
+ return true;
+ }
+
+ utils::dbms::SQLQuery query_insert_file(db());
+
+ if (!query_insert_file.Prepare(kInsertToFile)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification queries for insertion files");
+ return false;
+ }
+ /* Positions of binding data for "query_insert_file":
+ field "fileType" from table "file" = 0
+ field "is_download_complete" from table "file" = 1
+ field "persistentFile" from table "file" = 2
+ field "syncFileName" from table "file" = 3*/
+ for (size_t i = 0; i < length_files_array; ++i) {
+ query_insert_file.Bind(0, (files[i][strings::file_type]).asInt());
+ query_insert_file.Bind(1,
+ (files[i][strings::is_download_complete]).asBool());
+ query_insert_file.Bind(2, (files[i][strings::persistent_file]).asBool());
+ query_insert_file.Bind(3, (files[i][strings::sync_file_name]).asString());
+
+ if (!query_insert_file.Exec()) {
+ LOG4CXX_WARN(logger_, "Incorrect insertion of files data");
+ return false;
+ }
+
+ if ((!ExecInsertDataToArray(application_primary_key,
+ query_insert_file.LastInsertId(),
+ kInsertToApplicationFilesArray)) ||
+ !query_insert_file.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insertion to application files array");
+ return false;
+ }
+ }
+
+ LOG4CXX_INFO(logger_, "Files data were inserted successfully to DB");
+ return true;
+}
+
+bool ResumptionDataDB::InsertSubMenuData(
+ const smart_objects::SmartObject& submenus,
+ int64_t application_primary_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ const size_t length_submenu_array = submenus.length();
+ if (0 == length_submenu_array) {
+ LOG4CXX_INFO(logger_, "Application doesn't contain submenu");
+ return true;
+ }
+ utils::dbms::SQLQuery query_insert_submenu(db());
+
+ if (!query_insert_submenu.Prepare(kInsertToSubMenu)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification queries for insertion submenu");
+ return false;
+ }
+ /* Positions of binding data for "query_insert_submenu":
+ field "menuID" from table "submenu" = 0
+ field "menuName" from table "submenu" = 1
+ field "position" from table "submenu" = 2*/
+ for (size_t i = 0; i < length_submenu_array; ++i) {
+ query_insert_submenu.Bind(0, (submenus[i][strings::menu_id]).asInt());
+ query_insert_submenu.Bind(1, (submenus[i][strings::menu_name]).asString());
+ CustomBind(strings::position, submenus[i], query_insert_submenu, 2);
+
+ if (!query_insert_submenu.Exec()) {
+ LOG4CXX_WARN(logger_, "Incorrect insertion of submenu data");
+ return false;
+ }
+
+ if ((!ExecInsertDataToArray(application_primary_key,
+ query_insert_submenu.LastInsertId(),
+ kInsertToApplicationSubMenuArray)) ||
+ !query_insert_submenu.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insertion to application submenu array");
+ return false;
+ }
+ }
+
+ LOG4CXX_INFO(logger_, "Data about submenu were inserted successfully to DB");
+ return true;
+}
+
+bool ResumptionDataDB::InsertCommandsData(
+ const smart_objects::SmartObject& commands,
+ int64_t application_primary_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ const size_t length_command_array = commands.length();
+ if (0 == length_command_array) {
+ LOG4CXX_INFO(logger_, "Application doesn't contain command");
+ return true;
+ }
+ utils::dbms::SQLQuery query_insert_command(db());
+ int64_t image_primary_key = 0;
+ int64_t command_primary_key = 0;
+
+ if (!query_insert_command.Prepare(kInsertToCommand)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification queries for insertion commands");
+ return false;
+ }
+ /* Positions of binding data for "query_insert_command":
+ field "cmdID" from table "command" = 0
+ field "idimage" from table "command" = 1
+ field "menuName" from table "command" = 2
+ field "parentID" from table "command" = 3
+ field "position" from table "command" = 4*/
+ for (size_t i = 0; i < length_command_array; ++i) {
+ query_insert_command.Bind(0, commands[i][strings::cmd_id].asInt());
+ if (commands[i].keyExists(strings::cmd_icon)) {
+ if (!ExecInsertImage(image_primary_key, commands[i][strings::cmd_icon])) {
+ LOG4CXX_WARN(logger_, "Problem with insert command image to DB");
+ return false;
+ }
+ query_insert_command.Bind(1, image_primary_key);
+ } else {
+ query_insert_command.Bind(1);
+ }
+
+ if (commands[i].keyExists(strings::menu_params)) {
+ const SmartObject& menu_params = commands[i][strings::menu_params];
+ query_insert_command.Bind(2, menu_params[strings::menu_name].asString());
+
+ CustomBind(hmi_request::parent_id, menu_params, query_insert_command, 3);
+ CustomBind(strings::position, menu_params, query_insert_command, 4);
+ } else {
+ query_insert_command.Bind(2);
+ query_insert_command.Bind(3);
+ query_insert_command.Bind(4);
+ }
+ if (!query_insert_command.Exec()) {
+ LOG4CXX_WARN(logger_, "Incorrect insertion of command data to DB");
+ return false;
+ }
+ command_primary_key = query_insert_command.LastInsertId();
+ if (commands[i].keyExists(strings::vr_commands)) {
+ if (!ExecInsertVrCommands(command_primary_key,
+ commands[i][strings::vr_commands],
+ kVRCommandFromCommand)) {
+ return false;
+ }
+ }
+ if ((!ExecInsertDataToArray(application_primary_key,
+ command_primary_key,
+ kInsertApplicationCommandArray)) ||
+ !query_insert_command.Reset()) {
+ LOG4CXX_WARN(logger_,
+ "Incorrect insertion to application commands array");
+ return false;
+ }
+ }
+ return true;
+}
+
+bool ResumptionDataDB::InsertSubscriptionsData(
+ const smart_objects::SmartObject& subscriptions,
+ int64_t application_primary_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+
+ if (subscriptions.empty()) {
+ LOG4CXX_INFO(logger_, "Application doesn't contain subscriptions");
+ return true;
+ }
+ const SmartObject& btn_sub = subscriptions[strings::application_buttons];
+ const SmartObject& vi_sub = subscriptions[strings::application_vehicle_info];
+ size_t btn_sub_length = btn_sub.length();
+ size_t vi_sub_length = vi_sub.length();
+ size_t max_length =
+ (btn_sub_length > vi_sub_length) ? btn_sub_length : vi_sub_length;
+
+ utils::dbms::SQLQuery insert_subscriptions(db());
+ if (!insert_subscriptions.Prepare(kInsertSubscriptions)) {
+ LOG4CXX_WARN(
+ logger_,
+ "Problem with verification queries for insertion subscriptions");
+ return false;
+ }
+ /* Positions of binding data for "insert_subscriptions":
+ field "idApplication" from table "applicationSubscribtionsArray" = 0
+ field "vehicleValue" from table "applicationSubscribtionsArray" = 1
+ field "ButtonNameValue" from table "applicationSubscribtionsArray" = 2*/
+ for (size_t i = 0; i < max_length; ++i) {
+ insert_subscriptions.Bind(0, application_primary_key);
+ if (i < vi_sub_length) {
+ insert_subscriptions.Bind(1, vi_sub[i].asInt());
+ } else {
+ insert_subscriptions.Bind(1);
+ }
+ if (i < btn_sub_length) {
+ insert_subscriptions.Bind(2, btn_sub[i].asInt());
+ } else {
+ insert_subscriptions.Bind(2);
+ }
+ if (!insert_subscriptions.Exec() || !insert_subscriptions.Reset()) {
+ LOG4CXX_WARN(logger_, "Incorrect insertion of buttons to subscriptions");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_, "Subscriptions data were saved successfully");
+ return true;
+}
+
+bool ResumptionDataDB::InsertChoiceSetData(
+ const smart_objects::SmartObject& choicesets,
+ int64_t application_primary_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+
+ if (choicesets.empty()) {
+ LOG4CXX_INFO(logger_, "Application doesn't contain choiceSet");
+ return true;
+ }
+ int64_t choice_set_key = 0;
+ size_t length_choceset_array = choicesets.length();
+ for (size_t i = 0; i < length_choceset_array; ++i) {
+ if (!ExecInsertApplicationChoiceSet(choice_set_key, choicesets[i])) {
+ return false;
+ }
+
+ if (!ExecInsertChoice(choice_set_key, choicesets[i][strings::choice_set])) {
+ return false;
+ }
+
+ if (!ExecInsertDataToArray(choice_set_key,
+ application_primary_key,
+ kInsertApplicationChoiceSetArray)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insertion data to"
+ " applicationChoiceSetArray table");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_, "Choice set data were saved to DB successfully");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertApplicationChoiceSet(
+ int64_t& choice_set_primary_key,
+ const smart_objects::SmartObject& choiceset) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+
+ utils::dbms::SQLQuery insert_application_choice_set(db());
+ if (!insert_application_choice_set.Prepare(kInsertApplicationChoiceSet)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with preparation insert "
+ "application choice set query");
+ return false;
+ }
+ /* Positions of binding data for "insert_application_choice_set":
+ field "grammarID" from table "applicationChoiceSet" = 0
+ field "interactionChoiceSetID" from table "applicationChoiceSet" = 1*/
+ insert_application_choice_set.Bind(
+ 0, static_cast<int64_t>(choiceset[strings::grammar_id].asUInt()));
+ insert_application_choice_set.Bind(
+ 1, choiceset[strings::interaction_choice_set_id].asInt());
+
+ if (!insert_application_choice_set.Exec()) {
+ LOG4CXX_WARN(logger_,
+ "Problem with execution insert application choice set query");
+ return false;
+ }
+ choice_set_primary_key = insert_application_choice_set.LastInsertId();
+ LOG4CXX_INFO(logger_, "Application choice data were saved successfully");
+ return true;
+}
+
+bool ResumptionDataDB::InsertGlobalPropertiesData(
+ const smart_objects::SmartObject& global_properties,
+ int64_t& global_properties_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ SmartMap::iterator it_begin = global_properties.map_begin();
+ SmartMap::iterator it_end = global_properties.map_end();
+ bool data_exists = false;
+ while (it_begin != it_end) {
+ if (SmartType::SmartType_Null != ((it_begin->second).getType())) {
+ LOG4CXX_INFO(logger_, "Global properties contains - " << it_begin->first);
+ data_exists = true;
+ break;
+ }
+ ++it_begin;
+ }
+ if (!data_exists) {
+ LOG4CXX_INFO(logger_, "Application doesn't contain global properties");
+ return true;
+ }
+
+ utils::dbms::SQLQuery insert_global_properties(db());
+ if (!insert_global_properties.Prepare(kInsertGlobalProperties)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with preparation query "
+ "insert_global_properties");
+ return false;
+ }
+ /* Positions of binding data for "insert_global_properties":
+ field "vrHelpTitle" from table "globalProperties" = 0
+ field "menuTitle" from table "globalProperties" = 1
+ field "idmenuIcon" from table "globalProperties" = 2
+ field "language" from table "globalProperties" = 3
+ field "keyboardLayout" from table "globalProperties" = 4
+ field "keypressMode" from table "globalProperties" = 5
+ field "autoCompleteText" from table "globalProperties" = 6*/
+
+ CustomBind(
+ strings::vr_help_title, global_properties, insert_global_properties, 0);
+ CustomBind(
+ strings::menu_title, global_properties, insert_global_properties, 1);
+
+ if (SmartType::SmartType_Null ==
+ global_properties[strings::menu_icon].getType()) {
+ insert_global_properties.Bind(2);
+ } else {
+ int64_t image_key = 0;
+ if (ExecInsertImage(image_key, global_properties[strings::menu_icon])) {
+ insert_global_properties.Bind(2, image_key);
+ } else {
+ LOG4CXX_WARN(logger_, "Problem with insert image to global properties");
+ return false;
+ }
+ }
+
+ if (SmartType::SmartType_Null ==
+ global_properties[strings::keyboard_properties].getType()) {
+ insert_global_properties.Bind(3);
+ insert_global_properties.Bind(4);
+ insert_global_properties.Bind(5);
+ insert_global_properties.Bind(6);
+ } else {
+ const SmartObject& kb_prop =
+ global_properties[strings::keyboard_properties];
+
+ CustomBind(strings::language, kb_prop, insert_global_properties, 3);
+ CustomBind(
+ hmi_request::keyboard_layout, kb_prop, insert_global_properties, 4);
+ CustomBind(strings::key_press_mode, kb_prop, insert_global_properties, 5);
+ CustomBind(
+ strings::auto_complete_text, kb_prop, insert_global_properties, 6);
+ }
+ if (!insert_global_properties.Exec()) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insert data to global properties table");
+ return false;
+ }
+
+ global_properties_key = insert_global_properties.LastInsertId();
+ if ((SmartType::SmartType_Null !=
+ global_properties[strings::keyboard_properties].getType()) &&
+ (global_properties[strings::keyboard_properties].keyExists(
+ strings::limited_character_list))) {
+ if (!ExecInsertLimitedCharacters(
+ global_properties_key,
+ global_properties[strings::keyboard_properties]
+ [strings::limited_character_list])) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insert data to limited_character table");
+ return false;
+ }
+ }
+
+ if (SmartType::SmartType_Null !=
+ global_properties[strings::vr_help].getType()) {
+ if (!ExecInsertVRHelpItem(global_properties_key,
+ global_properties[strings::vr_help])) {
+ LOG4CXX_WARN(logger_, "Problem with insert data to vrHelpItem table");
+ return false;
+ }
+ }
+
+ if (!ExecInsertHelpTimeoutArray(global_properties, global_properties_key)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insert data to HelpTimeoutPromptArray table");
+ return false;
+ }
+
+ LOG4CXX_INFO(logger_, "Global properties data were saved successfully");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertHelpTimeoutArray(
+ const smart_objects::SmartObject& global_properties,
+ int64_t global_properties_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ using namespace smart_objects;
+ size_t timeout_prompt_length = 0;
+ size_t help_prompt_length = 0;
+
+ if (SmartType::SmartType_Null !=
+ global_properties[strings::help_prompt].getType()) {
+ help_prompt_length = global_properties[strings::help_prompt].length();
+ }
+
+ if (SmartType::SmartType_Null !=
+ global_properties[strings::timeout_prompt].getType()) {
+ timeout_prompt_length = global_properties[strings::timeout_prompt].length();
+ }
+ if (0 == timeout_prompt_length && 0 == help_prompt_length) {
+ LOG4CXX_INFO(logger_,
+ "Application doesn't HelpPrompt and timoutPrompt data");
+ return true;
+ }
+
+ utils::dbms::SQLQuery insert_help_prompt_array(db());
+
+ if (!insert_help_prompt_array.Prepare(kInsertHelpTimeoutPromptArray)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification query insert_help_prompt_array");
+ return false;
+ }
+ int64_t tts_chunk_key = 0;
+
+ size_t max_length = (timeout_prompt_length > help_prompt_length)
+ ? timeout_prompt_length
+ : help_prompt_length;
+ /* Positions of binding data for "insert_help_prompt_array":
+ field "idglobalProperties" from table "helpTimeoutPromptArray" = 0
+ field "idtimeoutPrompt" from table "helpTimeoutPromptArray" = 1
+ field "idhelpPrompt" from table "helpTimeoutPromptArray" = 2*/
+ for (size_t i = 0; i < max_length; ++i) {
+ insert_help_prompt_array.Bind(0, global_properties_key);
+ if (i < timeout_prompt_length) {
+ if (!ExecInsertTTSChunks(global_properties[strings::timeout_prompt][i],
+ tts_chunk_key)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insertion timeoutPrompt's ttsChunk");
+ return false;
+ }
+ insert_help_prompt_array.Bind(1, tts_chunk_key);
+ } else {
+ insert_help_prompt_array.Bind(1);
+ }
+
+ if (i < help_prompt_length) {
+ if (!ExecInsertTTSChunks(global_properties[strings::help_prompt][i],
+ tts_chunk_key)) {
+ LOG4CXX_WARN(logger_, "Problem with insertion helpPrompt's ttsChunk");
+ return false;
+ }
+ insert_help_prompt_array.Bind(2, tts_chunk_key);
+ } else {
+ insert_help_prompt_array.Bind(2);
+ }
+ if (!insert_help_prompt_array.Exec() || !insert_help_prompt_array.Reset()) {
+ LOG4CXX_WARN(
+ logger_,
+ "Problem with execution or resetting insert_help_prompt_array query");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_, "Data were saved to helpTimeoutPromptArray table");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertTTSChunks(
+ const smart_objects::SmartObject& tts_chunk, int64_t& tts_chunk_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery insert_tts_chunk(db());
+ if (!insert_tts_chunk.Prepare(kInsertTTSChunk)) {
+ LOG4CXX_WARN(logger_, "Problem with verification insert_tts_chunk query");
+ return false;
+ }
+ /* Positions of binding data for "insert_tts_chunk":
+ field "type" from table "TTSChunk" = 0
+ field "text" from table "TTSChunk" = 1*/
+ insert_tts_chunk.Bind(0, tts_chunk[strings::type].asInt());
+ insert_tts_chunk.Bind(1, tts_chunk[strings::text].asString());
+ if (!insert_tts_chunk.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution insert_tts_chunk query");
+ return false;
+ }
+ tts_chunk_key = insert_tts_chunk.LastInsertId();
+ LOG4CXX_WARN(logger_, "TTSChunk was saved successfully");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertLimitedCharacters(
+ int64_t global_properties_key,
+ const smart_objects::SmartObject& characters_array) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery insert_characters(db());
+ if (!insert_characters.Prepare(kInsertTableLimitedCharacter)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with preparation query "
+ "insert_characters");
+ return false;
+ }
+ size_t length_characters_array = characters_array.length();
+ /* Positions of binding data for "insert_characters":
+ field "limitedCharacterList" from table "tableLimitedCharacterList" = 0*/
+ for (size_t i = 0; i < length_characters_array; ++i) {
+ insert_characters.Bind(0, characters_array[i].asString());
+
+ if (!insert_characters.Exec()) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insert data to limited_character table");
+ return false;
+ }
+ if ((!ExecInsertDataToArray(global_properties_key,
+ insert_characters.LastInsertId(),
+ kInsertCharacterArray)) ||
+ (!insert_characters.Reset())) {
+ LOG4CXX_WARN(logger_, "Problem with insert data to characterArray table");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_,
+ "Data were saved successfully to limited_character table");
+ return true;
+}
+
+bool ResumptionDataDB::ExecInsertVRHelpItem(
+ int64_t global_properties_key,
+ const smart_objects::SmartObject& vrhelp_array) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery insert_vrhelp_item(db());
+ if (!insert_vrhelp_item.Prepare(kInsertVRHelpItem)) {
+ LOG4CXX_WARN(logger_, "Problem with preparation query insert_vrhelp_item");
+ return false;
+ }
+ int64_t image_primary_key = 0;
+ size_t length_vrhelp_array = vrhelp_array.length();
+ /* Positions of binding data for "insert_vrhelp_item":
+ field "text" from table "vrHelpItem" = 0
+ field "position" from table "vrHelpItem" = 1
+ field "idimage" from table "vrHelpItem" = 2*/
+ for (size_t i = 0; i < length_vrhelp_array; ++i) {
+ insert_vrhelp_item.Bind(0, vrhelp_array[i][strings::text].asString());
+ insert_vrhelp_item.Bind(1, vrhelp_array[i][strings::position].asInt());
+ if (vrhelp_array[i].keyExists(strings::image)) {
+ if (!ExecInsertImage(image_primary_key,
+ vrhelp_array[i][strings::image])) {
+ LOG4CXX_INFO(logger_, "Problem with insert image to vrHelpItem table");
+ return false;
+ }
+ insert_vrhelp_item.Bind(2, image_primary_key);
+ } else {
+ insert_vrhelp_item.Bind(2);
+ }
+
+ if (!insert_vrhelp_item.Exec()) {
+ LOG4CXX_INFO(logger_, "Problem with insert data vrHelpItem table");
+ return false;
+ }
+
+ if ((!ExecInsertDataToArray(global_properties_key,
+ insert_vrhelp_item.LastInsertId(),
+ kInsertVRHelpItemArray)) ||
+ (!insert_vrhelp_item.Reset())) {
+ LOG4CXX_WARN(logger_,
+ "Problem with insert data to vrHelpItemArray table");
+ return false;
+ }
+ }
+ LOG4CXX_INFO(logger_,
+ "Data were saved successfully to vrHelpItem array table");
+ return true;
+}
+
+bool ResumptionDataDB::InsertApplicationData(
+ app_mngr::ApplicationSharedPtr application,
+ const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ ApplicationParams app(application);
+ return InsertApplicationData(app, policy_app_id, device_id, NULL, 0);
+}
+
+bool ResumptionDataDB::InsertApplicationData(
+ const ApplicationParams& application,
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ int64_t* application_primary_key,
+ int64_t global_properties_key) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery query(db());
+
+ if (!application.m_is_valid) {
+ LOG4CXX_ERROR(logger_, "Invalid application params passed.");
+ return false;
+ }
+
+ const std::string hash = application.m_hash;
+ const int64_t grammar_id = application.m_grammar_id;
+ const int64_t time_stamp = static_cast<int64_t>(time(NULL));
+ const int64_t connection_key = application.m_connection_key;
+ const int64_t hmi_app_id = application.m_hmi_app_id;
+ const mobile_apis::HMILevel::eType hmi_level = application.m_hmi_level;
+ bool is_media_application = application.m_is_media_application;
+
+ if (!query.Prepare(kInsertApplication)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification query "
+ "for insert to table application");
+ return false;
+ }
+
+ /* Positions of binding data for "query":
+ field "connection_key" from table "application" = 0
+ field "grammarID" from table "application" = 1
+ field "hashID" from table "application" = 2
+ field "hmiAppID" from table "application" = 3
+ field "hmiLevel" from table "application" = 4
+ field "ign_off_count" from table "application" = 5
+ field "suspend_count" from table "application" = 6
+ field "timeStamp" from table "application" = 7
+ field "idglobalProperties" from table "application" = 8
+ field "isMediaApplication" from table "application" = 9
+ field "appID" from table "application" = 10
+ field "deviceID" from table "application" = 11*/
+ query.Bind(0, connection_key);
+ query.Bind(1, grammar_id);
+ query.Bind(2, hash);
+ query.Bind(3, hmi_app_id);
+ query.Bind(4, static_cast<int32_t>(hmi_level));
+ query.Bind(5, 0);
+ query.Bind(6, 0);
+ query.Bind(7, time_stamp);
+ if (global_properties_key) {
+ query.Bind(8, global_properties_key);
+ } else {
+ query.Bind(8);
+ }
+ query.Bind(9, is_media_application);
+ query.Bind(10, policy_app_id);
+ query.Bind(11, device_id);
+
+ if (!query.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution query");
+ return false;
+ }
+ if (NULL != application_primary_key) {
+ *application_primary_key = query.LastInsertId();
+ }
+ LOG4CXX_INFO(logger_, "Data were saved successfully to application table");
+ return true;
+}
+
+void ResumptionDataDB::CustomBind(const std::string& key,
+ const smart_objects::SmartObject& so,
+ utils::dbms::SQLQuery& query,
+ const int pos) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace smart_objects;
+ if (so.keyExists(key) && SmartType::SmartType_Null != so[key].getType()) {
+ switch (so[key].getType()) {
+ case SmartType::SmartType_Integer: {
+ query.Bind(pos, so[key].asInt());
+ break;
+ }
+ case SmartType::SmartType_String: {
+ query.Bind(pos, so[key].asString());
+ break;
+ }
+ default: {
+ LOG4CXX_WARN(logger_, "Incorrect type");
+ break;
+ }
+ }
+ } else {
+ query.Bind(pos);
+ }
+}
+
+bool ResumptionDataDB::PrepareSelectQuery(utils::dbms::SQLQuery& query,
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ const std::string& text_query) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!query.Prepare(text_query)) {
+ LOG4CXX_WARN(logger_, "Problem with verification query");
+ return false;
+ }
+ query.Bind(0, policy_app_id);
+ query.Bind(1, device_id);
+ return true;
+}
+
+void ResumptionDataDB::UpdateDataOnAwake() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ utils::dbms::SQLQuery query(db());
+ if (query.Prepare(kUpdateIgnOffCount)) {
+ if (query.Exec()) {
+ LOG4CXX_INFO(logger_,
+ "Values of ignition off counts were updated successfully");
+ WriteDb();
+ }
+ }
+}
+
+bool ResumptionDataDB::UpdateApplicationData(
+ app_mngr::ApplicationConstSharedPtr application,
+ const std::string& policy_app_id,
+ const std::string& device_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery query(db());
+
+ const int64_t time_stamp = static_cast<int64_t>(time(NULL));
+ const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+
+ if (!query.Prepare(kUpdateApplicationData)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification query "
+ "for updating some application data");
+ return false;
+ }
+
+ /* Positions of binding data for "query":
+ field "hmiLevel" from table "application" = 0
+ field "timeStamp" from table "application" = 1
+ field "appID" from table "application" = 2
+ field "deviceID" from table "application" = 3*/
+ query.Bind(0, static_cast<int32_t>(hmi_level));
+ query.Bind(1, time_stamp);
+ query.Bind(2, policy_app_id);
+ query.Bind(3, device_id);
+
+ if (!query.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution query");
+ return false;
+ }
+ LOG4CXX_INFO(logger_, "Data were updated successfully in application table");
+ return true;
+}
+
+void ResumptionDataDB::WriteDb() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ db_->Backup();
+}
+
+bool ResumptionDataDB::UpdateGrammarID(const std::string& policy_app_id,
+ const std::string& device_id,
+ const uint32_t grammar_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ utils::dbms::SQLQuery query(db());
+
+ if (!query.Prepare(kUpdateGrammarID)) {
+ LOG4CXX_WARN(logger_,
+ "Problem with verification query for updating grammar id.");
+ return false;
+ }
+
+ // Positions of binding data for "query":
+ // field "grammarID" from table "application" = 0
+ // field "appID" from table "application" = 1
+ // field "deviceID" from table "application" = 2
+ query.Bind(0, static_cast<int32_t>(grammar_id));
+ query.Bind(1, policy_app_id);
+ query.Bind(2, device_id);
+
+ if (!query.Exec()) {
+ LOG4CXX_WARN(logger_, "Problem with execution query");
+ return false;
+ }
+ LOG4CXX_INFO(logger_, "Data were updated successfully in application table");
+ return true;
+}
+
+utils::dbms::SQLDatabase* ResumptionDataDB::db() const {
+#ifdef __QNX__
+ utils::dbms::SQLDatabase* db = new utils::dbms::SQLDatabase(kDatabaseName);
+ db->Open();
+ return db;
+#else
+ return db_;
+#endif
+}
+
+ApplicationParams::ApplicationParams(
+ const smart_objects::SmartObject& application)
+ : m_hash()
+ , m_grammar_id(0)
+ , m_connection_key(0)
+ , m_hmi_app_id(0)
+ , m_hmi_level(mobile_apis::HMILevel::INVALID_ENUM)
+ , m_is_media_application(false)
+ , m_is_valid(false) {
+ using namespace app_mngr::strings;
+ if (!application.keyExists(app_id) || !application.keyExists(hash_id) ||
+ !application.keyExists(grammar_id) ||
+ !application.keyExists(connection_key) ||
+ !application.keyExists(hmi_app_id) || !application.keyExists(hmi_level) ||
+ !application.keyExists(is_media_application)) {
+ return;
+ }
+ m_is_valid = true;
+ m_hash = application[hash_id].asString();
+ m_grammar_id = application[grammar_id].asInt();
+ m_connection_key = application[connection_key].asInt();
+ m_hmi_app_id = application[hmi_app_id].asInt();
+ m_hmi_level =
+ static_cast<mobile_apis::HMILevel::eType>(application[hmi_level].asInt());
+ m_is_media_application = application[is_media_application].asBool();
+}
+
+ApplicationParams::ApplicationParams(app_mngr::ApplicationSharedPtr application)
+ : m_hash()
+ , m_grammar_id(0)
+ , m_connection_key(0)
+ , m_hmi_app_id(0)
+ , m_hmi_level(mobile_apis::HMILevel::INVALID_ENUM)
+ , m_is_media_application(false)
+ , m_is_valid(false) {
+ if (application) {
+ m_is_valid = true;
+ m_hash = application->curHash();
+ m_grammar_id = application->get_grammar_id();
+ m_connection_key = application->app_id();
+ m_hmi_app_id = application->hmi_app_id();
+ m_hmi_level = application->hmi_level();
+ m_is_media_application = application->IsAudioApplication();
+ }
+}
+
+} // namespace resumption
diff --git a/src/components/application_manager/src/resumption/resumption_data_json.cc b/src/components/application_manager/src/resumption/resumption_data_json.cc
new file mode 100644
index 0000000000..919f7c051c
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_data_json.cc
@@ -0,0 +1,519 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/resumption/resumption_data_json.h"
+#include "smart_objects/smart_object.h"
+#include "json/json.h"
+#include "formatters/CFormatterJsonBase.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/smart_object_keys.h"
+#include "resumption/last_state.h"
+#include "config_profile/profile.h"
+
+namespace resumption {
+
+namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
+
+ResumptionDataJson::ResumptionDataJson() : ResumptionData() {}
+
+void ResumptionDataJson::SaveApplication(
+ app_mngr::ApplicationSharedPtr application) {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(application);
+
+ const std::string& policy_app_id = application->mobile_app_id();
+ LOG4CXX_DEBUG(logger_,
+ "app_id : " << application->app_id() << " policy_app_id : "
+ << policy_app_id);
+ const std::string hash = application->curHash();
+ const uint32_t grammar_id = application->get_grammar_id();
+ const uint32_t time_stamp = (uint32_t)time(NULL);
+ const std::string device_mac = application->mac_address();
+ const mobile_apis::HMILevel::eType hmi_level = application->hmi_level();
+
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value tmp;
+ Json::Value& json_app = GetFromSavedOrAppend(policy_app_id, device_mac);
+
+ json_app[strings::device_id] = device_mac;
+ json_app[strings::app_id] = policy_app_id;
+ json_app[strings::grammar_id] = grammar_id;
+ json_app[strings::connection_key] = application->app_id();
+ json_app[strings::hmi_app_id] = application->hmi_app_id();
+ json_app[strings::is_media_application] = application->IsAudioApplication();
+ json_app[strings::hmi_level] = static_cast<int32_t>(hmi_level);
+ json_app[strings::ign_off_count] = 0;
+ json_app[strings::suspend_count] = 0;
+ json_app[strings::hash_id] = hash;
+ Formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationCommands(application), tmp);
+ json_app[strings::application_commands] = tmp;
+ Formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationSubMenus(application), tmp);
+ json_app[strings::application_submenus] = tmp;
+ Formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationInteractionChoiseSets(application), tmp);
+ json_app[strings::application_choice_sets] = tmp;
+ Formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationGlobalProperties(application), tmp);
+ json_app[strings::application_global_properties] = tmp;
+ Formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationSubscriptions(application), tmp);
+ json_app[strings::application_subscribtions] = tmp;
+ Formatters::CFormatterJsonBase::objToJsonValue(
+ GetApplicationFiles(application), tmp);
+ json_app[strings::application_files] = tmp;
+ json_app[strings::time_stamp] = time_stamp;
+ LOG4CXX_DEBUG(logger_, "SaveApplication : " << json_app.toStyledString());
+}
+
+int32_t ResumptionDataJson::GetStoredHMILevel(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ int idx = GetObjectIndex(policy_app_id, device_id);
+ if (idx != -1) {
+ const Json::Value& json_app = GetSavedApplications()[idx];
+ if (json_app.isMember(strings::hmi_level)) {
+ return json_app[strings::hmi_level].asInt();
+ }
+ }
+ LOG4CXX_FATAL(logger_, "There are some unknown keys among the stored apps");
+ return -1;
+}
+
+bool ResumptionDataJson::IsHMIApplicationIdExist(uint32_t hmi_app_id) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ for (Json::Value::iterator it = GetSavedApplications().begin();
+ it != GetSavedApplications().end();
+ ++it) {
+ if ((*it).isMember(strings::hmi_app_id)) {
+ if ((*it)[strings::hmi_app_id].asUInt() == hmi_app_id) {
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+bool ResumptionDataJson::CheckSavedApplication(const std::string& policy_app_id,
+ const std::string& device_id) {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ int index = IsApplicationSaved(policy_app_id, device_id);
+ if (-1 == index) {
+ return false;
+ }
+
+ if (!IsResumptionDataValid(index)) {
+ LOG4CXX_INFO(
+ logger_,
+ "Resumption data for app_id "
+ << policy_app_id
+ << " device id "
+ << device_id
+ << " is corrupted. Remove application from resumption list");
+ RemoveApplicationFromSaved(policy_app_id, device_id);
+ return false;
+ }
+ return true;
+}
+
+uint32_t ResumptionDataJson::GetHMIApplicationID(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ uint32_t hmi_app_id = 0;
+
+ const int idx = GetObjectIndex(policy_app_id, device_id);
+ if (-1 == idx) {
+ LOG4CXX_WARN(logger_, "Application not saved");
+ return hmi_app_id;
+ }
+
+ const Json::Value& json_app = GetSavedApplications()[idx];
+ if (json_app.isMember(strings::app_id) &&
+ json_app.isMember(strings::device_id)) {
+ hmi_app_id = json_app[strings::hmi_app_id].asUInt();
+ }
+ LOG4CXX_DEBUG(logger_, "hmi_app_id :" << hmi_app_id);
+ return hmi_app_id;
+}
+
+void ResumptionDataJson::OnSuspend() {
+ using namespace app_mngr;
+ using namespace profile;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value to_save;
+ for (Json::Value::iterator it = GetSavedApplications().begin();
+ it != GetSavedApplications().end();
+ ++it) {
+ if ((*it).isMember(strings::suspend_count)) {
+ const uint32_t suspend_count = (*it)[strings::suspend_count].asUInt();
+ (*it)[strings::suspend_count] = suspend_count + 1;
+ } else {
+ LOG4CXX_WARN(logger_, "Unknown key among saved applications");
+ (*it)[strings::suspend_count] = 1;
+ }
+ if ((*it).isMember(strings::ign_off_count)) {
+ Json::Value& ign_off_count = (*it)[strings::ign_off_count];
+ const uint32_t counter_value = ign_off_count.asUInt();
+ ign_off_count = counter_value + 1;
+ } else {
+ LOG4CXX_WARN(logger_, "Unknown key among saved applications");
+ Json::Value& ign_off_count = (*it)[strings::ign_off_count];
+ ign_off_count = 1;
+ }
+ to_save.append(*it);
+ }
+ SetSavedApplication(to_save);
+ SetLastIgnOffTime(time(NULL));
+ LOG4CXX_DEBUG(logger_, GetResumptionData().toStyledString());
+ ::resumption::LastState::instance()->SaveToFileSystem();
+}
+
+void ResumptionDataJson::OnAwake() {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+
+ for (Json::Value::iterator it = GetSavedApplications().begin();
+ it != GetSavedApplications().end();
+ ++it) {
+ if ((*it).isMember(strings::ign_off_count)) {
+ const uint32_t ign_off_count = (*it)[strings::ign_off_count].asUInt();
+ (*it)[strings::ign_off_count] = ign_off_count - 1;
+ } else {
+ LOG4CXX_WARN(logger_, "Unknown key among saved applications");
+ (*it)[strings::ign_off_count] = 0;
+ }
+ }
+}
+
+bool ResumptionDataJson::GetHashId(const std::string& policy_app_id,
+ const std::string& device_id,
+ std::string& hash_id) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ const int idx = GetObjectIndex(policy_app_id, device_id);
+ if (-1 == idx) {
+ LOG4CXX_WARN(logger_, "Application not saved");
+ return false;
+ }
+
+ const Json::Value& json_app = GetSavedApplications()[idx];
+ LOG4CXX_DEBUG(logger_,
+ "Saved_application_data: " << json_app.toStyledString());
+ if (json_app.isMember(strings::hash_id) &&
+ json_app.isMember(strings::time_stamp)) {
+ hash_id = json_app[strings::hash_id].asString();
+ return true;
+ }
+ LOG4CXX_WARN(logger_, "There are some unknown keys in the dictionary.");
+ return false;
+}
+
+bool ResumptionDataJson::GetSavedApplication(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ smart_objects::SmartObject& saved_app) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ const int idx = GetObjectIndex(policy_app_id, device_id);
+ if (-1 == idx) {
+ return false;
+ }
+ const Json::Value& json_saved_app = GetSavedApplications()[idx];
+ Formatters::CFormatterJsonBase::jsonValueToObj(json_saved_app, saved_app);
+ return true;
+}
+
+bool ResumptionDataJson::RemoveApplicationFromSaved(
+ const std::string& policy_app_id, const std::string& device_id) {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ bool result = false;
+ std::vector<Json::Value> temp;
+ for (Json::Value::iterator it = GetSavedApplications().begin();
+ it != GetSavedApplications().end();
+ ++it) {
+ if ((*it).isMember(strings::app_id) && (*it).isMember(strings::device_id)) {
+ const std::string& saved_policy_app_id =
+ (*it)[strings::app_id].asString();
+ const std::string& saved_device_id = (*it)[strings::device_id].asString();
+ if (saved_policy_app_id != policy_app_id &&
+ saved_device_id != device_id) {
+ temp.push_back((*it));
+ } else {
+ result = true;
+ }
+ }
+ }
+
+ if (false == result) {
+ LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
+ return result;
+ }
+
+ GetSavedApplications().clear();
+ for (std::vector<Json::Value>::iterator it = temp.begin(); it != temp.end();
+ ++it) {
+ GetSavedApplications().append((*it));
+ }
+ LOG4CXX_TRACE(logger_, "EXIT result: " << (result ? "true" : "false"));
+ return result;
+}
+
+uint32_t ResumptionDataJson::GetIgnOffTime() const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value& resumption = GetResumptionData();
+ if (!resumption.isMember(strings::last_ign_off_time)) {
+ resumption[strings::last_ign_off_time] = 0;
+ LOG4CXX_WARN(logger_, "last_save_time section is missed");
+ }
+ return resumption[strings::last_ign_off_time].asUInt();
+}
+
+ssize_t ResumptionDataJson::IsApplicationSaved(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ return GetObjectIndex(policy_app_id, device_id);
+}
+
+Json::Value& ResumptionDataJson::GetFromSavedOrAppend(
+ const std::string& policy_app_id, const std::string& device_id) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ for (Json::Value::iterator it = GetSavedApplications().begin();
+ it != GetSavedApplications().end();
+ ++it) {
+ if (device_id == (*it)[strings::device_id].asString() &&
+ policy_app_id == (*it)[strings::app_id].asString()) {
+ return *it;
+ }
+ }
+
+ return GetSavedApplications().append(Json::Value());
+}
+
+void ResumptionDataJson::GetDataForLoadResumeData(
+ smart_objects::SmartObject& saved_data) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ smart_objects::SmartObject so_array_data(smart_objects::SmartType_Array);
+ int i = 0;
+ for (Json::Value::iterator it = GetSavedApplications().begin();
+ it != GetSavedApplications().end();
+ ++it) {
+ if (((*it).isMember(strings::hmi_level)) &&
+ ((*it).isMember(strings::ign_off_count)) &&
+ ((*it).isMember(strings::time_stamp)) &&
+ ((*it).isMember(strings::app_id)) &&
+ ((*it).isMember(strings::device_id))) {
+ smart_objects::SmartObject so(smart_objects::SmartType_Map);
+ so[strings::hmi_level] = (*it)[strings::hmi_level].asInt();
+ so[strings::ign_off_count] = (*it)[strings::ign_off_count].asInt();
+ so[strings::time_stamp] = (*it)[strings::time_stamp].asUInt();
+ so[strings::app_id] = (*it)[strings::app_id].asString();
+ so[strings::device_id] = (*it)[strings::device_id].asString();
+ so_array_data[i++] = so;
+ }
+ }
+ saved_data = so_array_data;
+}
+
+ResumptionDataJson::~ResumptionDataJson() {
+ // TODO Probably Save Data on disk
+}
+
+void ResumptionDataJson::UpdateHmiLevel(
+ const std::string& policy_app_id,
+ const std::string& device_id,
+ mobile_apis::HMILevel::eType hmi_level) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+
+ int idx = GetObjectIndex(policy_app_id, device_id);
+ if (-1 == idx) {
+ LOG4CXX_WARN(
+ logger_,
+ "Application isn't saved with mobile_app_id = " << policy_app_id
+ << " device_id = "
+ << device_id);
+ return;
+ }
+ GetSavedApplications()[idx][strings::hmi_level] = hmi_level;
+}
+
+Json::Value& ResumptionDataJson::GetSavedApplications() const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value& resumption = GetResumptionData();
+ if (!resumption.isMember(strings::resume_app_list)) {
+ resumption[strings::resume_app_list] = Json::Value(Json::arrayValue);
+ LOG4CXX_WARN(logger_, "app_list section is missed");
+ }
+ Json::Value& resume_app_list = resumption[strings::resume_app_list];
+ if (!resume_app_list.isArray()) {
+ LOG4CXX_ERROR(logger_, "resume_app_list type INVALID rewrite");
+ resume_app_list = Json::Value(Json::arrayValue);
+ }
+ return resume_app_list;
+}
+
+Json::Value& ResumptionDataJson::GetResumptionData() const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value& last_state = ::resumption::LastState::instance()->dictionary;
+ if (!last_state.isMember(strings::resumption)) {
+ last_state[strings::resumption] = Json::Value(Json::objectValue);
+ LOG4CXX_WARN(logger_, "resumption section is missed");
+ }
+ Json::Value& resumption = last_state[strings::resumption];
+ if (!resumption.isObject()) {
+ LOG4CXX_ERROR(logger_, "resumption type INVALID rewrite");
+ resumption = Json::Value(Json::objectValue);
+ }
+ return resumption;
+}
+
+ssize_t ResumptionDataJson::GetObjectIndex(const std::string& policy_app_id,
+ const std::string& device_id) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ const Json::Value& apps = GetSavedApplications();
+ const Json::ArrayIndex size = apps.size();
+ Json::ArrayIndex idx = 0;
+ for (; idx != size; ++idx) {
+ if (apps[idx].isMember(strings::app_id) &&
+ apps[idx].isMember(strings::device_id)) {
+ const std::string& saved_app_id = apps[idx][strings::app_id].asString();
+ const std::string& saved_device_id =
+ apps[idx][strings::device_id].asString();
+ if (device_id == saved_device_id && policy_app_id == saved_app_id) {
+ LOG4CXX_DEBUG(logger_, "Found " << idx);
+ return idx;
+ }
+ }
+ }
+ return -1;
+}
+
+bool ResumptionDataJson::IsResumptionDataValid(uint32_t index) const {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ const Json::Value& json_app = GetSavedApplications()[index];
+ if (!json_app.isMember(strings::app_id) ||
+ !json_app.isMember(strings::ign_off_count) ||
+ !json_app.isMember(strings::hmi_level) ||
+ !json_app.isMember(strings::hmi_app_id) ||
+ !json_app.isMember(strings::time_stamp) ||
+ !json_app.isMember(strings::device_id)) {
+ LOG4CXX_ERROR(logger_, "Wrong resumption data");
+ return false;
+ }
+
+ if (json_app.isMember(strings::hmi_app_id) &&
+ 0 >= json_app[strings::hmi_app_id].asUInt()) {
+ LOG4CXX_ERROR(logger_, "Wrong resumption hmi app ID");
+ return false;
+ }
+
+ return true;
+}
+
+void ResumptionDataJson::SetSavedApplication(Json::Value& apps_json) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value& app_list = GetSavedApplications();
+ app_list = apps_json;
+}
+
+void ResumptionDataJson::SetLastIgnOffTime(time_t ign_off_time) {
+ using namespace app_mngr;
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ LOG4CXX_WARN(logger_, "ign_off_time = " << ign_off_time);
+ Json::Value& resumption = GetResumptionData();
+ resumption[strings::last_ign_off_time] = static_cast<uint32_t>(ign_off_time);
+}
+
+bool ResumptionDataJson::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return true;
+}
+
+bool ResumptionDataJson::DropAppDataResumption(const std::string& device_id,
+ const std::string& app_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace app_mngr;
+ sync_primitives::AutoLock autolock(resumption_lock_);
+ Json::Value& application = GetFromSavedOrAppend(app_id, device_id);
+ if (application.isNull()) {
+ LOG4CXX_DEBUG(logger_, "Application " << app_id << " with device_id "
+ << device_id << " hasn't been found in resumption data.");
+ return false;
+ }
+ application[strings::application_commands].clear();
+ application[strings::application_submenus].clear();
+ application[strings::application_choice_sets].clear();
+ application[strings::application_global_properties].clear();
+ application[strings::application_subscribtions].clear();
+ application[strings::application_files].clear();
+ application.removeMember(strings::grammar_id);
+ LOG4CXX_DEBUG(logger_, "Resumption data for application " << app_id <<
+ " with device_id " << device_id << " has been dropped.");
+ return true;
+}
+
+
+} // resumption
diff --git a/src/components/application_manager/src/resumption/resumption_sql_queries.cc b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
new file mode 100644
index 0000000000..67970fd0c8
--- /dev/null
+++ b/src/components/application_manager/src/resumption/resumption_sql_queries.cc
@@ -0,0 +1,967 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "application_manager/resumption/resumption_sql_queries.h"
+
+namespace resumption {
+
+const std::string kCreateSchema =
+ "BEGIN ; "
+ "CREATE TABLE IF NOT EXISTS `resumption`( "
+ " `idresumption` INTEGER PRIMARY KEY, "
+ " `last_ign_off_time` INTEGER "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `image`( "
+ " `idimage` INTEGER PRIMARY KEY NOT NULL, "
+ " `imageType` INTEGER, "
+ " `value` TEXT UNIQUE "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `applicationChoiceSet`( "
+ " `idapplicationChoiceSet` INTEGER PRIMARY KEY NOT NULL, "
+ " `grammarID` INTEGER, "
+ " `interactionChoiceSetID` INTEGER "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `file`( "
+ " `idfile` INTEGER PRIMARY KEY NOT NULL, "
+ " `fileType` INTEGER, "
+ " `is_download_complete` BOOL, "
+ " `persistentFile` BOOL, "
+ " `syncFileName` TEXT "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `subMenu`( "
+ " `idsubMenu` INTEGER PRIMARY KEY NOT NULL, "
+ " `menuID` INTEGER, "
+ " `menuName` TEXT, "
+ " `position` INTEGER "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `TTSChunk`( "
+ " `idTTSChunk` INTEGER PRIMARY KEY NOT NULL, "
+ " `type` INTEGER, "
+ " `text` TEXT "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `vrHelpItem`( "
+ " `idvrHelpItem` INTEGER PRIMARY KEY NOT NULL, "
+ " `text` TEXT, "
+ " `position` INTEGER, "
+ " `idimage` INTEGER, "
+ " CONSTRAINT `fk_image` "
+ " FOREIGN KEY(`idimage`) "
+ " REFERENCES `image`(`idimage`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`vrHelpItem.fk_image_idx` ON `vrHelpItem`(`idimage`); "
+ "CREATE TABLE IF NOT EXISTS `tableLimitedCharacterList`( "
+ " `idtableLimitedCharacterList` INTEGER PRIMARY KEY NOT NULL, "
+ " `limitedCharacterList` VARCHAR(45) "
+ " ); "
+ "CREATE TABLE IF NOT EXISTS `characterArray`( "
+ " `idcharacterArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idglobalProperties` INTEGER, "
+ " `idtableLimitedCharacterList` INTEGER, "
+ " CONSTRAINT `fk_globalProperties` "
+ " FOREIGN KEY(`idglobalProperties`) "
+ " REFERENCES `globalProperties`(`idglobalProperties`), "
+ " CONSTRAINT `fk_tableLimitedCharacterList` "
+ " FOREIGN KEY(`idtableLimitedCharacterList`) "
+ " REFERENCES `tableLimitedCharacterList`(`idtableLimitedCharacterList`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`characterArray.fk_globalProperties_idx` "
+ " ON `characterArray`(`idglobalProperties`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`characterArray.fk_tableLimitedCharacterList_idx` "
+ " ON `characterArray`(`idtableLimitedCharacterList`); "
+ "CREATE TABLE IF NOT EXISTS `choice`( "
+ " `idchoice` INTEGER PRIMARY KEY NOT NULL, "
+ " `choiceID` INTEGER, "
+ " `menuName` TEXT, "
+ " `secondaryText` TEXT, "
+ " `tertiaryText` TEXT, "
+ " `idimage` INTEGER, "
+ " `idsecondaryImage` INTEGER, "
+ " CONSTRAINT `fk_image` "
+ " FOREIGN KEY(`idimage`,`idsecondaryImage`) "
+ " REFERENCES `image`(`idimage`,`idimage`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`choice.fk_image_idx` ON `choice`(`idimage`,`idsecondaryImage`); "
+ "CREATE TABLE IF NOT EXISTS `command`( "
+ " `idcommand` INTEGER PRIMARY KEY NOT NULL, "
+ " `cmdID` INTEGER, "
+ " `menuName` TEXT, "
+ " `parentID` INTEGER, "
+ " `position` INTEGER, "
+ " `idimage` INTEGER, "
+ " CONSTRAINT `fk_image` "
+ " FOREIGN KEY(`idimage`) "
+ " REFERENCES `image`(`idimage`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`command.fk_image_idx` ON `command`(`idimage`); "
+ "CREATE TABLE IF NOT EXISTS `globalProperties`( "
+ " `idglobalProperties` INTEGER PRIMARY KEY NOT NULL, "
+ " `vrHelpTitle` TEXT, "
+ " `menuTitle` TEXT, "
+ " `idmenuIcon` INTEGER, "
+ " `language` INTEGER, "
+ " `keyboardLayout` INTEGER, "
+ " `keypressMode` INTEGER, "
+ " `autoCompleteText` TEXT, "
+ " CONSTRAINT `fk_image` "
+ " FOREIGN KEY(`idmenuIcon`) "
+ " REFERENCES `image`(`idimage`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`globalProperties.fk_image_idx` ON `globalProperties`(`idmenuIcon`); "
+ "CREATE TABLE IF NOT EXISTS `choiceArray`( "
+ " `idchoiceArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idapplicationChoiceSet` INTEGER, "
+ " `idchoice` INTEGER, "
+ " CONSTRAINT `fk_applicationChoiceSet` "
+ " FOREIGN KEY(`idapplicationChoiceSet`) "
+ " REFERENCES `applicationChoiceSet`(`idapplicationChoiceSet`), "
+ " CONSTRAINT `fk_choice` "
+ " FOREIGN KEY(`idchoice`) "
+ " REFERENCES `choice`(`idchoice`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`choiceArray.fk_applicationChoiceSet_idx` "
+ " ON `choiceArray`(`idapplicationChoiceSet`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`choiceArray.fk_choice_idx` ON `choiceArray`(`idchoice`); "
+ "CREATE TABLE IF NOT EXISTS `vrCommandsArray`( "
+ " `idvrCommandsArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idchoice` INTEGER, "
+ " `vrCommand` TEXT, "
+ " `idcommand` INTEGER, "
+ " CONSTRAINT `fk_choice` "
+ " FOREIGN KEY(`idchoice`) "
+ " REFERENCES `choice`(`idchoice`), "
+ " CONSTRAINT `fk_command` "
+ " FOREIGN KEY(`idcommand`) "
+ " REFERENCES `command`(`idcommand`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`vrCommandsArray.fk_choice_idx` ON `vrCommandsArray`(`idchoice`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`vrCommandsArray.fk_command_idx` ON `vrCommandsArray`(`idcommand`); "
+ "CREATE TABLE IF NOT EXISTS `helpTimeoutPromptArray`( "
+ " `idhelpTimeoutPromptArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idhelpPrompt` INTEGER, "
+ " `idtimeoutPrompt` INTEGER, "
+ " `idglobalProperties` INTEGER, "
+ " CONSTRAINT `fk_globalProperties` "
+ " FOREIGN KEY(`idglobalProperties`) "
+ " REFERENCES `globalProperties`(`idglobalProperties`), "
+ " CONSTRAINT `fk_TTSChunk` "
+ " FOREIGN KEY(`idtimeoutPrompt`,`idhelpPrompt`) "
+ " REFERENCES `TTSChunk`(`idTTSChunk`,`idTTSChunk`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`helpTimeoutPromptArray.fk_globalProperties_idx` "
+ " ON `helpTimeoutPromptArray`(`idglobalProperties`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`helpTimeoutPromptArray.fk_TTSChunk_idx` "
+ " ON `helpTimeoutPromptArray`(`idtimeoutPrompt`,`idhelpPrompt`); "
+ "CREATE TABLE IF NOT EXISTS `vrHelpItemArray`( "
+ " `idvrHelpItemArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idglobalProperties` INTEGER, "
+ " `idvrHelpItem` INTEGER, "
+ " CONSTRAINT `fk_vrHelpItem` "
+ " FOREIGN KEY(`idvrHelpItem`) "
+ " REFERENCES `vrHelpItem`(`idvrHelpItem`), "
+ " CONSTRAINT `fk_vrglobalProperties` "
+ " FOREIGN KEY(`idglobalProperties`) "
+ " REFERENCES `globalProperties`(`idglobalProperties`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`vrHelpItemArray.fk_vrHelpItem_idx` ON `vrHelpItemArray`(`idvrHelpItem`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`vrHelpItemArray.fk_vrglobalProperties_idx` ON "
+ "`vrHelpItemArray`(`idglobalProperties`); "
+ "CREATE TABLE IF NOT EXISTS `application`( "
+ " `idApplication` INTEGER PRIMARY KEY NOT NULL, "
+ " `appID` TEXT, "
+ " `connection_key` INTEGER, "
+ " `grammarID` INTEGER, "
+ " `hashID` TEXT, "
+ " `hmiAppID` INTEGER, "
+ " `hmiLevel` INTEGER, "
+ " `ign_off_count` INTEGER, "
+ " `timeStamp` INTEGER, "
+ " `deviceID` TEXT, "
+ " `idglobalProperties` INTEGER, "
+ " `isMediaApplication` BOOL, "
+ " CONSTRAINT `fk_globalProperties` "
+ " FOREIGN KEY(`idglobalProperties`) "
+ " REFERENCES `globalProperties`(`idglobalProperties`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`application.fk_globalProperties_idx` ON "
+ "`application`(`idglobalProperties`); "
+ "CREATE TABLE IF NOT EXISTS `applicationChoiceSetArray`( "
+ " `idapplicationChoiceSetArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idapplicationChoiceSet` INTEGER, "
+ " `idApplication` INTEGER, "
+ " CONSTRAINT `fk_applicationChoiceSet` "
+ " FOREIGN KEY(`idapplicationChoiceSet`) "
+ " REFERENCES `applicationChoiceSet`(`idapplicationChoiceSet`), "
+ " CONSTRAINT `fk_Aplication` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationChoiceSetArray.fk_applicationChoiceSet_idx` "
+ " ON `applicationChoiceSetArray`(`idapplicationChoiceSet`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationChoiceSetArray.fk_Aplication_idx` "
+ " ON `applicationChoiceSetArray`(`idApplication`); "
+ "CREATE TABLE IF NOT EXISTS `applicationCommandsArray`( "
+ " `idapplicationCommandsArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idApplication` INTEGER, "
+ " `idcommand` INTEGER, "
+ " CONSTRAINT `fk_Application` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`), "
+ " CONSTRAINT `fk_command` "
+ " FOREIGN KEY(`idcommand`) "
+ " REFERENCES `command`(`idcommand`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationCommandsArray.fk_Application_idx` "
+ " ON `applicationCommandsArray`(`idApplication`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationCommandsArray.fk_command_idx` "
+ " ON `applicationCommandsArray`(`idcommand`); "
+ "CREATE TABLE IF NOT EXISTS `applicationFilesArray`( "
+ " `idapplicationFilesArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idApplication` INTEGER, "
+ " `idfile` INTEGER, "
+ " CONSTRAINT `fk_Application` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`), "
+ " CONSTRAINT `fk_file` "
+ " FOREIGN KEY(`idfile`) "
+ " REFERENCES `file`(`idfile`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationFilesArray.fk_Application_idx` "
+ " ON `applicationFilesArray`(`idApplication`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationFilesArray.fk_file_idx` ON `applicationFilesArray`(`idfile`); "
+ "CREATE TABLE IF NOT EXISTS `applicationSubMenuArray`( "
+ " `idapplicationSubMenuArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `idApplication` INTEGER, "
+ " `idsubMenu` INTEGER, "
+ " CONSTRAINT `fk_subMenu` "
+ " FOREIGN KEY(`idsubMenu`) "
+ " REFERENCES `subMenu`(`idsubMenu`), "
+ " CONSTRAINT `fk_Application` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationSubMenuArray.fk_subMenu_idx` "
+ " ON `applicationSubMenuArray`(`idsubMenu`); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationSubMenuArray.fk_Application_idx` "
+ " ON `applicationSubMenuArray`(`idApplication`); "
+ "CREATE TABLE IF NOT EXISTS `applicationSubscribtionsArray`( "
+ " `idapplicationSubscribtionsArray` INTEGER PRIMARY KEY NOT NULL, "
+ " `vehicleValue` INTEGER, "
+ " `ButtonNameValue` INTEGER, "
+ " `idApplication` INTEGER, "
+ " CONSTRAINT `fk_Application` "
+ " FOREIGN KEY(`idApplication`) "
+ " REFERENCES `application`(`idApplication`) "
+ " ); "
+ "CREATE INDEX IF NOT EXISTS "
+ "`applicationSubscribtionsArray.fk_Application_idx` "
+ " ON `applicationSubscribtionsArray`(`idApplication`); "
+ "CREATE TABLE IF NOT EXISTS `_internal_data`( "
+ " `db_version_hash` INTEGER "
+ " ); "
+ "COMMIT;";
+
+const std::string kDropSchema =
+ "BEGIN; "
+ "DROP INDEX IF EXISTS "
+ "`message.fk_message_consumer_friendly_messages1_idx`; "
+ "DROP TABLE IF EXISTS `resumption`; "
+ "DROP TABLE IF EXISTS `image`; "
+ "DROP TABLE IF EXISTS `applicationChoiceSet`; "
+ "DROP TABLE IF EXISTS `file`; "
+ "DROP TABLE IF EXISTS `subMenu`; "
+ "DROP TABLE IF EXISTS `TTSChunk`; "
+ "DROP TABLE IF EXISTS `vrHelpItem`; "
+ "DROP INDEX IF EXISTS `vrHelpItem.fk_image_idx`; "
+ "DROP TABLE IF EXISTS `tableLimitedCharacterList`; "
+ "DROP TABLE IF EXISTS `characterArray`; "
+ "DROP INDEX IF EXISTS `characterArray.fk_globalProperties_idx`; "
+ "DROP INDEX IF EXISTS `characterArray.fk_tableLimitedCharacterList_idx`; "
+ "DROP TABLE IF EXISTS `choice`; "
+ "DROP INDEX IF EXISTS `choice.fk_image_idx`; "
+ "DROP TABLE IF EXISTS `command`; "
+ "DROP INDEX IF EXISTS `command.fk_image_idx`; "
+ "DROP TABLE IF EXISTS `globalProperties`; "
+ "DROP INDEX IF EXISTS `globalProperties.fk_image_idx`; "
+ "DROP TABLE IF EXISTS `choiceArray`; "
+ "DROP INDEX IF EXISTS `choiceArray.fk_applicationChoiceSet_idx`; "
+ "DROP INDEX IF EXISTS `choiceArray.fk_choice_idx`; "
+ "DROP TABLE IF EXISTS `vrCommandsArray`; "
+ "DROP INDEX IF EXISTS `vrCommandsArray.fk_choice_idx`; "
+ "DROP INDEX IF EXISTS `vrCommandsArray.fk_command_idx`; "
+ "DROP TABLE IF EXISTS `helpTimeoutPromptArray`; "
+ "DROP INDEX IF EXISTS `helpTimeoutPromptArray.fk_globalProperties_idx`; "
+ "DROP INDEX IF EXISTS `helpTimeoutPromptArray.fk_TTSChunk_idx`; "
+ "DROP TABLE IF EXISTS `vrHelpItemArray`; "
+ "DROP INDEX IF EXISTS `vrHelpItemArray.fk_vrHelpItem_idx`; "
+ "DROP INDEX IF EXISTS `vrHelpItemArray.fk_vrglobalProperties_idx`; "
+ "DROP TABLE IF EXISTS `application`; "
+ "DROP INDEX IF EXISTS `application.fk_globalProperties_idx`; "
+ "DROP TABLE IF EXISTS `applicationChoiceSetArray`; "
+ "DROP INDEX IF EXISTS "
+ "`applicationChoiceSetArray.fk_applicationChoiceSet_idx`; "
+ "DROP INDEX IF EXISTS `applicationChoiceSetArray.fk_Aplication_idx`; "
+ "DROP TABLE IF EXISTS `applicationCommandsArray`; "
+ "DROP INDEX IF EXISTS `applicationCommandsArray.fk_Application_idx`; "
+ "DROP INDEX IF EXISTS `applicationCommandsArray.fk_command_idx`; "
+ "DROP TABLE IF EXISTS `applicationFilesArray`; "
+ "DROP INDEX IF EXISTS `applicationFilesArray.fk_Application_idx`; "
+ "DROP INDEX IF EXISTS `applicationFilesArray.fk_file_idx`; "
+ "DROP TABLE IF EXISTS `applicationSubMenuArray`; "
+ "DROP INDEX IF EXISTS `applicationSubMenuArray.fk_subMenu_idx`; "
+ "DROP INDEX IF EXISTS `applicationSubMenuArray.fk_Application_idx`; "
+ "DROP TABLE IF EXISTS `applicationSubscribtionsArray`; "
+ "DROP INDEX IF EXISTS `applicationSubscribtionsArray.fk_Application_idx`; "
+ "DROP TABLE IF EXISTS `_internal_data`; "
+ "COMMIT; "
+ "VACUUM;";
+
+const std::string kInsertInitData =
+ "INSERT OR IGNORE INTO `resumption` (`last_ign_off_time`) VALUES (0); "
+ "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); ";
+
+const std::string kChecksResumptionData =
+ " SELECT COUNT(`idresumption`) "
+ " FROM `resumption`;";
+
+const std::string kSelectCountHMILevel =
+ "SELECT COUNT(`hmiLevel`) FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kSelectHMILevel =
+ "SELECT `hmiLevel` FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kCheckHMIId =
+ "SELECT COUNT(`hmiAppID`) FROM `application` "
+ "WHERE `hmiAppID` = ?";
+
+const std::string kSelectHMIId =
+ "SELECT `hmiAppID` FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kSelectCountHMIId =
+ "SELECT COUNT(`hmiAppID`) FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kCountHashId =
+ "SELECT COUNT(`hashID`) FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kSelectHashId =
+ "SELECT `hashID` FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kSelectIgnOffTime =
+ "SELECT `last_ign_off_time` FROM `resumption`";
+
+const std::string kCheckApplication =
+ "SELECT COUNT (`deviceID`) FROM `application` "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kCountApplications =
+ "SELECT COUNT(`appID`) FROM `application`;";
+
+const std::string kSelectDataForLoadResumeData =
+ "SELECT `hmiLevel`, `ign_off_count`, `timeStamp`, `appID`, `deviceID` "
+ "FROM `application`;";
+
+const std::string kUpdateHMILevel =
+ "UPDATE `application` "
+ "SET `hmiLevel` = ? "
+ "WHERE `deviceID` = ? AND `appID` = ?";
+
+const std::string kUpdateIgnOffCount =
+ "UPDATE `application` "
+ "SET `ign_off_count` = `ign_off_count` - 1 "
+ "WHERE `ign_off_count` > 0";
+
+const std::string kCountApplicationsIgnOff =
+ "SELECT COUNT(`ign_off_count`) "
+ "FROM `application` "
+ "WHERE `ign_off_count` >= ?";
+
+const std::string kSelectApplicationsIgnOffCount =
+ "SELECT `deviceID`, `appID` "
+ "FROM `application` "
+ "WHERE `ign_off_count` >= ?";
+
+const std::string kUpdateSuspendData =
+ "UPDATE `application` "
+ "SET `ign_off_count` = `ign_off_count` + 1";
+
+const std::string KUpdateLastIgnOffTime =
+ "UPDATE `resumption` "
+ "SET `last_ign_off_time` = ?";
+
+const std::string kDeleteFile =
+ "DELETE FROM `file` "
+ "WHERE `idfile` IN (SELECT `idfile` "
+ "FROM `applicationFilesArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteApplicationFilesArray =
+ "DELETE FROM `applicationFilesArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteSubMenu =
+ "DELETE FROM `subMenu` "
+ "WHERE `idsubMenu` IN (SELECT `idsubMenu` "
+ "FROM `applicationSubMenuArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteApplicationSubMenuArray =
+ "DELETE FROM `applicationSubMenuArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteApplicationSubscribtionsArray =
+ "DELETE FROM `applicationSubscribtionsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteImageFromCommands =
+ "DELETE FROM `image` "
+ "WHERE `idimage` IN (SELECT `idimage` "
+ "FROM `command` "
+ "WHERE `idcommand` IN (SELECT `idcommand` "
+ "FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)))";
+
+const std::string kDeleteVrCommands =
+ "DELETE FROM `vrCommandsArray` "
+ "WHERE `idcommand` IN (SELECT `idcommand` "
+ "FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteCommands =
+ "DELETE FROM `command` "
+ "WHERE `idcommand` IN (SELECT `idcommand` "
+ "FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteApplicationCommandsArray =
+ "DELETE FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteImageFromChoiceSet =
+ "DELETE FROM `image` "
+ "WHERE `idimage` IN (SELECT `idimage` "
+ "FROM `choice` "
+ "WHERE `idchoice` IN (SELECT `idchoice` "
+ "FROM `choiceArray` "
+ "WHERE `idapplicationChoiceSet` IN (SELECT `idapplicationChoiceSet` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))) "
+ "UNION "
+ "SELECT `idsecondaryImage` "
+ "FROM `choice` "
+ "WHERE `idchoice` IN (SELECT `idchoice` "
+ "FROM `choiceArray` "
+ "WHERE `idapplicationChoiceSet` IN (SELECT `idapplicationChoiceSet` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))))";
+
+const std::string kDeleteVrCommandsFromChoiceSet =
+ "DELETE FROM `vrCommandsArray` "
+ "WHERE `idchoice` IN (SELECT `idchoice` "
+ "FROM `choiceArray` "
+ "WHERE `idapplicationChoiceSet` IN (SELECT `idapplicationChoiceSet` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)))";
+
+const std::string kDeleteChoice =
+ "DELETE FROM `choice` "
+ "WHERE `idchoice` IN (SELECT `idchoice` "
+ "FROM `choiceArray` "
+ "WHERE `idapplicationChoiceSet` IN (SELECT `idapplicationChoiceSetArray` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)))";
+
+const std::string kDeleteChoiceArray =
+ "DELETE FROM `choiceArray` "
+ "WHERE `idapplicationChoiceSet` IN (SELECT `idapplicationChoiceSetArray` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteApplicationChoiceSet =
+ "DELETE FROM `applicationChoiceSet` "
+ "WHERE `idapplicationChoiceSet` IN (SELECT `idapplicationChoiceSetArray` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteApplicationChoiceSetArray =
+ "DELETE FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteImageFromGlobalProperties =
+ "DELETE FROM `image` "
+ "WHERE `idimage` IN (SELECT `idimage` "
+ "FROM `vrHelpItem` "
+ "WHERE `idvrHelpItem` IN (SELECT `idvrHelpItem` "
+ "FROM `vrHelpItemArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)) "
+ "UNION "
+ "SELECT `idmenuIcon` "
+ "FROM `globalProperties` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeletevrHelpItem =
+ "DELETE FROM `vrHelpItem` "
+ "WHERE `idvrHelpItem` IN (SELECT `idvrHelpItem` "
+ "FROM `vrHelpItemArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeletevrHelpItemArray =
+ "DELETE FROM `vrHelpItemArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteTableLimitedCharacterList =
+ "DELETE FROM `tableLimitedCharacterList` "
+ "WHERE `idtableLimitedCharacterList` IN (SELECT "
+ "`idtableLimitedCharacterList` "
+ "FROM `characterArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND deviceID = ?))";
+
+const std::string kDeleteCharacterArray =
+ "DELETE FROM `characterArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteTTSChunk =
+ "DELETE FROM `TTSChunk` "
+ "WHERE `idTTSChunk` IN (SELECT `idhelpPrompt` "
+ "FROM `helpTimeoutPromptArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?) "
+ "UNION "
+ "SELECT `idtimeoutPrompt` "
+ "FROM `helpTimeoutPromptArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?))";
+
+const std::string kDeleteFromApplicationTable =
+ "DELETE FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?";
+
+const std::string kDeleteHelpTimeoutPromptArray =
+ "DELETE FROM `helpTimeoutPromptArray` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kDeleteGlobalProperties =
+ "DELETE FROM `globalProperties` "
+ "WHERE `idglobalProperties` = (SELECT `idglobalProperties` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?)";
+
+const std::string kSelectCountImage =
+ "SELECT COUNT (`value`) "
+ "FROM `image` "
+ "WHERE `value` = ?";
+
+const std::string kSelectPrimaryKeyImage =
+ "SELECT `idimage` "
+ "FROM `image` "
+ "WHERE `value` = ?";
+
+const std::string kInsertImage =
+ "INSERT INTO `image` "
+ "(`imageType`, `value`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertToFile =
+ "INSERT INTO `file` "
+ "(`fileType`, `is_download_complete`, `persistentFile`, `syncFileName`) "
+ "VALUES "
+ "(?, ?, ?, ?)";
+
+const std::string kInsertToApplicationFilesArray =
+ "INSERT INTO `applicationFilesArray` "
+ "(`idApplication`, `idfile`) "
+ "VALUES "
+ "(?, ?)";
+
+const std::string kInsertToSubMenu =
+ "INSERT INTO `subMenu` "
+ "(`menuID`, `menuName`, `position`) "
+ "VALUES "
+ "(?, ?, ?);";
+
+const std::string kInsertToApplicationSubMenuArray =
+ "INSERT INTO `applicationSubMenuArray` "
+ "(`idApplication`, `idsubMenu`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertToCommand =
+ "INSERT INTO `command` "
+ "(`cmdID`, `idimage`, `menuName`, `parentID`, `position`) "
+ "VALUES "
+ "(?, ?, ?, ?, ?);";
+
+const std::string kInsertApplicationCommandArray =
+ "INSERT INTO `applicationCommandsArray` "
+ "(`idApplication`, `idcommand`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertVrCommand =
+ "INSERT INTO `vrCommandsArray` "
+ "(`vrCommand`, `idcommand`, `idchoice`) "
+ "VALUES "
+ "(?, ?, ?);";
+
+const std::string kInsertSubscriptions =
+ "INSERT INTO `applicationSubscribtionsArray` "
+ "(`idApplication`, `vehicleValue`, `ButtonNameValue`) "
+ "VALUES "
+ "(?, ?, ?);";
+
+const std::string kInsertChoice =
+ "INSERT INTO `choice` "
+ "(`choiceID`, `menuName`, `secondaryText`, "
+ "`tertiaryText`, `idimage`, `idsecondaryImage`) "
+ "VALUES "
+ "(?, ?, ?, ?, ?, ?);";
+
+const std::string kInsertApplicationChoiceSet =
+ "INSERT INTO `applicationChoiceSet` "
+ "(`grammarID`, `interactionChoiceSetID`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertChoiceArray =
+ "INSERT INTO `choiceArray` "
+ "(`idapplicationChoiceSet`, `idchoice`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertApplicationChoiceSetArray =
+ "INSERT INTO `applicationChoiceSetArray` "
+ "(`idapplicationChoiceSet`, `idApplication`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertGlobalProperties =
+ "INSERT INTO `globalProperties` "
+ "(`vrHelpTitle`, `menuTitle`, `idmenuIcon`, `language`, "
+ "`keyboardLayout`, `keypressMode`, `autoCompleteText`) "
+ "VALUES "
+ "(?, ?, ?, ?, ?, ?, ?);";
+
+const std::string kInsertTableLimitedCharacter =
+ "INSERT INTO `tableLimitedCharacterList` "
+ "(`limitedCharacterList`) "
+ "VALUES "
+ "(?);";
+
+const std::string kInsertCharacterArray =
+ "INSERT INTO `characterArray` "
+ "(`idglobalProperties`, `idtableLimitedCharacterList`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertVRHelpItem =
+ "INSERT INTO `vrHelpItem` "
+ "(`text`, `position`, `idimage`) "
+ "VALUES "
+ "(?, ?, ?);";
+
+const std::string kInsertVRHelpItemArray =
+ "INSERT INTO `vrHelpItemArray` "
+ "(`idglobalProperties`, `idvrHelpItem`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertHelpTimeoutPromptArray =
+ "INSERT INTO `helpTimeoutPromptArray` "
+ "(`idglobalProperties`, `idtimeoutPrompt`, `idhelpPrompt`) "
+ "VALUES "
+ "(?, ?, ?);";
+
+const std::string kInsertTTSChunk =
+ "INSERT INTO `TTSChunk` "
+ "(`type`, `text`) "
+ "VALUES "
+ "(?, ?);";
+
+const std::string kInsertApplication =
+ "INSERT INTO `application` "
+ "(`connection_key`, `grammarID`, `hashID`, "
+ "`hmiAppID`, `hmiLevel`, `ign_off_count`, "
+ "`timeStamp`, `idglobalProperties`, "
+ "`isMediaApplication`, `appID`, `deviceID`) "
+ "VALUES "
+ "(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);";
+
+const std::string kSelectCountFiles =
+ "SELECT COUNT (`idfile`) "
+ "FROM `applicationFilesArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?);";
+
+const std::string kSelectFiles =
+ "SELECT `fileType`, `is_download_complete`, `persistentFile`, "
+ "`syncFileName`"
+ "FROM `file` "
+ "WHERE `idfile` IN ( "
+ "SELECT `idfile` "
+ "FROM `applicationFilesArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?));";
+
+const std::string kSelectCountSubMenu =
+ "SELECT COUNT (`idsubMenu`) "
+ "FROM `applicationSubMenuArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?);";
+
+const std::string kSelectSubMenu =
+ "SELECT `menuID`, `menuName`, `position` "
+ "FROM `subMenu` "
+ "WHERE `idsubMenu` IN (SELECT `idsubMenu` "
+ "FROM `applicationSubMenuArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?));";
+
+const std::string kSelectCountCommands =
+ "SELECT COUNT (`idcommand`) "
+ "FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?);";
+
+const std::string kSelectCommands =
+ "SELECT `command`.`idcommand`, `cmdID`, `menuName`, `parentID`, "
+ "`position`, `value`, `imageType`, `vrCommand` "
+ "FROM `command` LEFT OUTER JOIN `image` on `command`.`idimage` = "
+ "`image`.`idimage` "
+ "LEFT OUTER JOIN `vrcommandsarray` on `command`.`idcommand` = "
+ "`vrcommandsarray`.`idcommand` "
+ "WHERE `command`.`idcommand` IN (SELECT `idcommand` "
+ "FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?));";
+
+const std::string kSelectCountSubscriptions =
+ "SELECT COUNT (`idApplication`) "
+ "FROM `applicationSubscribtionsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?);";
+
+const std::string kSelectSubscriptions =
+ "SELECT `vehicleValue`, `ButtonNameValue` "
+ "FROM `applicationSubscribtionsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?);";
+
+const std::string kSelectCountChoiceSet =
+ "SELECT COUNT (`idApplication`) "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?);";
+
+const std::string kSelectChoiceSets =
+ "SELECT `applicationChoiceSet`.`idapplicationChoiceSet`, `grammarID`, "
+ "`interactionChoiceSetID`, "
+ "`choice`.`idchoice`, `choiceID`, `menuName`, `secondaryText`, "
+ "`tertiaryText`, `choice`.`idimage`, "
+ "`idsecondaryImage`, `vrCommand` "
+ "FROM `applicationChoiceSet` INNER JOIN `choicearray` on "
+ "`applicationChoiceSet`.`idapplicationChoiceSet` = "
+ "`choicearray`.`idapplicationChoiceSet` "
+ "INNER JOIN `choice` on `choicearray`.`idchoice` = `choice`.`idchoice` "
+ "LEFT OUTER JOIN `vrCommandsArray` on `choice`.`idchoice` = "
+ "`vrCommandsArray`.`idchoice` "
+ "WHERE `applicationChoiceSet`.`idapplicationChoiceSet` in (select "
+ "`idapplicationChoiceSet` "
+ "FROM `applicationChoiceSetArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?));";
+
+const std::string kSelectImage =
+ "SELECT `imageType`, `value` "
+ "FROM `image` "
+ "WHERE `idimage` = ?;";
+
+const std::string kSelectCountGlobalProperties =
+ "SELECT COUNT(idglobalProperties) "
+ "FROM `application` "
+ "WHERE `appID` = ? and `deviceID` = ?;";
+
+const std::string kSelectGlobalProperties =
+ "SELECT `globalProperties`.`idglobalProperties`, `vrHelpTitle`, "
+ "`menuTitle`, `idmenuIcon`, "
+ "`language`, `keyboardLayout`, `keypressMode`, `autoCompleteText`, "
+ "`helpTimeoutPromptArray`.`idhelpPrompt`, "
+ "`helpTimeoutPromptArray`.`idtimeoutPrompt` "
+ "FROM `globalProperties` LEFT OUTER JOIN `helpTimeoutPromptArray` ON "
+ "`globalProperties`.`idglobalProperties` = "
+ "`helpTimeoutPromptArray`.`idglobalProperties` "
+ "WHERE `globalProperties`.`idglobalProperties` = ( "
+ "SELECT `idglobalProperties` FROM `application` WHERE `appID` = ? AND "
+ "`deviceID` = ?);";
+
+const std::string kChecksVrHelpItem =
+ "SELECT COUNT(`idvrHelpItem`) "
+ "FROM `vrHelpItemArray` "
+ "WHERE `idglobalProperties`= ?;";
+
+const std::string kSelectVrHelpItem =
+ "SELECT `text`, `position`, `imageType`, `value` "
+ "FROM `vrHelpItem` LEFT OUTER JOIN `image` ON "
+ "`vrHelpItem`.`idimage` = `image`.`idimage` "
+ "WHERE `idvrHelpItem` in (SELECT `idvrHelpItem` "
+ "FROM `vrHelpItemArray` "
+ "WHERE `idglobalProperties` = ?);";
+
+const std::string kChecksCharacter =
+ "SELECT COUNT(`idtableLimitedCharacterList`) "
+ "FROM `characterArray` "
+ "WHERE `idglobalProperties`= ?;";
+
+const std::string kSelectCharacter =
+ "SELECT `limitedCharacterList` "
+ "FROM `tableLimitedCharacterList` "
+ "WHERE `idtableLimitedCharacterList` "
+ "in (SELECT `idtableLimitedCharacterList` "
+ "FROM `characterArray` "
+ "WHERE `idglobalProperties` = ?);";
+
+const std::string kSelectTTSChunk =
+ "SELECT `text`, `type` "
+ "FROM `TTSChunk` "
+ "WHERE `idTTSChunk` = ?;";
+
+const std::string kSelectAppTable =
+ "SELECT `appID`, `connection_key`, `grammarID`, `hashID`, `hmiAppID`, "
+ "`hmiLevel`, `ign_off_count`, "
+ "`timeStamp`, `deviceID`, `isMediaApplication` "
+ "FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?;";
+
+const std::string kSelectAllApps =
+ "SELECT `appID`, `deviceID` FROM `application`;";
+
+const std::string kUpdateApplicationData =
+ "UPDATE `application` "
+ "SET `hmiLevel` = ?, `timeStamp` = ? "
+ "WHERE `appID` = ? AND `deviceID` = ?;";
+
+const std::string kSelectDBVersion =
+ "SELECT `db_version_hash` from `_internal_data`; ";
+
+const std::string kUpdateDBVersion =
+ "UPDATE `_internal_data` SET `db_version_hash` = ? ; ";
+
+const std::string kUpdateGrammarID =
+ "UPDATE `application` "
+ "SET `grammarID` = ? "
+ "WHERE `appID` = ? AND `deviceID` = ?;";
+
+} // namespace resumption
diff --git a/src/components/application_manager/src/state_controller.cc b/src/components/application_manager/src/state_controller.cc
index 720312adb3..6d921db864 100644
--- a/src/components/application_manager/src/state_controller.cc
+++ b/src/components/application_manager/src/state_controller.cc
@@ -1,4 +1,4 @@
-/*
+ /*
Copyright (c) 2015, Ford Motor Company
All rights reserved.
@@ -31,119 +31,321 @@
*/
#include "application_manager/state_controller.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/message_helper.h"
+#include "application_manager/usage_statistics.h"
#include "utils/helpers.h"
+#include "utils/make_shared.h"
namespace application_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "StateController");
-bool IsStatusChanged(HmiStatePtr old_state,
- HmiStatePtr new_state) {
- if (old_state->hmi_level() != new_state->hmi_level()
- || old_state->audio_streaming_state() != new_state->audio_streaming_state()
- || old_state->system_context() != new_state->system_context() ) {
+bool IsStatusChanged(HmiStatePtr old_state, HmiStatePtr new_state) {
+ if (old_state->hmi_level() != new_state->hmi_level() ||
+ old_state->audio_streaming_state() !=
+ new_state->audio_streaming_state() ||
+ old_state->system_context() != new_state->system_context()) {
return true;
}
return false;
}
-StateController::StateController():EventObserver() {
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnEmergencyEvent);
- subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnPhoneCall);
+StateController::StateController(ApplicationManager* app_mngr)
+ : EventObserver(), app_mngr_(app_mngr) {
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnAppActivated);
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnAppDeactivated);
subscribe_on_event(hmi_apis::FunctionID::TTS_Started);
subscribe_on_event(hmi_apis::FunctionID::TTS_Stopped);
subscribe_on_event(hmi_apis::FunctionID::VR_Started);
subscribe_on_event(hmi_apis::FunctionID::VR_Stopped);
+ subscribe_on_event(hmi_apis::FunctionID::BasicCommunication_OnEventChanged);
}
-void StateController::SetRegularState(ApplicationSharedPtr app,
- const mobile_apis::AudioStreamingState::eType audio_state) {
- if (!app) {
+void StateController::HmiLevelConflictResolver::operator()(
+ ApplicationSharedPtr to_resolve) {
+ using namespace mobile_apis;
+ using namespace helpers;
+ DCHECK_OR_RETURN_VOID(state_ctrl_);
+ if (to_resolve == applied_)
return;
+ HmiStatePtr cur_state = to_resolve->RegularHmiState();
+
+ const bool applied_grabs_audio =
+ Compare<HMILevel::eType, EQ, ONE>(
+ state_->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) &&
+ applied_->IsAudioApplication();
+ const bool applied_grabs_full = state_->hmi_level() == HMILevel::HMI_FULL;
+ const bool to_resolve_handles_full =
+ cur_state->hmi_level() == HMILevel::HMI_FULL;
+ const bool to_resolve_handles_audio =
+ Compare<HMILevel::eType, EQ, ONE>(
+ cur_state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED) &&
+ to_resolve->IsAudioApplication();
+ const bool same_app_type = state_ctrl_->IsSameAppType(applied_, to_resolve);
+
+ // If applied Hmi state is FULL:
+ // all not audio applications will get BACKGROUND
+ // all applications with same HMI type will get BACKGROUND
+ // all audio applications with other HMI type(navi, vc, media) in FULL will
+ // get LIMMITED HMI level
+
+ // If applied Hmi state is LIMITED:
+ // all applications with other HMI types will save HMI states
+ // all not audio applications will save HMI states
+ // all applications with same HMI type will get BACKGROUND
+
+ // If applied Hmi state is BACKGROUND:
+ // all applications will save HMI states
+
+ HMILevel::eType result_hmi_level = cur_state->hmi_level();
+ if (applied_grabs_full && to_resolve_handles_audio && !same_app_type)
+ result_hmi_level = HMILevel::HMI_LIMITED;
+
+ if ((applied_grabs_full && to_resolve_handles_full &&
+ !to_resolve->IsAudioApplication()) ||
+ (applied_grabs_audio && to_resolve_handles_audio && same_app_type))
+ result_hmi_level = HMILevel::HMI_BACKGROUND;
+
+ if (cur_state->hmi_level() != result_hmi_level) {
+ LOG4CXX_DEBUG(logger_,
+ "Application " << to_resolve->app_id()
+ << " will change HMI level to "
+ << result_hmi_level);
+ state_ctrl_->SetupRegularHmiState(to_resolve,
+ result_hmi_level,
+ result_hmi_level == HMILevel::HMI_LIMITED
+ ? AudioStreamingState::AUDIBLE
+ : AudioStreamingState::NOT_AUDIBLE);
+ } else {
+ LOG4CXX_DEBUG(logger_,
+ "Application " << to_resolve->app_id()
+ << " will not change HMI level");
}
- HmiStatePtr prev_state = app->RegularHmiState();
- DCHECK_OR_RETURN_VOID(prev_state);
- HmiStatePtr hmi_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
- DCHECK_OR_RETURN_VOID(hmi_state);
- hmi_state->set_hmi_level(prev_state->hmi_level());
- hmi_state->set_audio_streaming_state(audio_state);
- hmi_state->set_system_context(prev_state->system_context());
- SetRegularState<false>(app, hmi_state);
}
-void StateController::HmiLevelConflictResolver::operator ()
- (ApplicationSharedPtr to_resolve) {
+HmiStatePtr StateController::ResolveHmiState(ApplicationSharedPtr app,
+ HmiStatePtr state) const {
using namespace mobile_apis;
using namespace helpers;
- DCHECK_OR_RETURN_VOID(state_ctrl_);
- if (to_resolve == applied_)
- return;
- if (Compare<HMILevel::eType, EQ, ONE>(state_->hmi_level(),
- HMILevel::HMI_FULL,
- HMILevel::HMI_LIMITED)) {
- HmiStatePtr cur_state = to_resolve->RegularHmiState();
- if (Compare<HMILevel::eType, EQ, ONE>(cur_state->hmi_level(),
- HMILevel::HMI_FULL,
- HMILevel::HMI_LIMITED)) {
- if (applied_->IsAudioApplication() && state_ctrl_->IsSameAppType(applied_, to_resolve)) {
- state_ctrl_->SetupRegularHmiState(to_resolve, HMILevel::HMI_BACKGROUND,
- AudioStreamingState::NOT_AUDIBLE);
- } else {
- state_ctrl_->SetupRegularHmiState(to_resolve, HMILevel::HMI_LIMITED,
- AudioStreamingState::AUDIBLE);
- }
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "State to resolve: hmi_level " << state->hmi_level()
+ << ", audio_state "
+ << state->audio_streaming_state()
+ << ", system_context "
+ << state->system_context());
+
+ HmiStatePtr available_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN(available_state, HmiStatePtr());
+ available_state->set_hmi_level(state->hmi_level());
+ available_state->set_audio_streaming_state(state->audio_streaming_state());
+ available_state->set_system_context(state->system_context());
+
+ if (app->is_resuming()) {
+ HMILevel::eType available_level =
+ GetAvailableHmiLevel(app, state->hmi_level());
+ available_state->set_hmi_level(available_level);
+ available_state->set_audio_streaming_state(
+ CalcAudioState(app, available_level));
+ }
+ return IsStateAvailable(app, available_state) ? available_state
+ : HmiStatePtr();
+}
+
+bool StateController::IsResumptionAllowed(ApplicationSharedPtr app,
+ HmiStatePtr state) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace helpers;
+ using namespace mobile_apis;
+ if (!app->is_resuming() ||
+ !Compare<HMILevel::eType, EQ, ONE>(
+ state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) {
+ LOG4CXX_DEBUG(logger_, "Application is not in resuming mode.");
+ return true;
+ }
+
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) &&
+ app->is_media_application()) {
+ LOG4CXX_DEBUG(logger_,
+ "Resumption for media app is not allowed. "
+ << "AUDIO_SOURCE event is active");
+ return false;
+ }
+
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI) &&
+ app->is_navi()) {
+ LOG4CXX_DEBUG(logger_,
+ "Resumption for navi app is not allowed. "
+ << "EMBEDDED_NAVI event is active");
+ return false;
+ }
+
+ return true;
+}
+
+mobile_apis::HMILevel::eType StateController::GetAvailableHmiLevel(
+ ApplicationSharedPtr app, mobile_apis::HMILevel::eType hmi_level) const {
+ using namespace mobile_apis;
+ using namespace helpers;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ mobile_apis::HMILevel::eType result = hmi_level;
+ if (!Compare<HMILevel::eType, EQ, ONE>(
+ hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) {
+ return result;
+ }
+
+ const bool is_audio_app = app->IsAudioApplication();
+ const bool does_audio_app_with_same_type_exist =
+ app_mngr_->IsAppTypeExistsInFullOrLimited(app);
+ if (HMILevel::HMI_LIMITED == hmi_level) {
+ if (!is_audio_app || does_audio_app_with_same_type_exist) {
+ result = app_mngr_->GetDefaultHmiLevel(app);
+ }
+ return result;
+ }
+
+ const bool is_active_app_exist = app_mngr_->active_application();
+ if (is_audio_app) {
+ if (does_audio_app_with_same_type_exist) {
+ result = app_mngr_->GetDefaultHmiLevel(app);
+ } else if (is_active_app_exist) {
+ result = mobile_apis::HMILevel::HMI_LIMITED;
+ } else if (app->is_navi() &&
+ IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE)) {
+ LOG4CXX_DEBUG(logger_,
+ "Navigation app will be resumed to LIMITED, "
+ "because of AUDIO_SOURCE ia active.");
+ result = mobile_apis::HMILevel::HMI_LIMITED;
+ } else if (app->is_media_application() &&
+ IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) {
+ LOG4CXX_DEBUG(logger_,
+ "Media app will be resumed to LIMITED, "
+ "because of EMBEDDED_NAVI is active.");
+ result = mobile_apis::HMILevel::HMI_LIMITED;
+ }
+ } else if (is_active_app_exist) {
+ result = app_mngr_->GetDefaultHmiLevel(app);
+ }
+
+ return result;
+}
+
+bool StateController::IsStateAvailable(ApplicationSharedPtr app,
+ HmiStatePtr state) const {
+ using namespace mobile_apis;
+ using namespace helpers;
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "Checking state: hmi_level " << state->hmi_level()
+ << ", audio_state "
+ << state->audio_streaming_state()
+ << ", system_context "
+ << state->system_context());
+
+ if (app->is_resuming()) {
+ return IsStateAvailableForResumption(app, state);
+ }
+
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_AUDIO_SOURCE) ||
+ IsTempStateActive(HmiState::StateID::STATE_ID_EMBEDDED_NAVI)) {
+ if (HMILevel::HMI_FULL == state->hmi_level()) {
+ LOG4CXX_DEBUG(logger_,
+ "AUDIO_SOURCE or EMBEDDED_NAVI is active."
+ << " Requested state is not available");
+ return false;
}
}
+
+ LOG4CXX_DEBUG(logger_, "Requested state is available");
+ return true;
+}
+
+bool StateController::IsStateAvailableForResumption(ApplicationSharedPtr app,
+ HmiStatePtr state) const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ using namespace mobile_apis;
+ using namespace helpers;
+
+ if (!app->is_resuming() ||
+ !Compare<HMILevel::eType, EQ, ONE>(
+ state->hmi_level(), HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) {
+ LOG4CXX_DEBUG(logger_,
+ "Application is not in resuming mode."
+ << " Requested state is available");
+ return true;
+ }
+
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_VR_SESSION) ||
+ IsTempStateActive(HmiState::StateID::STATE_ID_SAFETY_MODE)) {
+ LOG4CXX_DEBUG(logger_,
+ "Requested state is not available. "
+ << "VR session or emergency event is active");
+ return false;
+ }
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_PHONE_CALL) &&
+ app->is_media_application()) {
+ LOG4CXX_DEBUG(logger_,
+ "Requested state for media application "
+ << "is not available. Phone call is active");
+ return false;
+ }
+ if (IsTempStateActive(HmiState::StateID::STATE_ID_DEACTIVATE_HMI)) {
+ LOG4CXX_DEBUG(logger_,
+ "Requested state is not available. "
+ << "Deactivate HMI event is active");
+ return false;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Requested state is available");
+ return true;
}
void StateController::SetupRegularHmiState(ApplicationSharedPtr app,
HmiStatePtr state) {
- using namespace mobile_apis;
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(state);
- LOG4CXX_DEBUG(logger_, "hmi_level " << state->hmi_level() <<
- ", audio_state " << state->audio_streaming_state() <<
- ", system_context " << state->system_context());
+ LOG4CXX_DEBUG(logger_,
+ "hmi_level " << state->hmi_level() << ", audio_state "
+ << state->audio_streaming_state()
+ << ", system_context "
+ << state->system_context());
HmiStatePtr curr_state = app->CurrentHmiState();
- HmiStatePtr old_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
+ HmiStatePtr old_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(old_state);
old_state->set_hmi_level(curr_state->hmi_level());
old_state->set_audio_streaming_state(curr_state->audio_streaming_state());
old_state->set_system_context(curr_state->system_context());
app->SetRegularState(state);
- if (state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
- app->ResetDataInNone();
- }
- if (!app->IsAudioApplication()) {
- if (state->hmi_level() == HMILevel::HMI_LIMITED) {
- LOG4CXX_ERROR(logger_, "Trying to setup LIMITED to non audio app");
- state->set_hmi_level(HMILevel::HMI_BACKGROUND);
- }
- if (state->audio_streaming_state() != AudioStreamingState::NOT_AUDIBLE) {
- LOG4CXX_ERROR(logger_, "Trying to setup audio state " <<
- state->audio_streaming_state() <<" to non audio app");
- state->set_audio_streaming_state(AudioStreamingState::NOT_AUDIBLE);
- }
+
+ if (HMILevel::HMI_LIMITED == state->hmi_level() && app->is_resuming()) {
+ LOG4CXX_DEBUG(logger_,
+ "Resuming to LIMITED level. "
+ << "Send OnResumeAudioSource notification");
+ MessageHelper::SendOnResumeAudioSourceToHMI(app->app_id());
}
+ app->set_is_resuming(false);
+
HmiStatePtr new_state = app->CurrentHmiState();
OnStateChanged(app, old_state, new_state);
}
-void StateController::SetupRegularHmiState(ApplicationSharedPtr app,
- const mobile_apis::HMILevel::eType hmi_level,
- const mobile_apis::AudioStreamingState::eType audio_state) {
- using namespace mobile_apis;
- using namespace helpers;
+void StateController::SetupRegularHmiState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level,
+ const mobile_apis::AudioStreamingState::eType audio_state) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ using helpers::Compare;
LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
HmiStatePtr prev_state = app->RegularHmiState();
DCHECK_OR_RETURN_VOID(prev_state);
- HmiStatePtr new_state = CreateHmiState(app->app_id(),
- HmiState::StateID::STATE_ID_REGULAR);
+ HmiStatePtr new_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
DCHECK_OR_RETURN_VOID(new_state);
new_state->set_hmi_level(hmi_level);
new_state->set_audio_streaming_state(audio_state);
@@ -152,69 +354,117 @@ void StateController::SetupRegularHmiState(ApplicationSharedPtr app,
}
void StateController::ApplyRegularState(ApplicationSharedPtr app,
- HmiStatePtr state) {
+ HmiStatePtr state) {
+ LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(state);
DCHECK_OR_RETURN_VOID(state->state_id() == HmiState::STATE_ID_REGULAR);
SetupRegularHmiState(app, state);
- ForEachApplication<HmiLevelConflictResolver, ApplicationManagerImpl>
- (HmiLevelConflictResolver(app, state, this));
+ ForEachApplication<HmiLevelConflictResolver>(
+ HmiLevelConflictResolver(app, state, this));
}
bool StateController::IsSameAppType(ApplicationConstSharedPtr app1,
- ApplicationConstSharedPtr app2) {
- return app1->is_media_application() == app2->is_media_application() ||
- app1->is_navi() == app2->is_navi() ||
- app1->is_voice_communication_supported() == app2->is_voice_communication_supported();
+ ApplicationConstSharedPtr app2) {
+ const bool both_media =
+ app1->is_media_application() && app2->is_media_application();
+ const bool both_navi = app1->is_navi() && app2->is_navi();
+ const bool both_vc = app1->is_voice_communication_supported() &&
+ app2->is_voice_communication_supported();
+ const bool both_simple =
+ !app1->IsAudioApplication() && !app2->IsAudioApplication();
+ return both_simple || both_media || both_navi || both_vc;
}
void StateController::on_event(const event_engine::Event& event) {
- using namespace smart_objects;
- using namespace event_engine;
+ using smart_objects::SmartObject;
+ using event_engine::Event;
using namespace hmi_apis;
+ namespace FunctionID = hmi_apis::FunctionID;
LOG4CXX_AUTO_TRACE(logger_);
const SmartObject& message = event.smart_object();
- const FunctionID::eType id = static_cast<FunctionID::eType> (event.id());
+ const FunctionID::eType id = static_cast<FunctionID::eType>(event.id());
switch (id) {
case FunctionID::BasicCommunication_ActivateApp: {
OnActivateAppResponse(message);
break;
}
- case FunctionID::BasicCommunication_OnEmergencyEvent: {
- bool is_active =
- message[strings::msg_params][hmi_response::enabled].asBool();
- if (is_active) {
- OnSafetyModeEnabled();
- } else {
- OnSafetyModeDisabled();
- }
+ case FunctionID::BasicCommunication_OnAppActivated: {
+ OnAppActivated(message);
break;
}
- case FunctionID::BasicCommunication_OnPhoneCall: {
- bool is_active =
- message[strings::msg_params][hmi_notification::is_active].asBool();
- if (is_active) {
- OnPhoneCallStarted();
- } else {
- OnPhoneCallEnded();
- }
+ case FunctionID::BasicCommunication_OnAppDeactivated: {
+ OnAppDeactivated(message);
break;
}
case FunctionID::VR_Started: {
- OnVRStarted();
+ ApplyTempState<HmiState::STATE_ID_VR_SESSION>();
break;
}
case FunctionID::VR_Stopped: {
- OnVREnded();
+ CancelTempState<HmiState::STATE_ID_VR_SESSION>();
break;
}
case FunctionID::TTS_Started: {
- OnTTSStarted();
+ ApplyTempState<HmiState::STATE_ID_TTS_SESSION>();
break;
}
case FunctionID::TTS_Stopped: {
- OnTTSStopped();
+ CancelTempState<HmiState::STATE_ID_TTS_SESSION>();
+ break;
+ }
+ case FunctionID::BasicCommunication_OnEventChanged: {
+ bool is_active =
+ message[strings::msg_params][hmi_notification::is_active].asBool();
+ const uint32_t id =
+ message[strings::msg_params][hmi_notification::event_name].asUInt();
+ //TODO(AOleynik): Add verification/conversion check here
+ Common_EventTypes::eType state_id =
+ static_cast<Common_EventTypes::eType>(id);
+ if (is_active) {
+ if (Common_EventTypes::AUDIO_SOURCE == state_id) {
+ ApplyTempState<HmiState::STATE_ID_AUDIO_SOURCE>();
+ break;
+ }
+ if (Common_EventTypes::EMBEDDED_NAVI == state_id) {
+ ApplyTempState<HmiState::STATE_ID_EMBEDDED_NAVI>();
+ break;
+ }
+ if (Common_EventTypes::PHONE_CALL == state_id) {
+ ApplyTempState<HmiState::STATE_ID_PHONE_CALL>();
+ break;
+ }
+ if (Common_EventTypes::EMERGENCY_EVENT == state_id) {
+ ApplyTempState<HmiState::STATE_ID_SAFETY_MODE>();
+ break;
+ }
+ if (Common_EventTypes::DEACTIVATE_HMI == state_id) {
+ ApplyTempState<HmiState::STATE_ID_DEACTIVATE_HMI>();
+ break;
+ }
+ } else {
+ if (Common_EventTypes::AUDIO_SOURCE == state_id) {
+ CancelTempState<HmiState::STATE_ID_AUDIO_SOURCE>();
+ break;
+ }
+ if (Common_EventTypes::EMBEDDED_NAVI == state_id) {
+ CancelTempState<HmiState::STATE_ID_EMBEDDED_NAVI>();
+ break;
+ }
+ if (Common_EventTypes::PHONE_CALL == state_id) {
+ CancelTempState<HmiState::STATE_ID_PHONE_CALL>();
+ break;
+ }
+ if (Common_EventTypes::EMERGENCY_EVENT == state_id) {
+ CancelTempState<HmiState::STATE_ID_SAFETY_MODE>();
+ break;
+ }
+ if (Common_EventTypes::DEACTIVATE_HMI == state_id) {
+ CancelTempState<HmiState::STATE_ID_DEACTIVATE_HMI>();
+ break;
+ }
+ }
break;
}
default:
@@ -225,27 +475,52 @@ void StateController::on_event(const event_engine::Event& event) {
void StateController::OnStateChanged(ApplicationSharedPtr app,
HmiStatePtr old_state,
HmiStatePtr new_state) {
+ LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
DCHECK_OR_RETURN_VOID(old_state);
DCHECK_OR_RETURN_VOID(new_state);
+ LOG4CXX_DEBUG(logger_,
+ "old: hmi_level " << old_state->hmi_level() << ", audio_state "
+ << old_state->audio_streaming_state()
+ << ", system_context "
+ << old_state->system_context());
+ LOG4CXX_DEBUG(logger_,
+ "new: hmi_level " << new_state->hmi_level() << ", audio_state "
+ << new_state->audio_streaming_state()
+ << ", system_context "
+ << new_state->system_context());
if (IsStatusChanged(old_state, new_state)) {
- MessageHelper::SendHMIStatusNotification(*app);
+ app_mngr_->SendHMIStatusNotification(app);
if (new_state->hmi_level() == mobile_apis::HMILevel::HMI_NONE) {
app->ResetDataInNone();
}
- ApplicationManagerImpl::instance()->OnHMILevelChanged(app->app_id(),
- old_state->hmi_level(), new_state->hmi_level());
+ app_mngr_->OnHMILevelChanged(
+ app->app_id(), old_state->hmi_level(), new_state->hmi_level());
+ app->usage_report().RecordHmiStateChanged(new_state->hmi_level());
} else {
LOG4CXX_ERROR(logger_, "Status not changed");
}
}
-void StateController::ApplyStatesForApp(ApplicationSharedPtr app) {
- LOG4CXX_AUTO_TRACE(logger_);
+bool StateController::IsTempStateActive(HmiState::StateID ID) const {
sync_primitives::AutoLock autolock(active_states_lock_);
+ StateIDList::const_iterator itr =
+ std::find(active_states_.begin(), active_states_.end(), ID);
+ return active_states_.end() != itr;
+}
+
+void StateController::OnApplicationRegistered(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType default_level) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+ LOG4CXX_AUTO_TRACE(logger_);
DCHECK_OR_RETURN_VOID(app);
+
+ active_states_lock_.Acquire();
StateIDList::iterator it = active_states_.begin();
- for(; it != active_states_.end(); ++it) {
+ for (; it != active_states_.end(); ++it) {
HmiStatePtr new_state = CreateHmiState(app->app_id(), *it);
DCHECK_OR_RETURN_VOID(new_state);
DCHECK_OR_RETURN_VOID(new_state->state_id() != HmiState::STATE_ID_REGULAR);
@@ -253,7 +528,58 @@ void StateController::ApplyStatesForApp(ApplicationSharedPtr app) {
new_state->set_parent(old_hmi_state);
app->AddHMIState(new_state);
}
+ active_states_lock_.Release();
+
+ HmiStatePtr default_state =
+ CreateHmiState(app->app_id(), HmiState::StateID::STATE_ID_REGULAR);
+ DCHECK_OR_RETURN_VOID(default_state);
+ default_state->set_hmi_level(default_level);
+ default_state->set_audio_streaming_state(CalcAudioState(app, default_level));
+ default_state->set_system_context(SystemContext::SYSCTXT_MAIN);
+ HmiStatePtr initial_state = app->RegularHmiState();
+
+ app->SetRegularState(default_state);
+
+ HmiStatePtr new_state = app->CurrentHmiState();
+
+ OnStateChanged(app, initial_state, new_state);
+}
+
+int64_t StateController::SendBCActivateApp(
+ ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ smart_objects::SmartObjectSPtr bc_activate_app_request =
+ MessageHelper::GetBCActivateAppRequestToHMI(
+ app,
+ level,
+ send_policy_priority);
+ if (!bc_activate_app_request) {
+ std::cout << "Unable to create BC.ActivateAppRequest" << std::endl;
+ LOG4CXX_ERROR(logger_, "Unable to create BC.ActivateAppRequest");
+ return -1;
+ }
+ if (!app_mngr_->ManageHMICommand(bc_activate_app_request)) {
+ std::cout << "Unable to send BC.ActivateAppRequest" << std::endl;
+ LOG4CXX_ERROR(logger_, "Unable to send BC.ActivateAppRequest");
+ return -1;
+ }
+ const int64_t corr_id =
+ (*bc_activate_app_request)[strings::params][strings::correlation_id]
+ .asInt();
+ return corr_id;
+}
+
+void StateController::ApplyPostponedStateForApp(ApplicationSharedPtr app) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ HmiStatePtr state = app->PostponedHmiState();
+ if (state) {
+ app->RemovePostponedState();
+ state->set_state_id(HmiState::STATE_ID_REGULAR);
+ SetRegularState(app, state);
+ }
}
void StateController::TempStateStarted(HmiState::StateID ID) {
@@ -262,167 +588,170 @@ void StateController::TempStateStarted(HmiState::StateID ID) {
StateIDList::iterator it =
std::find(active_states_.begin(), active_states_.end(), ID);
if (it == active_states_.end()) {
- active_states_.push_back(ID);
+ active_states_.push_back(ID);
} else {
- LOG4CXX_ERROR(logger_, "StateID " << ID <<" is already active");
+ LOG4CXX_ERROR(logger_, "StateID " << ID << " is already active");
}
}
void StateController::TempStateStopped(HmiState::StateID ID) {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock autolock(active_states_lock_);
- active_states_.remove(ID);
+ {
+ sync_primitives::AutoLock autolock(active_states_lock_);
+ active_states_.remove(ID);
+ }
+ ForEachApplication(std::bind1st(
+ std::mem_fun(&StateController::ApplyPostponedStateForApp), this));
}
+
+void StateController::DeactivateApp(ApplicationSharedPtr app) {
+ using namespace mobile_apis;
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK_OR_RETURN_VOID(app);
+ HmiStatePtr regular = app->RegularHmiState();
+ DCHECK_OR_RETURN_VOID(regular);
+ HmiStatePtr new_regular = utils::MakeShared<HmiState>(*regular);
+
+ if (app->IsAudioApplication()) {
+ new_regular->set_hmi_level(HMILevel::HMI_LIMITED);
+ new_regular->set_audio_streaming_state(AudioStreamingState::AUDIBLE);
+ } else {
+ new_regular->set_hmi_level(HMILevel::HMI_BACKGROUND);
+ new_regular->set_audio_streaming_state(AudioStreamingState::NOT_AUDIBLE);
+ }
+
+ SetRegularState<false>(app, new_regular);
+}
+
void StateController::OnActivateAppResponse(
const smart_objects::SmartObject& message) {
const hmi_apis::Common_Result::eType code =
static_cast<hmi_apis::Common_Result::eType>(
- message[strings::params][hmi_response::code].asInt());
- const int32_t correlation_id = message[strings::params]
- [strings::correlation_id].asInt();
- const uint32_t hmi_app_id = ApplicationManagerImpl::instance()->
- application_id(correlation_id);
- ApplicationSharedPtr application = ApplicationManagerImpl::instance()->
- application_by_hmi_app(hmi_app_id);
- if (application) {
+ message[strings::params][hmi_response::code].asInt());
+ const int32_t correlation_id =
+ message[strings::params][strings::correlation_id].asInt();
+ const uint32_t hmi_app_id = app_mngr_->application_id(correlation_id);
+ ApplicationSharedPtr application =
+ app_mngr_->application_by_hmi_app(hmi_app_id);
+ if (application && hmi_apis::Common_Result::SUCCESS == code) {
HmiStatePtr pending_state = waiting_for_activate[application->app_id()];
DCHECK_OR_RETURN_VOID(pending_state);
- if (code != hmi_apis::Common_Result::SUCCESS) {
- const HmiStatePtr cur = application->RegularHmiState();
- pending_state->set_hmi_level(cur->hmi_level());
- }
ApplyRegularState(application, pending_state);
}
}
-
-void StateController::OnPhoneCallStarted() {
+void StateController::OnAppActivated(
+ const smart_objects::SmartObject& message) {
+ using namespace mobile_apis;
LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStarted<HmiState::STATE_ID_PHONE_CALL>),
- this)
- );
- TempStateStarted(HmiState::STATE_ID_PHONE_CALL);
-}
-void StateController::OnPhoneCallEnded() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_PHONE_CALL>),
- this)
- );
- TempStateStopped(HmiState::STATE_ID_PHONE_CALL);
-}
+ uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt();
+ ApplicationSharedPtr app = app_mngr_->application(app_id);
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found");
+ return;
+ }
-void StateController::OnSafetyModeEnabled() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStarted<HmiState::STATE_ID_SAFETY_MODE>),
- this)
- );
- TempStateStarted(HmiState::STATE_ID_SAFETY_MODE);
+ SetRegularState<true>(app, HMILevel::HMI_FULL);
}
-void StateController::OnSafetyModeDisabled() {
+void StateController::OnAppDeactivated(
+ const smart_objects::SmartObject& message) {
+ using namespace hmi_apis;
+ using namespace mobile_apis;
+ using namespace helpers;
LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_SAFETY_MODE>),
- this)
- );
- TempStateStopped(HmiState::STATE_ID_SAFETY_MODE);
-}
+ uint32_t app_id = message[strings::msg_params][strings::app_id].asUInt();
+ ApplicationSharedPtr app = app_mngr_->application(app_id);
-void StateController::OnVRStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStarted<HmiState::STATE_ID_VR_SESSION>),
- this)
- );
- TempStateStarted(HmiState::STATE_ID_VR_SESSION);
-}
+ if (!app) {
+ LOG4CXX_ERROR(logger_, "Application with id " << app_id << " not found");
+ return;
+ }
-void StateController::OnVREnded() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_VR_SESSION>),
- this)
- );
- TempStateStopped(HmiState::STATE_ID_VR_SESSION);
-}
+ if (HMILevel::HMI_FULL != app->hmi_level()) {
+ return;
+ }
-void StateController::OnTTSStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStarted<HmiState::STATE_ID_TTS_SESSION>),
- this)
- );
- TempStateStarted(HmiState::STATE_ID_TTS_SESSION);
+ //TODO(AOleynik): Need to delete DeactivateReason and modify OnAppDeactivated
+ // when HMI will support that, otherwise won't be testable
+ DeactivateApp(app);
}
-void StateController::OnTTSStopped() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_TTS_SESSION>),
- this)
- );
- TempStateStopped(HmiState::STATE_ID_TTS_SESSION);
+void StateController::SetAplicationManager(ApplicationManager* app_mngr) {
+ app_mngr_ = app_mngr;
}
void StateController::OnNaviStreamingStarted() {
- LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStarted<HmiState::STATE_ID_NAVI_STREAMING>),
- this)
- );
- TempStateStarted(HmiState::STATE_ID_NAVI_STREAMING);
+ ApplyTempState<HmiState::STATE_ID_NAVI_STREAMING>();
}
void StateController::OnNaviStreamingStopped() {
+ CancelTempState<HmiState::STATE_ID_NAVI_STREAMING>();
+}
+
+bool StateController::IsDeactivateHMIStateActive() const {
+ return IsTempStateActive(HmiState::StateID::STATE_ID_DEACTIVATE_HMI);
+}
+
+bool StateController::IsStateActive(HmiState::StateID state_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- ForEachApplication(std::bind1st(
- std::mem_fun(
- &StateController::HMIStateStopped<HmiState::STATE_ID_NAVI_STREAMING>),
- this)
- );
- TempStateStopped(HmiState::STATE_ID_NAVI_STREAMING);
+ switch (state_id) {
+ case HmiState::STATE_ID_CURRENT:
+ case HmiState::STATE_ID_REGULAR:
+ return true;
+ default:
+ return IsTempStateActive(state_id);
+ }
+ return false;
}
-HmiStatePtr StateController::CreateHmiState(uint32_t app_id, HmiState::StateID state_id) {
+HmiStatePtr StateController::CreateHmiState(uint32_t app_id,
+ HmiState::StateID state_id) const {
+ using namespace utils;
LOG4CXX_AUTO_TRACE(logger_);
HmiStatePtr new_state;
switch (state_id) {
case HmiState::STATE_ID_PHONE_CALL: {
- new_state.reset(new PhoneCallHmiState(app_id, state_context_));
+ new_state = MakeShared<PhoneCallHmiState>(app_id, app_mngr_);
break;
}
case HmiState::STATE_ID_SAFETY_MODE: {
- new_state.reset(new SafetyModeHmiState(app_id, state_context_));
+ new_state = MakeShared<SafetyModeHmiState>(app_id, app_mngr_);
break;
}
case HmiState::STATE_ID_VR_SESSION: {
- new_state.reset(new VRHmiState(app_id, state_context_));
+ new_state = MakeShared<VRHmiState>(app_id, app_mngr_);
break;
}
case HmiState::STATE_ID_TTS_SESSION: {
- new_state.reset(new TTSHmiState(app_id, state_context_));
+ new_state = MakeShared<TTSHmiState>(app_id, app_mngr_);
break;
}
case HmiState::STATE_ID_NAVI_STREAMING: {
- new_state.reset(new NaviStreamingHmiState(app_id, state_context_));
+ new_state = MakeShared<NaviStreamingHmiState>(app_id, app_mngr_);
break;
}
case HmiState::STATE_ID_REGULAR: {
- new_state.reset(new HmiState(app_id, state_context_));
+ new_state = MakeShared<HmiState>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_POSTPONED: {
+ new_state = MakeShared<HmiState>(app_id, app_mngr_, state_id);
+ break;
+ }
+ case HmiState::STATE_ID_DEACTIVATE_HMI: {
+ new_state = MakeShared<DeactivateHMI>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_AUDIO_SOURCE: {
+ new_state = MakeShared<AudioSource>(app_id, app_mngr_);
+ break;
+ }
+ case HmiState::STATE_ID_EMBEDDED_NAVI: {
+ new_state = MakeShared<EmbeddedNavi>(app_id, app_mngr_);
break;
}
default:
@@ -433,4 +762,23 @@ HmiStatePtr StateController::CreateHmiState(uint32_t app_id, HmiState::StateID s
return new_state;
}
+mobile_apis::AudioStreamingState::eType StateController::CalcAudioState(
+ ApplicationSharedPtr app,
+ const mobile_apis::HMILevel::eType hmi_level) const {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ using helpers::Compare;
+ using helpers::EQ;
+ using helpers::ONE;
+
+ AudioStreamingState::eType audio_state = AudioStreamingState::NOT_AUDIBLE;
+ if (Compare<HMILevel::eType, EQ, ONE>(
+ hmi_level, HMILevel::HMI_FULL, HMILevel::HMI_LIMITED)) {
+ if (app->IsAudioApplication()) {
+ audio_state = AudioStreamingState::AUDIBLE;
+ }
+ }
+ return audio_state;
}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/src/usage_statistics.cc b/src/components/application_manager/src/usage_statistics.cc
index ad986d2223..12ae4df909 100644
--- a/src/components/application_manager/src/usage_statistics.cc
+++ b/src/components/application_manager/src/usage_statistics.cc
@@ -31,11 +31,11 @@
*/
#include "application_manager/usage_statistics.h"
-
#include "smart_objects/smart_object.h"
#include "smart_objects/enum_schema_item.h"
#include "usage_statistics/statistics_manager.h"
#include "utils/macro.h"
+#include "utils/make_shared.h"
using namespace mobile_apis;
using namespace NsSmartDeviceLink::NsSmartObjects;
@@ -53,21 +53,44 @@ std::string LanguageIdToString(Language::eType lang_id) {
} // namespace
+UsageStatistics::UsageStatistics(
+ const std::string& app_id,
+ utils::SharedPtr<StatisticsManager> statistics_manager)
+ : time_in_hmi_state_sptr_(
+ new usage_statistics::AppStopwatchImpl(statistics_manager, app_id))
+ , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI)
+ , app_registration_language_vui_(statistics_manager, app_id, LANGUAGE_VUI)
+ , count_of_rejected_rpc_calls_(
+ statistics_manager, app_id, REJECTED_RPC_CALLS)
+ , count_of_rpcs_sent_in_hmi_none_(
+ statistics_manager, app_id, RPCS_IN_HMI_NONE)
+ , count_of_user_selections_(statistics_manager, app_id, USER_SELECTIONS)
+ , count_of_run_attempts_while_revoked_(
+ statistics_manager, app_id, RUN_ATTEMPTS_WHILE_REVOKED)
+ , count_of_removals_for_bad_behavior_(
+ statistics_manager, app_id, REMOVALS_MISBEHAVED)
+ , count_of_tls_error_(statistics_manager, app_id, COUNT_OF_TLS_ERRORS) {
+ time_in_hmi_state_sptr_->Start(SECONDS_HMI_NONE);
+}
+
UsageStatistics::UsageStatistics(const std::string& app_id,
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager)
- : time_in_hmi_state_(statistics_manager, app_id),
- app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI),
- app_registration_language_vui_(statistics_manager, app_id, LANGUAGE_VUI),
- count_of_rejected_rpc_calls_(statistics_manager, app_id,
- REJECTED_RPC_CALLS),
- count_of_rpcs_sent_in_hmi_none_(statistics_manager, app_id,
- RPCS_IN_HMI_NONE),
- count_of_user_selections_(statistics_manager, app_id, USER_SELECTIONS),
- count_of_run_attempts_while_revoked_(statistics_manager, app_id,
- RUN_ATTEMPTS_WHILE_REVOKED),
- count_of_removals_for_bad_behavior_(statistics_manager, app_id,
- REMOVALS_MISBEHAVED) {
- time_in_hmi_state_.Start(SECONDS_HMI_NONE);
+ utils::SharedPtr<StatisticsManager> statistics_manager,
+ AppStopwatch* time_in_hmi_state_ptr)
+ : time_in_hmi_state_sptr_(time_in_hmi_state_ptr)
+ , app_registration_language_gui_(statistics_manager, app_id, LANGUAGE_GUI)
+ , app_registration_language_vui_(statistics_manager, app_id, LANGUAGE_VUI)
+ , count_of_rejected_rpc_calls_(
+ statistics_manager, app_id, REJECTED_RPC_CALLS)
+ , count_of_rpcs_sent_in_hmi_none_(
+ statistics_manager, app_id, RPCS_IN_HMI_NONE)
+ , count_of_user_selections_(statistics_manager, app_id, USER_SELECTIONS)
+ , count_of_run_attempts_while_revoked_(
+ statistics_manager, app_id, RUN_ATTEMPTS_WHILE_REVOKED)
+ , count_of_removals_for_bad_behavior_(
+ statistics_manager, app_id, REMOVALS_MISBEHAVED)
+ , count_of_tls_error_(statistics_manager, app_id, COUNT_OF_TLS_ERRORS) {
+ DCHECK(time_in_hmi_state_sptr_.get());
+ time_in_hmi_state_sptr_->Start(SECONDS_HMI_NONE);
}
void UsageStatistics::RecordHmiStateChanged(HMILevel::eType new_hmi_level) {
@@ -89,7 +112,7 @@ void UsageStatistics::RecordHmiStateChanged(HMILevel::eType new_hmi_level) {
default:
NOTREACHED();
}
- time_in_hmi_state_.Switch(next_stopwatch);
+ time_in_hmi_state_sptr_->Switch(next_stopwatch);
}
void UsageStatistics::RecordAppRegistrationGuiLanguage(
@@ -122,4 +145,8 @@ void UsageStatistics::RecordRemovalsForBadBehavior() {
++count_of_removals_for_bad_behavior_;
}
+void UsageStatistics::RecordTLSError() {
+ ++count_of_tls_error_;
+}
+
} // namespace application_manager
diff --git a/src/components/application_manager/test/CMakeLists.txt b/src/components/application_manager/test/CMakeLists.txt
index 473ae6765e..db5fd25660 100644
--- a/src/components/application_manager/test/CMakeLists.txt
+++ b/src/components/application_manager/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Ford Motor Company
+# Copyright (c) 2015, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -31,6 +31,33 @@
# TODO{ALeshin}: APPLINK-10792. Do not write tests which use
# application manager(AM) singleton while refactoring of AM is finished.
+if (BUILD_TESTS)
+
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/commands)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/commands/mobile)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/commands/hmi)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/event_engine)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/policies)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/policies/delegates)
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/resumption)
+
+ file (GLOB_RECURSE AMINCLUDE_TO_BE_MOCKED
+ ${AM_SOURCE_DIR}/include/application_manager/*
+ )
+ list(REMOVE_ITEM AMINCLUDE_TO_BE_MOCKED "${AM_SOURCE_DIR}/include/application_manager/application_manager_impl.h")
+ file(COPY "${AM_SOURCE_DIR}/test/mock/include/application_manager/application_manager_impl.h"
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/mock/include/application_manager/)
+
+ FOREACH(infileName ${AMINCLUDE_TO_BE_MOCKED})
+ file(RELATIVE_PATH rel "${AM_SOURCE_DIR}/" ${infileName})
+ execute_process(
+ COMMAND "${CMAKE_COMMAND}" "-E" "create_symlink" "${infileName}" "${CMAKE_CURRENT_BINARY_DIR}/mock/${rel}"
+ )
+ ENDFOREACH(infileName)
+
# Replace include for mocking singltone
get_property(the_include_dirs DIRECTORY "" PROPERTY INCLUDE_DIRECTORIES)
set(class_to_mock ${CMAKE_SOURCE_DIR}/src/components/application_manager/include)
@@ -45,52 +72,105 @@ include_directories(
${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include
${COMPONENTS_DIR}/application_manager/include/application_manager/
${COMPONENTS_DIR}/application_manager/include/application_manager/policies
+ ${COMPONENTS_DIR}/application_manager/include/application_manager/resumption
+ ${COMPONENTS_DIR}/application_manager/include/
+ ${COMPONENTS_DIR}/utils/include/utils/
+ ${COMPONENTS_DIR}/policy/test/include/
+ ${COMPONENTS_DIR}/security_manager/test/include/
+ ${COMPONENTS_DIR}/security_manager/include/
+ ${COMPONENTS_DIR}/include/utils/
+ ${COMPONENTS_DIR}/application_manager/test/resumption/include/
+ ${COMPONENTS_DIR}
)
set(testSources
- #${AM_TEST_DIR}/command_impl_test.cc
- ${COMPONENTS_DIR}/application_manager/test/mobile_message_handler_test.cc
- #${AM_TEST_DIR}/request_info_test.cc
-)
+ ${AM_TEST_DIR}/mobile_message_handler_test.cc
+ ${AM_TEST_DIR}/mobile_message_handler_v1_test.cc
+ ${AM_TEST_DIR}/request_info_test.cc
+ ${AM_TEST_DIR}/resumption_sql_queries_test.cc
+ ${AM_TEST_DIR}/event_engine_test.cc
+ ${AM_TEST_DIR}/usage_statistics_test.cc
+ # TODO(VVeremjova) APPLINK-12835
+ #${AM_TEST_DIR}/zero_request_amount_test.cc
+ )
+ set (request_controller_SOURCES
+ ${AM_TEST_DIR}/request_controller/request_controller_test.cc
+ )
-set(mockedSources
- ${AM_MOCK_DIR}/src/application_manager_impl.cc
-)
+ set(mockedSources ${AM_MOCK_DIR}/src/application_manager_impl.cc)
+
+ set(AM_SOURCES
+
+ ${AM_SOURCE_DIR}/src/policies/policy_handler.cc
+ ${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc
+ ${AM_SOURCE_DIR}/src/policies/delegates/app_permission_delegate.cc
+ ${AM_SOURCE_DIR}/src/policies/delegates/statistics_delegate.cc
+
+ ${AM_SOURCE_DIR}/src/event_engine/event_dispatcher_impl.cc
+ ${AM_SOURCE_DIR}/src/event_engine/event_observer.cc
+ ${AM_SOURCE_DIR}/src/event_engine/event.cc
+
+ ${AM_SOURCE_DIR}/src/commands/command_impl.cc
+ ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc
+ ${AM_SOURCE_DIR}/src/commands/command_response_impl.cc
+ ${AM_SOURCE_DIR}/src/commands/command_notification_impl.cc
+ ${AM_SOURCE_DIR}/src/commands/command_notification_from_mobile_impl.cc
+ ${AM_SOURCE_DIR}/src/commands/pending.cc
+
+ ${AM_SOURCE_DIR}/src/resumption/resume_ctrl.cc
+ ${AM_SOURCE_DIR}/src/resumption/resumption_data_db.cc
+ ${AM_SOURCE_DIR}/src/resumption/resumption_data_json.cc
+ ${AM_SOURCE_DIR}/src/resumption/resumption_data.cc
+ ${AM_SOURCE_DIR}/src/resumption/resumption_sql_queries.cc
+
+ ${AM_SOURCE_DIR}/src/usage_statistics.cc
+ ${AM_SOURCE_DIR}/src/request_info.cc
+ ${AM_SOURCE_DIR}/src/message.cc
+ ${AM_SOURCE_DIR}/src/application_impl.cc
+ ${AM_SOURCE_DIR}/src/application_state.cc
+ ${AM_SOURCE_DIR}/src/state_controller.cc
+ ${AM_SOURCE_DIR}/src/mobile_command_factory.cc
+ ${CMAKE_CURRENT_SOURCE_DIR}/include/application_manager/mock_message_helper.cc
+
+ ${AM_SOURCE_DIR}/src/hmi_command_factory.cc
+ ${AM_SOURCE_DIR}/src/hmi_state.cc
+
+ ${AM_SOURCE_DIR}/src/hmi_capabilities.cc
+ ${AM_SOURCE_DIR}/src/hmi_language_handler.cc
+ ${AM_SOURCE_DIR}/src/application_data_impl.cc
+ ${AM_SOURCE_DIR}/src/request_controller.cc
+
+ ${AM_SOURCE_DIR}/src/commands/mobile/register_app_interface_request.cc
+ ${AM_SOURCE_DIR}/src/commands/mobile/unregister_app_interface_request.cc
+
+ ${AM_SOURCE_DIR}/src/mobile_message_handler.cc
+ ${AM_SOURCE_DIR}/src/commands/mobile/put_file_request.cc
+ ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc
+ )
-set(AM_SOURCES
- ${AM_SOURCE_DIR}/src/policies/policy_handler.cc
- ${AM_SOURCE_DIR}/src/policies/policy_event_observer.cc
-
- ${AM_SOURCE_DIR}/src/commands/command_impl.cc
- ${AM_SOURCE_DIR}/src/commands/command_request_impl.cc
- ${AM_SOURCE_DIR}/src/commands/command_response_impl.cc
- ${AM_SOURCE_DIR}/src/commands/command_notification_impl.cc
- ${AM_SOURCE_DIR}/src/commands/command_notification_from_mobile_impl.cc
- ${AM_SOURCE_DIR}/src/commands/pending.cc
-
- ${AM_SOURCE_DIR}/src/usage_statistics.cc
- ${AM_SOURCE_DIR}/src/request_info.cc
- ${AM_SOURCE_DIR}/src/message.cc
- ${AM_SOURCE_DIR}/src/application_impl.cc
- ${AM_SOURCE_DIR}/src/state_controller.cc
- ${AM_SOURCE_DIR}/src/mobile_command_factory.cc
- ${AM_SOURCE_DIR}/src/message_helper.cc
- ${AM_SOURCE_DIR}/src/hmi_command_factory.cc
- ${AM_SOURCE_DIR}/src/hmi_capabilities.cc
- ${AM_SOURCE_DIR}/src/application_data_impl.cc
- ${AM_SOURCE_DIR}/src/request_controller.cc
- ${AM_SOURCE_DIR}/src/resume_ctrl.cpp
- ${AM_SOURCE_DIR}/src/mobile_message_handler.cc
-)
include_directories(
${AM_SOURCE_DIR}/policy/src/policy/policy_table/table_struct
)
set(testLibraries
- gmock
+ Utils
+ dbms
+ jsoncpp
+ Policy
+ connectionHandler
+ HMI_API
+ MOBILE_API
+ v4_protocol_v1_2_no_extra
+ SmartObjects
+ formatters
gmock_main
UsageStatistics
dl
ProtocolLibrary
+ ConfigProfile
+ MediaManager
+ Resumption
+ ProtocolHandler
+ SecurityManager
)
set(test_exec_libraries
@@ -140,5 +220,18 @@ target_link_libraries("application_manager_test"
Resumption
)
-#add_executable(application_manager_test ${testSources})
-#target_link_libraries(application_manager_test ApplicationManagerTest ${test_exec_libraries})
+# TODO [AKozoriz] : Fix not buildable tests
+ set(ResumptionData_SOURCES
+# ${AM_TEST_DIR}/resumption/resumption_data_test.cc
+# ${AM_TEST_DIR}/resumption/resumption_data_db_test.cc
+ )
+
+ file(COPY hmi_capabilities.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+ file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+
+ file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resumption)
+ file(COPY smartDeviceLink_test.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/resumption)
+ create_test("resumption/data_resumption_test" "${ResumptionData_SOURCES}" "${testLibraries}")
+
+ add_subdirectory(state_controller)
+endif()
diff --git a/src/components/application_manager/test/command_impl_test.cc b/src/components/application_manager/test/command_impl_test.cc
deleted file mode 100644
index 677515784f..0000000000
--- a/src/components/application_manager/test/command_impl_test.cc
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/commands/command_request_impl.h"
-#include "application_manager/message_helper.h"
-#include "application_manager/smart_object_keys.h"
-#include "interfaces/MOBILE_API.h"
-
-using ::testing::Return;
-using ::testing::Truly;
-
-
-bool MessageResultCodeIsGENERIC_ERROR(const utils::SharedPtr<smart_objects::SmartObject>& message) {
- if (!message) {
- return false;
- }
- const smart_objects::SmartObject& so = *(message.get());
- int32_t result_code = so[application_manager::strings::msg_params]
- [application_manager::strings::result_code].asInt();
- if (mobile_apis::Result::GENERIC_ERROR
- == static_cast<mobile_apis::Result::eType>(result_code)) {
- return true;
- } else {
- return false;
- }
-}
-
-TEST(ApplicationManager, SingletonInstance_CallTwice_ReferencesAreSame) {
- application_manager::ApplicationManagerImpl* am = application_manager::ApplicationManagerImpl::instance();
- application_manager::ApplicationManagerImpl* am2 = application_manager::ApplicationManagerImpl::instance();
- ASSERT_EQ(am, am2);
- //EXPECT_CALL((*am), GetNextHMICorrelationID()).WillRepeatedly(Return(1));
- //smart_objects::SmartObjectSPtr so = application_manager::MessageHelper::CreateModuleInfoSO(0);
- application_manager::ApplicationManagerImpl::destroy();
-}
-
-TEST(MobileCommandsTest, CommandImplTimeOut) {
- application_manager::ApplicationManagerImpl* am = application_manager::ApplicationManagerImpl::instance();
- smart_objects::SmartObjectSPtr so = application_manager::MessageHelper::CreateModuleInfoSO(0);
- application_manager::commands::CommandRequestImpl request(so);
- EXPECT_CALL((*am), ManageMobileCommand(Truly(MessageResultCodeIsGENERIC_ERROR)));
- request.onTimeOut();
- application_manager::ApplicationManagerImpl::destroy();
-}
diff --git a/src/components/application_manager/test/event_engine_test.cc b/src/components/application_manager/test/event_engine_test.cc
new file mode 100644
index 0000000000..1d110430cf
--- /dev/null
+++ b/src/components/application_manager/test/event_engine_test.cc
@@ -0,0 +1,179 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "event_engine/event_observer.h"
+#include "event_engine/event.h"
+#include "event_engine/event_dispatcher_impl.h"
+#include <interfaces/HMI_API.h>
+#include "mock/event_observer_mock.h"
+#include "smart_objects/smart_object.h"
+#include "gmock/gmock.h"
+#include "utils/make_shared.h"
+
+namespace test {
+namespace components {
+namespace event_engine {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+using application_manager::event_engine::EventDispatcherImpl;
+using application_manager::event_engine::Event;
+using application_manager::event_engine::EventObserver;
+using application_manager::event_engine::MockEventObserver;
+using testing::_;
+
+class EventEngineTest : public testing::Test {
+ public:
+ EventEngineTest()
+ : event_id(Event::EventID::BasicCommunication_ActivateApp),
+ event_id2(Event::EventID::BasicCommunication_OnAppActivated),
+ event_id3(Event::EventID::VR_IsReady) {}
+
+ protected:
+ EventDispatcherImpl* event_dispatcher_instance_;
+ Event* event_;
+ const application_manager::event_engine::Event::EventID event_id;
+ const application_manager::event_engine::Event::EventID event_id2;
+ const application_manager::event_engine::Event::EventID event_id3;
+ MockEventObserver event_observer_mock_;
+ const int32_t correlation_id = 1121;
+ smart_objects::SmartObject smart_object_with_type_notification;
+ smart_objects::SmartObject smart_object_with_type_response;
+ smart_objects::SmartObject smart_object_with_type_error_response;
+ smart_objects::SmartObject smart_object_with_type_request;
+ smart_objects::SmartObject smart_object_with_invalid_type;
+
+ virtual void SetUp() OVERRIDE {
+ EventDispatcherImpl::destroy();
+ event_dispatcher_instance_ = EventDispatcherImpl::instance();
+ event_ = new Event(hmi_apis::FunctionID::eType::VR_IsReady);
+ smart_object_with_type_notification["params"]["message_type"] =
+ hmi_apis::messageType::notification;
+ smart_object_with_type_notification["params"]["correlation_id"] =
+ correlation_id;
+ smart_object_with_type_notification["params"]["function_id"] =
+ hmi_apis::FunctionID::eType::VR_IsReady;
+
+ smart_object_with_type_response["params"]["message_type"] =
+ hmi_apis::messageType::response;
+ smart_object_with_type_response["params"]["correlation_id"] =
+ correlation_id;
+ smart_object_with_type_response["params"]["function_id"] =
+ hmi_apis::FunctionID::eType::VR_IsReady;
+
+ smart_object_with_type_error_response["params"]["message_type"] =
+ hmi_apis::messageType::error_response;
+ smart_object_with_type_error_response["params"]["correlation_id"] =
+ correlation_id;
+ smart_object_with_type_error_response["params"]["function_id"] =
+ hmi_apis::FunctionID::eType::VR_IsReady;
+
+ smart_object_with_type_request["params"]["message_type"] =
+ hmi_apis::messageType::request;
+ smart_object_with_type_request["params"]["correlation_id"] = correlation_id;
+ smart_object_with_type_request["params"]["function_id"] =
+ hmi_apis::FunctionID::eType::VR_IsReady;
+
+ smart_object_with_invalid_type["params"]["message_type"] =
+ hmi_apis::messageType::INVALID_ENUM;
+ smart_object_with_invalid_type["params"]["correlation_id"] = correlation_id;
+ smart_object_with_invalid_type["params"]["function_id"] =
+ hmi_apis::FunctionID::eType::VR_IsReady;
+ }
+
+ virtual void TearDown() OVERRIDE {
+ EventDispatcherImpl::destroy();
+ delete event_;
+ }
+
+ void CheckRaiseEvent(const Event::EventID& event_id,
+ const uint32_t calls_number,
+ const smart_objects::SmartObject& so) {
+ // Arrange
+ event_dispatcher_instance_->add_observer(event_id, correlation_id,
+ &event_observer_mock_);
+ event_->set_smart_object(so);
+ EXPECT_CALL(event_observer_mock_, on_event(_)).Times(calls_number);
+ event_dispatcher_instance_->raise_event(*event_);
+ }
+};
+
+TEST_F(EventEngineTest, EventObserverTest_ExpectObserversEmpty) {
+ // Arrange
+ EventObserver* event_observer_ptr =
+ static_cast<EventObserver*>(&event_observer_mock_);
+ // Check
+ EXPECT_EQ(reinterpret_cast<unsigned long>(event_observer_ptr),
+ event_observer_mock_.id());
+}
+
+TEST_F(EventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeResponse_ExpectEventRaised) {
+ CheckRaiseEvent(event_id3, 1u, smart_object_with_type_response);
+}
+
+TEST_F(EventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeErrorResponse_ExpectEventRaised) {
+ CheckRaiseEvent(event_id3, 1u, smart_object_with_type_error_response);
+}
+
+TEST_F(EventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeInvalid_ExpectEventNotRaised) {
+ CheckRaiseEvent(event_id3, 0u, smart_object_with_invalid_type);
+}
+
+TEST_F(EventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeRequest_ExpectEventNotRaised) {
+ CheckRaiseEvent(event_id3, 0u, smart_object_with_type_request);
+}
+
+TEST_F(
+ EventEngineTest,
+ EventDispatcherImpl_RaiseEvent_EventSOTypeNotification_ExpectEventNotRaised) {
+ CheckRaiseEvent(event_id3, 0u, smart_object_with_type_notification);
+}
+
+TEST_F(EventEngineTest, Event_set_smart_object_ExpectObjectSet) {
+ // Act
+ event_->set_smart_object(smart_object_with_type_notification);
+ const int32_t obj_type = static_cast<int32_t>(hmi_apis::messageType::notification);
+ const int32_t function_id =
+ static_cast<int32_t>(hmi_apis::FunctionID::eType::VR_IsReady);
+ // Checks
+ EXPECT_EQ(obj_type, event_->smart_object_type());
+ EXPECT_EQ(function_id, event_->smart_object_function_id());
+ EXPECT_EQ(correlation_id, event_->smart_object_correlation_id());
+ EXPECT_EQ(smart_object_with_type_notification, event_->smart_object());
+}
+
+} // namespace event_engine
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/hmi_capabilities.json b/src/components/application_manager/test/hmi_capabilities.json
new file mode 100644
index 0000000000..5632f86a51
--- /dev/null
+++ b/src/components/application_manager/test/hmi_capabilities.json
@@ -0,0 +1,460 @@
+{
+ "UI":
+ {
+ "language":"EN_US",
+ "languages":[
+ "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW",
+"JA_JP","AR_SA","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO"
+ ],
+ "displayCapabilities":
+ {
+ "displayType":"GEN2_8_DMA",
+ "textFields": [{
+ "name": "mainField1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField3",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mainField4",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "statusBar",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mediaClock",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "mediaTrack",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "alertText3",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "scrollableMessageBody",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "initialInteractionText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "ETA",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "totalDistance",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "navigationText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "audioPassThruDisplayText1",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "audioPassThruDisplayText2",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "sliderHeader",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "sliderFooter",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "notificationText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuName",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "secondaryText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "tertiaryText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "timeToDestination",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "turnText",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ },
+ {
+ "name": "menuTitle",
+ "characterSet": "TYPE2SET",
+ "width": 500,
+ "rows": 1
+ }
+ ],
+ "imageFields":
+ [
+ {
+ "name":"softButtonImage",
+ "imageTypeSupported":
+ [
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"choiceImage",
+ "imageTypeSupported":
+ [
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"choiceSecondaryImage",
+ "imageTypeSupported":
+ [
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"menuIcon",
+ "imageTypeSupported":
+ [
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"cmdIcon",
+ "imageTypeSupported":
+ [
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"appIcon",
+ "imageTypeSupported":
+ [
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"graphic",
+ "imageTypeSupported":
+ [
+
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ },
+ {
+ "name":"locationImage",
+ "imageTypeSupported":
+ [
+ "GRAPHIC_PNG"
+ ],
+ "imageResolution":
+ {
+ "resolutionWidth":35,
+ "resolutionHeight":35
+ }
+ }
+
+ ],
+ "mediaClockFormats":
+ [
+ "CLOCK1","CLOCK2","CLOCK3","CLOCKTEXT1","CLOCKTEXT2","CLOCKTEXT3","CLOCKTEXT4"
+ ],
+ "graphicSupported":true,
+ "templatesAvailable":
+ [
+
+ "DEFAULT","MEDIA","NON-MEDIA","ONSCREEN_PRESETS","NAV_FULLSCREEN_MAP","NAV_KEYBOARD",
+ "GRAPHIC_WITH_TEXT","TEXT_WITH_GRAPHIC","TILES_ONLY","TEXTBUTTONS_ONLY",
+ "GRAPHIC_WITH_TILES","TILES_WITH_GRAPHIC","GRAPHIC_WITH_TEXT_AND_SOFTBUTTONS",
+ "TEXT_AND_SOFTBUTTONS_WITH_GRAPHIC","GRAPHIC_WITH_TEXTBUTTONS",
+ "TEXTBUTTONS_WITH_GRAPHIC","LARGE_GRAPHIC_WITH_SOFTBUTTONS",
+ "DOUBLE_GRAPHIC_WITH_SOFTBUTTONS","LARGE_GRAPHIC_ONLY"
+ ],
+ "screenParams":
+ {
+ "resolution":
+ {
+ "resolutionWidth":800,
+ "resolutionHeight":350
+ },
+ "touchEventAvailable":
+ {
+ "pressAvailable":true,
+ "multiTouchAvailable":false,
+ "doublePressAvailable":false
+ }
+ },
+ "numCustomPresetsAvailable":8,
+ "imageCapabilities":
+ [
+ "DYNAMIC",
+ "STATIC"
+ ]
+ },
+ "audioPassThruCapabilities":
+ {
+ "samplingRate" : "44KHZ",
+ "bitsPerSample" : "RATE_8_BIT",
+ "audioType" : "PCM"
+ },
+ "hmiZoneCapabilities":"FRONT",
+ "softButtonCapabilities":
+ [
+ {
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true,
+ "imageSupported" :true
+ }
+ ]
+ },
+ "VR":
+ {
+ "capabilities":["TEXT"],
+ "language":"ES_MX",
+ "languages":
+ [
+ "AR_SA", "EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW",
+"JA_JP","KO_KR","PT_BR","CS_CZ","DA_DK","NO_NO"
+ ]
+},
+ "TTS":
+ {
+ "capabilities":"TEXT",
+ "language":"DE_DE",
+ "languages":
+ [
+ "DA_DK","CS_CZ","KO_KR","EN_US","ES_MX","FR_CA","DE_DE","ES_ES","EN_GB","RU_RU","TR_TR","PL_PL","FR_FR","IT_IT","SV_SE","PT_PT","NL_NL","ZH_TW",
+"JA_JP","AR_SA","PT_BR","NO_NO"
+ ]
+ },
+ "Buttons":
+ {
+ "capabilities":
+ [
+ {
+ "name":"PRESET_0",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_1",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_2",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_3",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_4",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_5",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_6",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_7",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_8",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"PRESET_9",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"OK",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"SEEKLEFT",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"SEEKRIGHT",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"TUNEUP",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ },
+ {
+ "name":"TUNEDOWN",
+ "shortPressAvailable":true,
+ "longPressAvailable" :true,
+ "upDownAvailable" :true
+ }
+ ],
+ "presetBankCapabilities":
+ {
+ "onScreenPresetsAvailable":true
+ }
+ },
+ "VehicleInfo":
+ {
+ "make" :"Ford",
+ "model" :"Fiesta",
+ "modelYear" :"2013",
+ "trim" :"SE"
+ },
+ "SyncMessageVersion":
+ {
+ "majorVersion": 3,
+ "minorVersion": 0
+ }
+}
diff --git a/src/components/application_manager/test/libPolicy.so b/src/components/application_manager/test/libPolicy.so
new file mode 100644
index 0000000000..0f2840d558
--- /dev/null
+++ b/src/components/application_manager/test/libPolicy.so
Binary files differ
diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt b/src/components/application_manager/test/message_helper/CMakeLists.txt
new file mode 100755
index 0000000000..7f4c3303b3
--- /dev/null
+++ b/src/components/application_manager/test/message_helper/CMakeLists.txt
@@ -0,0 +1,60 @@
+# Copyright (c) 2015, Ford Motor Company
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are met:
+#
+# Redistributions of source code must retain the above copyright notice, this
+# list of conditions and the following disclaimer.
+#
+# Redistributions in binary form must reproduce the above copyright notice,
+# this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided with the
+# distribution.
+#
+# Neither the name of the Ford Motor Company nor the names of its contributors
+# may be used to endorse or promote products derived from this software
+# without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+if(BUILD_TESTS)
+
+set(appMain_DIR ${CMAKE_SOURCE_DIR}/src/appMain)
+
+include_directories(
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/application_manager/test/message_helper/include
+ ${COMPONENTS_DIR}/application_manager/test/state_controller/include
+ ${COMPONENTS_DIR}/include
+ ${COMPONENTS_DIR}
+)
+
+set(LIBRARIES
+ gmock
+ ApplicationManager
+ jsoncpp
+ connectionHandler
+ MediaManager
+ Resumption
+ ProtocolHandler
+ Utils
+)
+
+set(SOURCES
+ #message_helper_test.cc
+)
+
+create_test("message_helper_test" "${SOURCES}" "${LIBRARIES}")
+
+endif()
diff --git a/src/components/application_manager/test/message_helper/CMakeLists.txt.user b/src/components/application_manager/test/message_helper/CMakeLists.txt.user
new file mode 100755
index 0000000000..e7522c1793
--- /dev/null
+++ b/src/components/application_manager/test/message_helper/CMakeLists.txt.user
@@ -0,0 +1,189 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE QtCreatorProject>
+<!-- Written by QtCreator 3.5.1, 2015-11-19T12:59:06. -->
+<qtcreator>
+ <data>
+ <variable>EnvironmentId</variable>
+ <value type="QByteArray">{6965f0e8-9b58-4b26-8426-81354d6c3400}</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.ActiveTarget</variable>
+ <value type="int">0</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.EditorSettings</variable>
+ <valuemap type="QVariantMap">
+ <value type="bool" key="EditorConfiguration.AutoIndent">true</value>
+ <value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
+ <value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
+ <value type="QString" key="language">Cpp</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
+ </valuemap>
+ </valuemap>
+ <valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
+ <value type="QString" key="language">QmlJS</value>
+ <valuemap type="QVariantMap" key="value">
+ <value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
+ </valuemap>
+ </valuemap>
+ <value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
+ <value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
+ <value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
+ <value type="int" key="EditorConfiguration.IndentSize">4</value>
+ <value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
+ <value type="int" key="EditorConfiguration.MarginColumn">80</value>
+ <value type="bool" key="EditorConfiguration.MouseHiding">true</value>
+ <value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
+ <value type="int" key="EditorConfiguration.PaddingMode">1</value>
+ <value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
+ <value type="bool" key="EditorConfiguration.ShowMargin">false</value>
+ <value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
+ <value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
+ <value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
+ <value type="int" key="EditorConfiguration.TabSize">8</value>
+ <value type="bool" key="EditorConfiguration.UseGlobal">true</value>
+ <value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
+ <value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
+ <value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
+ <value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
+ <value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.PluginSettings</variable>
+ <valuemap type="QVariantMap"/>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Target.0</variable>
+ <valuemap type="QVariantMap">
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop Qt 5.5.1 GCC 64bit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop Qt 5.5.1 GCC 64bit</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">qt.55.gcc_64_kit</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
+ <value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
+ <value type="bool" key="CMakeProjectManager.CMakeBuildConfiguration.UseNinja">false</value>
+ <value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/oherasym/sdl_panasonic/src/components/application_manager/test/message_helper-build</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
+ <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
+ <value type="bool" key="CMakeProjectManager.MakeStep.Clean">false</value>
+ <value type="QString" key="CMakeProjectManager.MakeStep.MakeCommand"></value>
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
+ </valuemap>
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
+ <value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments">clean</value>
+ <valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
+ <value type="bool" key="CMakeProjectManager.MakeStep.Clean">true</value>
+ <value type="QString" key="CMakeProjectManager.MakeStep.MakeCommand"></value>
+ <value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
+ <value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
+ <valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">all</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
+ <valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
+ <value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
+ <valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
+ <value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
+ <value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
+ <value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
+ <value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
+ <value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
+ <value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
+ <value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
+ <value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
+ <value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
+ <value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
+ <valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
+ <value type="int">0</value>
+ <value type="int">1</value>
+ <value type="int">2</value>
+ <value type="int">3</value>
+ <value type="int">4</value>
+ <value type="int">5</value>
+ <value type="int">6</value>
+ <value type="int">7</value>
+ <value type="int">8</value>
+ <value type="int">9</value>
+ <value type="int">10</value>
+ <value type="int">11</value>
+ <value type="int">12</value>
+ <value type="int">13</value>
+ <value type="int">14</value>
+ </valuelist>
+ <value type="int" key="PE.EnvironmentAspect.Base">2</value>
+ <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
+ <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.WorkingDirectory">%{buildDir}</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Custom Executable</value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
+ <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.CustomExecutableRunConfiguration</value>
+ <value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
+ <value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
+ <value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
+ <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
+ </valuemap>
+ <value type="int" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
+ </valuemap>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.TargetCount</variable>
+ <value type="int">1</value>
+ </data>
+ <data>
+ <variable>ProjectExplorer.Project.Updater.FileVersion</variable>
+ <value type="int">18</value>
+ </data>
+ <data>
+ <variable>Version</variable>
+ <value type="int">18</value>
+ </data>
+</qtcreator>
diff --git a/src/components/application_manager/test/message_helper/message_helper_test.cc b/src/components/application_manager/test/message_helper/message_helper_test.cc
new file mode 100755
index 0000000000..b6ed63b101
--- /dev/null
+++ b/src/components/application_manager/test/message_helper/message_helper_test.cc
@@ -0,0 +1,865 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "utils/macro.h"
+#include "utils/make_shared.h"
+#include "application_manager/policies/policy_handler.h"
+#include "application_manager/test/resumption/include/application_mock.h"
+#include "utils/custom_string.h"
+
+namespace application_manager {
+namespace test {
+
+namespace HmiLanguage = hmi_apis::Common_Language;
+namespace HmiResults = hmi_apis::Common_Result;
+namespace MobileResults = mobile_apis::Result;
+
+typedef ::test::components::resumption_test::MockApplication AppMock;
+typedef utils::SharedPtr<AppMock> MockApplicationSharedPtr;
+typedef std::vector<std::string> StringArray;
+typedef ::application_manager::Application App;
+typedef utils::SharedPtr<App> ApplicationSharedPtr;
+
+using testing::AtLeast;
+using testing::ReturnRefOfCopy;
+using testing::ReturnRef;
+using testing::Return;
+
+TEST(MessageHelperTestCreate,
+ CreateBlockedByPoliciesResponse_SmartObject_Equal) {
+ mobile_apis::FunctionID::eType function_id =
+ mobile_apis::FunctionID::eType::AddCommandID;
+ mobile_apis::Result::eType result = mobile_apis::Result::eType::ABORTED;
+ uint32_t correlation_id = 0;
+ uint32_t connection_key = 0;
+ bool success = false;
+
+ smart_objects::SmartObjectSPtr ptr =
+ MessageHelper::CreateBlockedByPoliciesResponse(
+ function_id, result, correlation_id, connection_key);
+
+ EXPECT_TRUE(ptr);
+
+ smart_objects::SmartObject& obj = *ptr;
+
+ EXPECT_EQ(function_id,
+ obj[strings::params][strings::function_id].asInt());
+ EXPECT_EQ(kResponse,
+ obj[strings::params][strings::message_type].asInt());
+ EXPECT_EQ(success,
+ obj[strings::msg_params][strings::success].asBool());
+ EXPECT_EQ(result,
+ obj[strings::msg_params][strings::result_code].asInt());
+ EXPECT_EQ(correlation_id,
+ obj[strings::params][strings::correlation_id].asUInt());
+ EXPECT_EQ(connection_key,
+ obj[strings::params][strings::connection_key].asUInt());
+ EXPECT_EQ(kV2,
+ obj[strings::params][strings::protocol_version].asInt());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateSetAppIcon_SendNullPathImagetype_Equal) {
+ std::string path_to_icon = "";
+ uint32_t app_id = 0;
+ smart_objects::SmartObjectSPtr ptr =
+ MessageHelper::CreateSetAppIcon(path_to_icon, app_id);
+
+ EXPECT_TRUE(ptr);
+
+ smart_objects::SmartObject& obj = *ptr;
+
+ int image_type = static_cast<int>(mobile_api::ImageType::DYNAMIC);
+
+ EXPECT_EQ(path_to_icon,
+ obj[strings::sync_file_name][strings::value].asString());
+ EXPECT_EQ(image_type,
+ obj[strings::sync_file_name][strings::image_type].asInt());
+ EXPECT_EQ(app_id, obj[strings::app_id].asUInt());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateSetAppIcon_SendPathImagetype_Equal) {
+ std::string path_to_icon = "/qwe/qwe/";
+ uint32_t app_id = 10;
+ smart_objects::SmartObjectSPtr ptr =
+ MessageHelper::CreateSetAppIcon(path_to_icon, app_id);
+
+ EXPECT_TRUE(ptr);
+
+ smart_objects::SmartObject& obj = *ptr;
+
+ int image_type = static_cast<int>(mobile_api::ImageType::DYNAMIC);
+
+ EXPECT_EQ(path_to_icon,
+ obj[strings::sync_file_name][strings::value].asString());
+ EXPECT_EQ(image_type,
+ obj[strings::sync_file_name][strings::image_type].asInt());
+ EXPECT_EQ(app_id, obj[strings::app_id].asUInt());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateGlobalPropertiesRequestsToHMI_SmartObject_EmptyList) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+
+ EXPECT_CALL(*appSharedMock, vr_help_title()).Times(AtLeast(1));
+ EXPECT_CALL(*appSharedMock, vr_help()).Times(AtLeast(1));
+ EXPECT_CALL(*appSharedMock, help_prompt()).Times(AtLeast(1));
+ EXPECT_CALL(*appSharedMock, timeout_prompt()).Times(AtLeast(1));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateGlobalPropertiesRequestsToHMI(appSharedMock);
+
+ EXPECT_TRUE(ptr.empty());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateGlobalPropertiesRequestsToHMI_SmartObject_NotEmpty) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ smart_objects::SmartObjectSPtr objPtr =
+ MakeShared<smart_objects::SmartObject>();
+
+ (*objPtr)[0][strings::vr_help_title] = "111";
+ (*objPtr)[1][strings::vr_help] = "222";
+ (*objPtr)[2][strings::keyboard_properties] = "333";
+ (*objPtr)[3][strings::menu_title] = "444";
+ (*objPtr)[4][strings::menu_icon] = "555";
+ (*objPtr)[5][strings::help_prompt] = "666";
+ (*objPtr)[6][strings::timeout_prompt] = "777";
+
+ EXPECT_CALL(*appSharedMock,
+ vr_help_title()).Times(AtLeast(3)).WillRepeatedly(Return(&(*objPtr)[0]));
+ EXPECT_CALL(*appSharedMock,
+ vr_help()).Times(AtLeast(2)).WillRepeatedly(Return(&(*objPtr)[1]));
+ EXPECT_CALL(*appSharedMock,
+ help_prompt()).Times(AtLeast(3)).WillRepeatedly(Return(&(*objPtr)[5]));
+ EXPECT_CALL(*appSharedMock,
+ timeout_prompt()).Times(AtLeast(2)).WillRepeatedly(Return(&(*objPtr)[6]));
+ EXPECT_CALL(*appSharedMock,
+ keyboard_props()).Times(AtLeast(2)).WillRepeatedly(Return(&(*objPtr)[2]));
+ EXPECT_CALL(*appSharedMock,
+ menu_title()).Times(AtLeast(2)).WillRepeatedly(Return(&(*objPtr)[3]));
+ EXPECT_CALL(*appSharedMock,
+ menu_icon()).Times(AtLeast(2)).WillRepeatedly(Return(&(*objPtr)[4]));
+ EXPECT_CALL(*appSharedMock, app_id()).WillRepeatedly(Return(0));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateGlobalPropertiesRequestsToHMI(appSharedMock);
+
+ EXPECT_FALSE(ptr.empty());
+
+ smart_objects::SmartObject& first = *ptr[0];
+ smart_objects::SmartObject& second = *ptr[1];
+
+ EXPECT_EQ((*objPtr)[0], first[strings::msg_params][strings::vr_help_title]);
+ EXPECT_EQ((*objPtr)[1], first[strings::msg_params][strings::vr_help]);
+ EXPECT_EQ((*objPtr)[2], first[strings::msg_params][strings::keyboard_properties]);
+ EXPECT_EQ((*objPtr)[3], first[strings::msg_params][strings::menu_title]);
+ EXPECT_EQ((*objPtr)[4], first[strings::msg_params][strings::menu_icon]);
+ EXPECT_EQ((*objPtr)[5], second[strings::msg_params][strings::help_prompt]);
+ EXPECT_EQ((*objPtr)[6], second[strings::msg_params][strings::timeout_prompt]);
+}
+
+TEST(MessageHelperTestCreate,
+ CreateShowRequestToHMI_SendSmartObject_Equal) {
+ MockApplicationSharedPtr appSharedMock =
+ utils::MakeShared<AppMock>();
+
+ smart_objects::SmartObjectSPtr smartObjectPtr =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ const smart_objects::SmartObject& object = *smartObjectPtr;
+
+ EXPECT_CALL(*appSharedMock,
+ show_command()).Times(AtLeast(2)).WillRepeatedly(Return(&object));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateShowRequestToHMI(appSharedMock);
+
+ EXPECT_FALSE(ptr.empty());
+
+ smart_objects::SmartObject& obj = *ptr[0];
+
+ int function_id = static_cast<int>(hmi_apis::FunctionID::UI_Show);
+
+ EXPECT_EQ(function_id, obj[strings::params][strings::function_id].asInt());
+ EXPECT_EQ(*smartObjectPtr, obj[strings::msg_params]);
+}
+
+TEST(MessageHelperTestCreate,
+ CreateAddCommandRequestToHMI_SendSmartObject_Empty) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ CommandsMap vis;
+ DataAccessor< CommandsMap> data_accessor(vis, true);
+
+ EXPECT_CALL(*appSharedMock,
+ commands_map()).WillOnce(Return(data_accessor));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddCommandRequestToHMI(appSharedMock);
+
+ EXPECT_TRUE(ptr.empty());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateAddCommandRequestToHMI_SendSmartObject_Equal) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ CommandsMap vis;
+ DataAccessor< CommandsMap> data_accessor(vis, true);
+ smart_objects::SmartObjectSPtr smartObjectPtr =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ smart_objects::SmartObject& object = *smartObjectPtr;
+
+ object[strings::menu_params] = 1;
+ object[strings::cmd_icon] = 1;
+ object[strings::cmd_icon][strings::value] = "10";
+
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(5, &object));
+
+ EXPECT_CALL(*appSharedMock,
+ commands_map()).WillOnce(Return(data_accessor));
+ EXPECT_CALL(*appSharedMock,
+ app_id()).WillOnce(Return(1u));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddCommandRequestToHMI(appSharedMock);
+
+ EXPECT_FALSE(ptr.empty());
+
+ smart_objects::SmartObject& obj = *ptr[0];
+
+ int function_id = static_cast<int>(hmi_apis::FunctionID::UI_AddCommand);
+
+ EXPECT_EQ(function_id, obj[strings::params][strings::function_id].asInt());
+ EXPECT_EQ(1u, obj[strings::msg_params][strings::app_id].asUInt());
+ EXPECT_EQ(5, obj[strings::msg_params][strings::cmd_id].asInt());
+ EXPECT_EQ(object[strings::menu_params],
+ obj[strings::msg_params][strings::menu_params]);
+ EXPECT_EQ(object[strings::cmd_icon],
+ obj[strings::msg_params][strings::cmd_icon]);
+ EXPECT_EQ("10", obj[strings::msg_params]
+ [strings::cmd_icon][strings::value].asString());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateAddVRCommandRequestFromChoiceToHMI_SendEmptyData_EmptyList) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ application_manager::ChoiceSetMap vis;
+ DataAccessor< ::application_manager::ChoiceSetMap> data_accessor(vis, true);
+
+ EXPECT_CALL(*appSharedMock,
+ choice_set_map()).WillOnce(Return(data_accessor));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(appSharedMock);
+
+ EXPECT_TRUE(ptr.empty());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateAddVRCommandRequestFromChoiceToHMI_SendObject_EqualList) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ application_manager::ChoiceSetMap vis;
+ DataAccessor< ::application_manager::ChoiceSetMap> data_accessor(vis, true);
+ smart_objects::SmartObjectSPtr smartObjectPtr =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ smart_objects::SmartObject& object = *smartObjectPtr;
+
+ object[strings::choice_set] = "10";
+ object[strings::grammar_id] = 111;
+ object[strings::choice_set][0][strings::choice_id] = 1;
+ object[strings::choice_set][0][strings::vr_commands] = 2;
+
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(5, &object));
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(6, &object));
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(7, &object));
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(8, &object));
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(9, &object));
+
+ EXPECT_CALL(*appSharedMock,
+ choice_set_map()).WillOnce(Return(data_accessor));
+ EXPECT_CALL(*appSharedMock,
+ app_id()).Times(AtLeast(5)).WillRepeatedly(Return(1u));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(appSharedMock);
+
+ EXPECT_FALSE(ptr.empty());
+
+ int function_id = static_cast<int>(hmi_apis::FunctionID::VR_AddCommand);
+ int type = static_cast<int>(hmi_apis::Common_VRCommandType::Choice);
+
+ smart_objects::SmartObject& obj = *ptr[0];
+
+ EXPECT_EQ(function_id, obj[strings::params][strings::function_id].asInt());
+ EXPECT_EQ(1u, obj[strings::msg_params][strings::app_id].asUInt());
+ EXPECT_EQ(111u, obj[strings::msg_params][strings::grammar_id].asUInt());
+ EXPECT_EQ(object[strings::choice_set][0][strings::choice_id],
+ obj[strings::msg_params][strings::cmd_id]);
+ EXPECT_EQ(object[strings::choice_set][0][strings::vr_commands],
+ obj[strings::msg_params][strings::vr_commands]);
+ EXPECT_EQ(type, obj[strings::msg_params][strings::type].asInt());
+}
+
+TEST(MessageHelperTestCreate, CreateAddSubMenuRequestToHMI_SendObject_Equal) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ application_manager::SubMenuMap vis;
+ DataAccessor< ::application_manager::SubMenuMap> data_accessor(vis, true);
+ smart_objects::SmartObjectSPtr smartObjectPtr =
+ utils::MakeShared<smart_objects::SmartObject>();
+
+ smart_objects::SmartObject& object = *smartObjectPtr;
+
+ object[strings::position] = 1;
+ object[strings::menu_name] = 1;
+
+ vis.insert(std::pair<uint32_t,
+ smart_objects::SmartObject*>(5, &object));
+
+ EXPECT_CALL(*appSharedMock,
+ sub_menu_map() ).WillOnce(Return(data_accessor));
+ EXPECT_CALL(*appSharedMock,
+ app_id()).Times(AtLeast(1)).WillOnce(Return(1u));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddSubMenuRequestToHMI(appSharedMock);
+
+ EXPECT_FALSE(ptr.empty());
+
+ smart_objects::SmartObject& obj = *ptr[0];
+
+ int function_id = static_cast<int>(hmi_apis::FunctionID::UI_AddSubMenu);
+
+ EXPECT_EQ(function_id,
+ obj[strings::params][strings::function_id].asInt());
+ EXPECT_EQ(5,
+ obj[strings::msg_params][strings::menu_id].asInt());
+ EXPECT_EQ(1,
+ obj[strings::msg_params]
+ [strings::menu_params][strings::position].asInt());
+ EXPECT_EQ(1, obj[strings::msg_params]
+ [strings::menu_params][strings::menu_name].asInt());
+ EXPECT_EQ(1u,
+ obj[strings::msg_params][strings::app_id].asUInt());
+}
+
+TEST(MessageHelperTestCreate,
+ CreateAddSubMenuRequestToHMI_SendEmptyMap_EmptySmartObjectList) {
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ application_manager::SubMenuMap vis;
+ DataAccessor< ::application_manager::SubMenuMap> data_accessor(vis, true);
+
+ EXPECT_CALL(*appSharedMock,
+ sub_menu_map() ).WillOnce(Return(data_accessor));
+
+ smart_objects::SmartObjectList ptr =
+ MessageHelper::CreateAddSubMenuRequestToHMI(appSharedMock);
+
+ EXPECT_TRUE(ptr.empty());
+}
+
+TEST(MessageHelperTestCreate, CreateNegativeResponse_SendSmartObject_Equal) {
+ uint32_t connection_key = 111;
+ int32_t function_id = 222;
+ uint32_t correlation_id = 333u;
+ int32_t result_code = 0;
+
+ smart_objects::SmartObjectSPtr ptr =
+ MessageHelper::CreateNegativeResponse(connection_key, function_id,
+ correlation_id, result_code);
+
+ EXPECT_TRUE(ptr);
+
+ smart_objects::SmartObject& obj = *ptr;
+
+ int objFunction_id =
+ obj[strings::params][strings::function_id].asInt();
+ uint32_t objCorrelation_id =
+ obj[strings::params][strings::correlation_id].asUInt();
+ int objResult_code =
+ obj[strings::msg_params][strings::result_code].asInt();
+ uint32_t objConnection_key =
+ obj[strings::params][strings::connection_key].asUInt();
+
+ int message_type =
+ static_cast<int>(mobile_apis::messageType::response);
+ int protocol_type =
+ static_cast<int>(commands::CommandImpl::mobile_protocol_type_);
+ int protocol_version =
+ static_cast<int>(commands::CommandImpl::protocol_version_);
+ bool success = false;
+
+ EXPECT_EQ(function_id, objFunction_id);
+ EXPECT_EQ(message_type,
+ obj[strings::params][strings::message_type].asInt());
+ EXPECT_EQ(protocol_type,
+ obj[strings::params][strings::protocol_type].asInt());
+ EXPECT_EQ(protocol_version,
+ obj[strings::params][strings::protocol_version].asInt());
+ EXPECT_EQ(correlation_id, objCorrelation_id);
+ EXPECT_EQ(result_code, objResult_code);
+ EXPECT_EQ(success,
+ obj[strings::msg_params][strings::success].asBool());
+ EXPECT_EQ(connection_key, objConnection_key);
+}
+
+class MessageHelperTest : public ::testing::Test {
+ public:
+ MessageHelperTest() :
+ language_strings {
+ "EN-US", "ES-MX", "FR-CA", "DE-DE", "ES-ES", "EN-GB", "RU-RU",
+ "TR-TR", "PL-PL", "FR-FR", "IT-IT", "SV-SE", "PT-PT", "NL-NL",
+ "EN-AU", "ZH-CN", "ZH-TW", "JA-JP", "AR-SA", "KO-KR", "PT-BR",
+ "CS-CZ", "DA-DK", "NO-NO", "NL-BE", "EL-GR", "HU-HU", "FI-FI",
+ "SK-SK"
+ },
+ hmi_result_strings {
+ "SUCCESS", "UNSUPPORTED_REQUEST", "UNSUPPORTED_RESOURCE",
+ "DISALLOWED", "REJECTED", "ABORTED",
+ "IGNORED", "RETRY", "IN_USE",
+ "DATA_NOT_AVAILABLE", "TIMED_OUT", "INVALID_DATA",
+ "CHAR_LIMIT_EXCEEDED", "INVALID_ID", "DUPLICATE_NAME",
+ "APPLICATION_NOT_REGISTERED", "WRONG_LANGUAGE", "OUT_OF_MEMORY",
+ "TOO_MANY_PENDING_REQUESTS", "NO_APPS_REGISTERED",
+ "NO_DEVICES_CONNECTED", "WARNINGS", "GENERIC_ERROR",
+ "USER_DISALLOWED", "TRUNCATED_DATA"
+ },
+ mobile_result_strings {
+ "SUCCESS", "UNSUPPORTED_REQUEST", "UNSUPPORTED_RESOURCE",
+ "DISALLOWED", "REJECTED", "ABORTED",
+ "IGNORED", "RETRY", "IN_USE",
+ "VEHICLE_DATA_NOT_AVAILABLE", "TIMED_OUT", "INVALID_DATA",
+ "CHAR_LIMIT_EXCEEDED", "INVALID_ID", "DUPLICATE_NAME",
+ "APPLICATION_NOT_REGISTERED", "WRONG_LANGUAGE", "OUT_OF_MEMORY",
+ "TOO_MANY_PENDING_REQUESTS", "TOO_MANY_APPLICATIONS",
+ "APPLICATION_REGISTERED_ALREADY", "WARNINGS", "GENERIC_ERROR",
+ "USER_DISALLOWED", "UNSUPPORTED_VERSION", "VEHICLE_DATA_NOT_ALLOWED",
+ "FILE_NOT_FOUND", "CANCEL_ROUTE", "TRUNCATED_DATA",
+ "SAVED", "INVALID_CERT", "EXPIRED_CERT", "RESUME_FAILED"
+ },
+ function_id_strings {
+ "RESERVED", "RegisterAppInterface", "UnregisterAppInterface",
+ "SetGlobalProperties", "ResetGlobalProperties", "AddCommand",
+ "DeleteCommand", "AddSubMenu", "DeleteSubMenu",
+ "CreateInteractionChoiceSet", "PerformInteraction",
+ "DeleteInteractionChoiceSet", "Alert", "Show", "Speak",
+ "SetMediaClockTimer", "PerformAudioPassThru", "EndAudioPassThru",
+ "SubscribeButton", "UnsubscribeButton", "SubscribeVehicleData",
+ "UnsubscribeVehicleData", "GetVehicleData", "ReadDID",
+ "GetDTCs", "ScrollableMessage", "Slider",
+ "ShowConstantTBT", "AlertManeuver", "UpdateTurnList",
+ "ChangeRegistration", "GenericResponse", "PutFile",
+ "DeleteFile", "ListFiles", "SetAppIcon",
+ "SetDisplayLayout", "DiagnosticMessage", "SystemRequest",
+ "SendLocation", "DialNumber"
+ },
+ events_id_strings {
+ "OnHMIStatus", "OnAppInterfaceUnregistered", "OnButtonEvent",
+ "OnButtonPress", "OnVehicleData", "OnCommand",
+ "OnTBTClientState", "OnDriverDistraction", "OnPermissionsChange",
+ "OnAudioPassThru", "OnLanguageChange", "OnKeyboardInput",
+ "OnTouchEvent", "OnSystemRequest", "OnHashChange"
+ },
+ hmi_level_strings {
+ "FULL", "LIMITED",
+ "BACKGROUND", "NONE"
+ },
+ delta_from_functions_id(32768) {}
+
+ protected:
+ const StringArray language_strings;
+ const StringArray hmi_result_strings;
+ const StringArray mobile_result_strings;
+ const StringArray function_id_strings;
+ const StringArray events_id_strings;
+ const StringArray hmi_level_strings;
+
+ const size_t delta_from_functions_id;
+};
+
+TEST_F(MessageHelperTest,
+ CommonLanguageFromString_StringValueOfEnum_CorrectEType) {
+ HmiLanguage::eType enum_value;
+ HmiLanguage::eType enum_from_string_value;
+ // Check all languages >= 0
+ for (size_t array_index = 0;
+ array_index < language_strings.size();
+ ++array_index) {
+ enum_value = static_cast<HmiLanguage::eType>(array_index);
+ enum_from_string_value = MessageHelper::CommonLanguageFromString(
+ language_strings[array_index]);
+ EXPECT_EQ(enum_value, enum_from_string_value);
+ }
+ // Check InvalidEnum == -1
+ enum_value = HmiLanguage::INVALID_ENUM;
+ enum_from_string_value = MessageHelper::CommonLanguageFromString("");
+ EXPECT_EQ(enum_value, enum_from_string_value);
+}
+
+TEST_F(MessageHelperTest,
+ CommonLanguageToString_ETypeValueOfEnum_CorrectString) {
+ std::string string_from_enum;
+ HmiLanguage::eType casted_enum;
+ // Check all languages >=0
+ for (size_t array_index = 0;
+ array_index < language_strings.size();
+ ++array_index) {
+ casted_enum = static_cast<HmiLanguage::eType>(array_index);
+ string_from_enum = MessageHelper::CommonLanguageToString(casted_enum);
+ EXPECT_EQ(language_strings[array_index], string_from_enum);
+ }
+ // Check InvalidEnum == -1
+ string_from_enum = MessageHelper::CommonLanguageToString(
+ HmiLanguage::INVALID_ENUM);
+ EXPECT_EQ("", string_from_enum);
+}
+
+TEST_F(MessageHelperTest,
+ ConvertEnumAPINoCheck_AnyEnumType_AnotherEnumType) {
+ hmi_apis::Common_LayoutMode::eType tested_enum_value =
+ hmi_apis::Common_LayoutMode::ICON_ONLY;
+ hmi_apis::Common_AppHMIType::eType converted =
+ MessageHelper::ConvertEnumAPINoCheck <hmi_apis::Common_LayoutMode::eType,
+ hmi_apis::Common_AppHMIType::eType>(tested_enum_value);
+ EXPECT_EQ(hmi_apis::Common_AppHMIType::DEFAULT, converted);
+}
+
+TEST_F(MessageHelperTest,
+ HMIResultFromString_StringValueOfEnum_CorrectEType) {
+ HmiResults::eType enum_value;
+ HmiResults::eType enum_from_string_value;
+ // Check all results >= 0
+ for (size_t array_index = 0;
+ array_index < hmi_result_strings.size();
+ ++array_index) {
+ enum_value = static_cast<HmiResults::eType>(array_index);
+ enum_from_string_value =
+ MessageHelper::HMIResultFromString(hmi_result_strings[array_index]);
+ EXPECT_EQ(enum_value, enum_from_string_value);
+ }
+ // Check InvalidEnum == -1
+ enum_value = HmiResults::INVALID_ENUM;
+ enum_from_string_value = MessageHelper::HMIResultFromString("");
+ EXPECT_EQ(enum_value, enum_from_string_value);
+}
+
+TEST_F(MessageHelperTest,
+ HMIResultToString_ETypeValueOfEnum_CorrectString) {
+ std::string string_from_enum;
+ HmiResults::eType casted_enum;
+ // Check all results >=0
+ for (size_t array_index = 0;
+ array_index < hmi_result_strings.size();
+ ++array_index) {
+ casted_enum = static_cast<HmiResults::eType>(array_index);
+ string_from_enum = MessageHelper::HMIResultToString(casted_enum);
+ EXPECT_EQ(hmi_result_strings[array_index], string_from_enum);
+ }
+ // Check InvalidEnum == -1
+ string_from_enum = MessageHelper::HMIResultToString(
+ HmiResults::INVALID_ENUM);
+ EXPECT_EQ("", string_from_enum);
+}
+
+TEST_F(MessageHelperTest,
+ HMIToMobileResult_HmiResultEType_GetCorrectMobileResultEType) {
+ MobileResults::eType tested_enum;
+ HmiResults::eType casted_hmi_enum;
+ MobileResults::eType converted_enum;
+ // Check enums >=0
+ for (size_t enum_index = 0;
+ enum_index < hmi_result_strings.size();
+ ++enum_index) {
+ tested_enum =
+ MessageHelper::MobileResultFromString(hmi_result_strings[enum_index]);
+ casted_hmi_enum = static_cast<HmiResults::eType>(enum_index);
+ converted_enum = MessageHelper::HMIToMobileResult(casted_hmi_enum);
+ EXPECT_EQ(tested_enum, converted_enum);
+ }
+ // Check invalid enums == -1
+ tested_enum = MobileResults::INVALID_ENUM;
+ converted_enum = MessageHelper::HMIToMobileResult(HmiResults::INVALID_ENUM);
+ EXPECT_EQ(tested_enum, converted_enum);
+ // Check when out of range (true == result.empty())
+ casted_hmi_enum = static_cast<HmiResults::eType>(INT_MAX);
+ converted_enum = MessageHelper::HMIToMobileResult(casted_hmi_enum);
+ EXPECT_EQ(tested_enum, converted_enum);
+}
+
+TEST_F(MessageHelperTest, VerifySoftButtonString_WrongStrings_False) {
+ const StringArray wrong_strings {
+ "soft_button1\t\ntext",
+ "soft_button1\\ntext",
+ "soft_button1\\ttext",
+ " ",
+ "soft_button1\t\n",
+ "soft_button1\\n",
+ "soft_button1\\t"
+ };
+ for (size_t i = 0; i < wrong_strings.size(); ++i) {
+ EXPECT_FALSE(MessageHelper::VerifySoftButtonString(wrong_strings[i]));
+ }
+}
+
+TEST_F(MessageHelperTest, VerifySoftButtonString_CorrectStrings_True) {
+ const StringArray wrong_strings {
+ "soft_button1.text",
+ "soft_button1?text",
+ " asd asdasd .././/",
+ "soft_button1??....asd",
+ "soft_button12313fcvzxc./.,"
+ };
+ for (size_t i = 0; i < wrong_strings.size(); ++i) {
+ EXPECT_TRUE(MessageHelper::VerifySoftButtonString(wrong_strings[i]));
+ }
+}
+
+TEST_F(MessageHelperTest,
+ GetIVISubscriptionRequests_ValidApplication_HmiRequestNotEmpty) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating data acessor
+ application_manager::VehicleInfoSubscriptions vis;
+ DataAccessor<application_manager::VehicleInfoSubscriptions>
+ data_accessor(vis, true);
+ // Calls for ApplicationManager
+ EXPECT_CALL(*appSharedMock, app_id() )
+ .WillOnce(Return(1u));
+ EXPECT_CALL(*appSharedMock, SubscribedIVI())
+ .WillOnce(Return(data_accessor));
+ smart_objects::SmartObjectList outList =
+ MessageHelper::GetIVISubscriptionRequests(appSharedMock);
+ // Expect not empty request
+ EXPECT_FALSE(outList.empty());
+}
+
+TEST_F(MessageHelperTest,
+ ProcessSoftButtons_SmartObjectWithoutButtonsKey_Success) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject object;
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::ProcessSoftButtons(object, appSharedMock);
+ // Expect
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
+}
+
+TEST_F(MessageHelperTest,
+ ProcessSoftButtons_IncorectSoftButonValue_InvalidData) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject object;
+ smart_objects::SmartObject& buttons = object[strings::soft_buttons];
+ // Setting invalid image string to button
+ buttons[0][strings::image][strings::value] = "invalid\\nvalue";
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::ProcessSoftButtons(object, appSharedMock);
+ // Expect
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
+}
+
+TEST_F(MessageHelperTest,
+ VerifyImage_ImageTypeIsStatic_Success) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject image;
+ image[strings::image_type] = mobile_apis::ImageType::STATIC;
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::VerifyImage(image, appSharedMock);
+ // EXPECT
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
+}
+
+TEST_F(MessageHelperTest,
+ VerifyImage_ImageValueNotValid_InvalidData) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject image;
+ image[strings::image_type] = mobile_apis::ImageType::DYNAMIC;
+ // Invalid value
+ image[strings::value] = " ";
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::VerifyImage(image, appSharedMock);
+ // EXPECT
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
+}
+
+
+TEST_F(MessageHelperTest,
+ VerifyImageFiles_SmartObjectWithValidData_Success) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject images;
+ images[0][strings::image_type] = mobile_apis::ImageType::STATIC;
+ images[1][strings::image_type] = mobile_apis::ImageType::STATIC;
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::VerifyImageFiles(images, appSharedMock);
+ // EXPECT
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
+}
+
+TEST_F(MessageHelperTest,
+ VerifyImageFiles_SmartObjectWithInvalidData_NotSuccsess) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject images;
+ images[0][strings::image_type] = mobile_apis::ImageType::DYNAMIC;
+ images[1][strings::image_type] = mobile_apis::ImageType::DYNAMIC;
+ // Invalid values
+ images[0][strings::value] = " ";
+ images[1][strings::value] = "image\\n";
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::VerifyImageFiles(images, appSharedMock);
+ // EXPECT
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
+}
+
+TEST_F(MessageHelperTest,
+ VerifyImageVrHelpItems_SmartObjectWithSeveralValidImages_Succsess) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject message;
+ message[0][strings::image][strings::image_type] =
+ mobile_apis::ImageType::STATIC;
+ message[1][strings::image][strings::image_type] =
+ mobile_apis::ImageType::STATIC;
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::VerifyImageVrHelpItems(message, appSharedMock);
+ // EXPECT
+ EXPECT_EQ(mobile_apis::Result::SUCCESS, result);
+}
+
+TEST_F(MessageHelperTest,
+ VerifyImageVrHelpItems_SmartObjWithSeveralInvalidImages_NotSuccsess) {
+ // Creating sharedPtr to MockApplication
+ MockApplicationSharedPtr appSharedMock = utils::MakeShared<AppMock>();
+ // Creating input data for method
+ smart_objects::SmartObject message;
+ message[0][strings::image][strings::image_type] =
+ mobile_apis::ImageType::DYNAMIC;
+ message[1][strings::image][strings::image_type] =
+ mobile_apis::ImageType::DYNAMIC;
+ // Invalid values
+ message[0][strings::image][strings::value] = " ";
+ message[1][strings::image][strings::value] = "image\\n";
+ // Method call
+ mobile_apis::Result::eType result =
+ MessageHelper::VerifyImageVrHelpItems(message, appSharedMock);
+ // EXPECT
+ EXPECT_EQ(mobile_apis::Result::INVALID_DATA, result);
+}
+
+TEST_F(MessageHelperTest,
+ StringifiedFunctionID_FinctionId_EqualsWithStringsInArray) {
+ // Start from 1 because 1 == RESERVED and haven`t ID in last 2 characters
+ // if FUNCTION ID == 1 inner DCHECK is false
+ mobile_apis::FunctionID::eType casted_enum;
+ std::string converted;
+ for (size_t i = 1; i < function_id_strings.size(); ++i) {
+ casted_enum = static_cast<mobile_apis::FunctionID::eType>(i);
+ converted = MessageHelper::StringifiedFunctionID(casted_enum);
+ EXPECT_EQ(function_id_strings[i], converted);
+ }
+ // EventIDs emum strarts from delta_from_functions_id = 32768
+ for (size_t i = delta_from_functions_id;
+ i < events_id_strings.size() + delta_from_functions_id;
+ ++i) {
+ casted_enum = static_cast<mobile_apis::FunctionID::eType>(i);
+ converted = MessageHelper::StringifiedFunctionID(casted_enum);
+ EXPECT_EQ(events_id_strings[i - delta_from_functions_id], converted);
+ }
+}
+
+TEST_F(MessageHelperTest,
+ StringifiedHmiLevel_LevelEnum_EqualsWithStringsInArray) {
+ mobile_apis::HMILevel::eType casted_enum;
+ std::string converted_value;
+ for (size_t i = 0; i < hmi_level_strings.size(); ++i) {
+ casted_enum = static_cast<mobile_apis::HMILevel::eType>(i);
+ converted_value = MessageHelper::StringifiedHMILevel(casted_enum);
+ EXPECT_EQ(hmi_level_strings[i], converted_value);
+ }
+}
+
+TEST_F(MessageHelperTest,
+ StringToHmiLevel_LevelString_EqEType) {
+ mobile_apis::HMILevel::eType tested_enum;
+ mobile_apis::HMILevel::eType converted_enum;
+ for (size_t i = 0; i < hmi_level_strings.size(); ++i) {
+ tested_enum = static_cast<mobile_apis::HMILevel::eType>(i);
+ converted_enum = MessageHelper::StringToHMILevel(hmi_level_strings[i]);
+ EXPECT_EQ(tested_enum, converted_enum);
+ }
+}
+
+TEST_F(MessageHelperTest,
+ SubscribeApplicationToSoftButton_CallFromApp) {
+ // Create application mock
+ MockApplicationSharedPtr appSharedPtr = utils::MakeShared<AppMock>();
+ // Prepare data for method
+ smart_objects::SmartObject message_params;
+ size_t function_id = 1;
+ //
+ EXPECT_CALL(*appSharedPtr,
+ SubscribeToSoftButtons(function_id, SoftButtonID())).Times(1);
+ MessageHelper::SubscribeApplicationToSoftButton(
+ message_params, appSharedPtr, function_id);
+}
+
+} // namespace test
+} // namespace application_manager
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 ec144826a8..bf25b9270f 100644
--- a/src/components/application_manager/test/mobile_message_handler_test.cc
+++ b/src/components/application_manager/test/mobile_message_handler_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,19 +30,212 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include "application_manager/mobile_message_handler.h"
+
+#include <string>
+#include <ctime>
+#include <algorithm>
+#include <iterator>
+#include <vector>
#include "gmock/gmock.h"
-#include "application_manager/mobile_message_handler.h"
+#include "application_manager/message.h"
+#include "protocol/raw_message.h"
+#include "utils/make_shared.h"
+namespace application_manager {
+namespace test {
+using protocol_handler::RawMessage;
+using protocol_handler::RawMessagePtr;
+using protocol_handler::ServiceType;
+using protocol_handler::MessagePriority;
+using protocol_handler::PROTOCOL_HEADER_V2_SIZE;
+using application_manager::MobileMessageHandler;
+using application_manager::ProtocolVersion;
using ::testing::_;
-namespace application_manager {
+using testing::Return;
+
+namespace {
+
+const unsigned char kJjson_size = 0x5e;
+const unsigned char kCorrelation_id = 0x5c;
+unsigned char binary_header[PROTOCOL_HEADER_V2_SIZE] = {
+ 0x20, 0x00, 0x00, 0xf7,
+ 0x00, 0x00, 0x00, kCorrelation_id,
+ 0x00, 0x00, 0x00, kJjson_size};
+
+std::string data(
+ "{\n \"audioStreamingState\" : \"AUDIBLE\",\n \"hmiLevel\" : "
+ "\"FULL\",\n \"systemContext\" : \"MAIN\"\n}\n");
+
+} // namespace
+
+template <class T, class T2, class T3>
+T joiner(T2 begin, T2 end, const T3& data) {
+ T cont(begin, end);
+ std::copy(data.begin(), data.end(), std::back_inserter(cont));
+ return cont;
+}
+
+class MobileMessageHandlerTest : public testing::Test {
+ public:
+ MobileMessageHandlerTest() : connection_key_(1) {}
+
+ protected:
+ RawMessagePtr message_ptr_;
+ const uint32_t connection_key_;
+
+ Message* HandleIncomingMessage(const uint32_t protocol_version,
+ const std::string data,
+ const uint32_t payload_size) {
+ std::vector<uint8_t> full_data = joiner<std::vector<uint8_t> >(
+ binary_header, binary_header + PROTOCOL_HEADER_V2_SIZE, data);
+
+ size_t full_size = sizeof(uint8_t) * full_data.size();
+
+ message_ptr_ = utils::MakeShared<RawMessage>(
+ connection_key_, protocol_version, &full_data[0], full_size,
+ ServiceType::kRpc, payload_size);
+
+ return MobileMessageHandler::HandleIncomingMessageProtocol(message_ptr_);
+ }
+
+ void TestHandlingIncomingMessageWithBinaryDataProtocol(
+ int32_t protocol_version) {
+ // Arrange
+ // Add binary data to json message
+ std::string binary_data("\a\a\a\a");
+ std::string json_plus_binary_data =
+ joiner<std::string>(data.begin(), data.end(), binary_data);
+ size_t full_data_size = json_plus_binary_data.size() * sizeof(uint8_t) +
+ PROTOCOL_HEADER_V2_SIZE;
+
+ // Act
+ size_t payload_size = data.size();
+ Message* message = HandleIncomingMessage(
+ protocol_version, json_plus_binary_data, payload_size);
+
+ // Checks
+ EXPECT_EQ(data, message->json_message());
+ EXPECT_EQ(1, message->connection_key());
+ EXPECT_EQ(247, message->function_id());
+ EXPECT_EQ(protocol_version, message->protocol_version());
+ EXPECT_EQ(0x5c, message->correlation_id());
+ EXPECT_EQ(full_data_size, message->data_size());
+ EXPECT_EQ(payload_size, message->payload_size());
+ EXPECT_TRUE(message->has_binary_data());
+ EXPECT_EQ(MessageType::kNotification, message->type());
+ }
+
+ void TestHandlingIncomingMessageWithoutBinaryDataProtocol(
+ uint32_t protocol_version) {
+ // Arrange
+ size_t payload_size = data.size();
+ size_t full_data_size = data.size() + PROTOCOL_HEADER_V2_SIZE;
+ Message* message =
+ HandleIncomingMessage(protocol_version, data, payload_size);
+
+ // Checks
+ EXPECT_EQ(data, message->json_message());
+ EXPECT_EQ(1, message->connection_key());
+ EXPECT_EQ(247, message->function_id());
+ EXPECT_EQ(protocol_version, (uint32_t)message->protocol_version());
+ EXPECT_EQ(0x5c, message->correlation_id());
+ EXPECT_EQ(full_data_size, message->data_size());
+ EXPECT_EQ(payload_size, message->payload_size());
+ EXPECT_FALSE(message->has_binary_data());
+ EXPECT_EQ(MessageType::kNotification, message->type());
+ }
+
+ MobileMessage CreateMessageForSending(uint32_t protocol_version,
+ uint32_t function_id,
+ uint32_t correlation_id,
+ uint32_t connection_key,
+ const std::string& json_msg,
+ BinaryData* data = NULL) {
+ MobileMessage message = utils::MakeShared<Message>(
+ MessagePriority::FromServiceType(ServiceType::kRpc));
+ message->set_function_id(function_id);
+ message->set_correlation_id(correlation_id);
+ message->set_connection_key(connection_key);
+ message->set_protocol_version(
+ static_cast<ProtocolVersion>(protocol_version));
+ message->set_message_type(MessageType::kNotification);
+ if (data) {
+ message->set_binary_data(data);
+ }
+ if (!json_msg.empty()) {
+ message->set_json_message(json_msg);
+ }
+ return message;
+ }
+
+ void TestHandlingOutgoingMessageProtocolWithoutBinaryData(
+ const uint32_t protocol_version) {
+ // Arrange
+ const uint32_t function_id = 247u;
+ const uint32_t correlation_id = 92u;
+ const uint32_t connection_key = 1u;
+
+ MobileMessage message_to_send = CreateMessageForSending(
+ protocol_version, function_id, correlation_id, connection_key, data);
+ // Act
+ RawMessage* result_message =
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message_to_send);
+
+ std::vector<uint8_t> full_data = joiner<std::vector<uint8_t> >(
+ binary_header, binary_header + PROTOCOL_HEADER_V2_SIZE, data);
+
+ size_t full_size = sizeof(uint8_t) * full_data.size();
+
+ // Checks
+ EXPECT_EQ(protocol_version, result_message->protocol_version());
+ EXPECT_EQ(connection_key, result_message->connection_key());
+ EXPECT_EQ(full_size, result_message->data_size());
+ for (uint8_t i = 0; i < full_data.size(); ++i) {
+ EXPECT_EQ(full_data[i], result_message->data()[i]);
+ }
+ EXPECT_EQ(ServiceType::kRpc, result_message->service_type());
+ }
+
+ void TestHandlingOutgoingMessageProtocolWithBinaryData(
+ const uint32_t protocol_version) {
+ // Arrange
+ BinaryData* bin_dat = new BinaryData;
+ bin_dat->push_back('\a');
+
+ const uint32_t function_id = 247u;
+ const uint32_t correlation_id = 92u;
+ const uint32_t connection_key = 1u;
+
+ MobileMessage message_to_send =
+ CreateMessageForSending(protocol_version, function_id, correlation_id,
+ connection_key, data, bin_dat);
+ // Act
+ RawMessage* result_message =
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message_to_send);
+ std::vector<uint8_t> full_data = joiner<std::vector<uint8_t> >(
+ binary_header, binary_header + PROTOCOL_HEADER_V2_SIZE, data);
+ size_t full_size =
+ sizeof(uint8_t) * full_data.size() + bin_dat->size() * sizeof(uint8_t);
+
+ // Checks
+ EXPECT_EQ(protocol_version, result_message->protocol_version());
+ EXPECT_EQ(connection_key, result_message->connection_key());
+ EXPECT_EQ(full_size, result_message->data_size());
+ for (uint8_t i = 0; i < full_data.size(); ++i) {
+ EXPECT_EQ(full_data[i], result_message->data()[i]);
+ }
+ EXPECT_EQ(0x0F, result_message->service_type());
+ }
+};
TEST(mobile_message_test, basic_test) {
// Example message
- MobileMessage message = new application_manager::Message(
- protocol_handler::MessagePriority::kDefault);
+ MobileMessage message =
+ utils::MakeShared<Message>(protocol_handler::MessagePriority::kDefault);
EXPECT_FALSE(message->has_binary_data());
BinaryData* binary_data = new BinaryData;
binary_data->push_back('X');
@@ -50,4 +243,98 @@ TEST(mobile_message_test, basic_test) {
EXPECT_TRUE(message->has_binary_data());
}
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleIncomingMessageProtocol_MessageWithUnknownProtocolVersion_ExpectNull) {
+ // Arrange
+ size_t payload_size = data.size();
+ std::srand(time(0));
+ // Generate unknown random protocol version except 1-3
+ uint32_t protocol_version = 4 + rand() % UINT32_MAX;
+ Message* message =
+ HandleIncomingMessage(protocol_version, data, payload_size);
+
+ // Checks
+ EXPECT_EQ(NULL, message);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleOutgoingMessageProtocol_MessageWithUnknownProtocolVersion_ExpectNull) {
+ // Arrange
+ std::srand(time(0));
+
+ const uint32_t function_id = 247u;
+ const uint32_t correlation_id = 92u;
+ const uint32_t connection_key = 1u;
+ // Generate unknown random protocol version except 1-3
+ uint32_t protocol_version = 4 + rand() % UINT32_MAX;
+
+ MobileMessage message_to_send = CreateMessageForSending(
+ protocol_version, function_id, correlation_id, connection_key, data);
+ // Act
+ RawMessage* result_message =
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message_to_send);
+
+ // Check
+ EXPECT_EQ(NULL, result_message);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleIncomingMessageProtocol_MessageWithProtocolV2_WithoutBinaryData) {
+ const uint32_t protocol_version = 2u;
+ TestHandlingIncomingMessageWithoutBinaryDataProtocol(protocol_version);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleIncomingMessageProtocol_MessageWithProtocolV3_WithoutBinaryData) {
+ const uint32_t protocol_version = 3u;
+ TestHandlingIncomingMessageWithoutBinaryDataProtocol(protocol_version);
}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleIncomingMessageProtocol_MessageWithProtocolV2_WithBinaryData) {
+ const uint32_t protocol_version = 2u;
+ TestHandlingIncomingMessageWithBinaryDataProtocol(protocol_version);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleIncomingMessageProtocol_MessageWithProtocolV3_WithBinaryData) {
+ const uint32_t protocol_version = 3u;
+ TestHandlingIncomingMessageWithBinaryDataProtocol(protocol_version);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleOutgoingMessageProtocol_MessageWithProtocolV2_WithoutBinaryData) {
+ const uint32_t protocol_version = 2u;
+ TestHandlingOutgoingMessageProtocolWithoutBinaryData(protocol_version);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleOutgoingMessageProtocol_MessageWithProtocolV3_WithoutBinaryData) {
+ const uint32_t protocol_version = 3u;
+ TestHandlingOutgoingMessageProtocolWithoutBinaryData(protocol_version);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleOutgoingMessageProtocol_MessageWithProtocolV2_WithBinaryData) {
+ const uint32_t protocol_version = 2u;
+ TestHandlingOutgoingMessageProtocolWithBinaryData(protocol_version);
+}
+
+TEST_F(
+ MobileMessageHandlerTest,
+ Test_HandleOutgoingMessageProtocol_MessageWithProtocolV3_WithBinaryData) {
+ const uint32_t protocol_version = 3u;
+ TestHandlingOutgoingMessageProtocolWithBinaryData(protocol_version);
+}
+
+} // namespace test
+} // namespace application_manager
diff --git a/src/components/application_manager/test/mobile_message_handler_v1_test.cc b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
new file mode 100644
index 0000000000..9d20e93e16
--- /dev/null
+++ b/src/components/application_manager/test/mobile_message_handler_v1_test.cc
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/mobile_message_handler.h"
+
+#include <string>
+#include <vector>
+#include <algorithm>
+#include <iterator>
+
+#include "gmock/gmock.h"
+#include "application_manager/message.h"
+#include "protocol/raw_message.h"
+#include "utils/make_shared.h"
+
+using protocol_handler::RawMessage;
+using protocol_handler::RawMessagePtr;
+using protocol_handler::PROTOCOL_HEADER_V1_SIZE;
+
+namespace application_manager {
+namespace test {
+
+const int32_t connection_key_p1 = 1;
+const int32_t protocol_version_1 = 1;
+
+const std::string data_json("\"{\"menu\": {\"id\": \"file\",\"va"
+ "lue\": \"File\",\"popup\": {\"menuitem\": [ {\"val"
+ "ue\": \"New\", \"onclick\": \"CreateNe"
+ "wDoc()\"}, {\"value\": \"Open\", \"oncli"
+ "ck\": \"OpenDoc()\"},{\"value\": \"Cl"
+ "ose\", \"onclick\": \"CloseDoc()\"}]}}}\"");
+
+const unsigned char binary[PROTOCOL_HEADER_V1_SIZE] = {
+ 0x20, 0x00, 0x00, 0xf7,
+ 0x00, 0x00, 0x00, 0x10 };
+
+const unsigned char* data_v1 =
+ reinterpret_cast<const unsigned char*> (data_json.c_str());
+
+TEST(MobileMessageHandlerTestV1Test,
+ HandleIncomingMessageProtocolV1_SendJSONData_ExpectEqual) {
+ RawMessagePtr message =
+ utils::MakeShared<RawMessage>
+ (connection_key_p1, protocol_version_1, data_v1, data_json.length());
+
+ application_manager::Message* ptr =
+ MobileMessageHandler::HandleIncomingMessageProtocol(message);
+
+ ASSERT_TRUE(ptr);
+
+ EXPECT_EQ(connection_key_p1, ptr->connection_key());
+ EXPECT_EQ(protocol_version_1, ptr->protocol_version());
+ EXPECT_EQ(data_json, ptr->json_message());
+}
+
+TEST(MobileMessageHandlerTestV1Test,
+ HandleIncomingMessageProtocolV1_SendBinaryJSONData_ExpectEqual) {
+
+ std::string full_data(reinterpret_cast<const char*>(binary));
+ full_data += data_json;
+ const unsigned char* data_v1 =
+ reinterpret_cast<const unsigned char*> (full_data.c_str());
+
+ RawMessagePtr message =
+ utils::MakeShared<RawMessage>
+ (connection_key_p1, protocol_version_1, data_v1, full_data.length());
+
+ application_manager::Message* ptr =
+ MobileMessageHandler::HandleIncomingMessageProtocol(message);
+
+ ASSERT_TRUE(ptr);
+
+ EXPECT_EQ(connection_key_p1, ptr->connection_key());
+ EXPECT_EQ(protocol_version_1, ptr->protocol_version());
+ EXPECT_EQ(full_data, ptr->json_message());
+}
+
+TEST(MobileMessageHandlerTestV1Test,
+ HandleOutgoingMessageProtocol_SendMessage_ExpectEqual) {
+
+ uint32_t connection_key = 1;
+
+ MobileMessage message =
+ utils::MakeShared<Message>
+ (protocol_handler::MessagePriority::kDefault);
+
+ message->set_protocol_version(application_manager::ProtocolVersion::kV1);
+ message->set_json_message(data_json);
+ message->set_connection_key(connection_key_p1);
+
+ RawMessage* ptr =
+ MobileMessageHandler::HandleOutgoingMessageProtocol(message);
+
+ ASSERT_TRUE(ptr);
+
+ EXPECT_EQ(connection_key, ptr->connection_key());
+ EXPECT_EQ(static_cast<uint32_t>(application_manager::ProtocolVersion::kV1),
+ ptr->protocol_version());
+}
+
+} // namespace test
+} // namespace application_manager
diff --git a/src/components/application_manager/test/mock/event_observer_mock.h b/src/components/application_manager/test/mock/event_observer_mock.h
new file mode 100644
index 0000000000..3e25c2b084
--- /dev/null
+++ b/src/components/application_manager/test/mock/event_observer_mock.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_EVENT_OBSERVER_MOCK_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_EVENT_OBSERVER_MOCK_H_
+
+#include "application_manager/event_engine/event_observer.h"
+#include "application_manager/event_engine/event.h"
+#include "gmock/gmock.h"
+
+namespace application_manager {
+namespace event_engine {
+
+class MockEventObserver : public EventObserver {
+ public:
+ MOCK_METHOD1(on_event, void(const application_manager::event_engine::Event& event));
+};
+
+} // namespace event_engine
+} // namespace application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_EVENT_OBSERVER_MOCK_H_
+
diff --git a/src/components/application_manager/test/mock/include/application_manager/application.h b/src/components/application_manager/test/mock/include/application_manager/application.h
deleted file mode 120000
index 7b86b18d4b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/application.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/application.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/application_data_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_data_impl.h
deleted file mode 120000
index a53ea11d5b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/application_data_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/application_data_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/application_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_impl.h
deleted file mode 120000
index 838885790a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/application_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/application_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/application_manager.h b/src/components/application_manager/test/mock/include/application_manager/application_manager.h
deleted file mode 120000
index d9f08e4c22..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/application_manager.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/application_manager.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h b/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
index bc6a4e6ba4..ae8f195c71 100644
--- a/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
+++ b/src/components/application_manager/test/mock/include/application_manager/application_manager_impl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,34 +30,37 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
#include <stdint.h>
#include <vector>
#include <map>
#include <set>
+
+#include "gmock/gmock.h"
+
#include "application_manager/hmi_command_factory.h"
#include "application_manager/application_manager.h"
#include "application_manager/hmi_capabilities.h"
#include "application_manager/message.h"
#include "application_manager/request_controller.h"
-#include "application_manager/resume_ctrl.h"
+#include "application_manager/resumption/resume_ctrl.h"
#include "application_manager/vehicle_info_data.h"
#include "application_manager/state_controller.h"
+#include "application_manager/commands/command.h"
#include "protocol_handler/protocol_observer.h"
#include "protocol_handler/protocol_handler.h"
#include "hmi_message_handler/hmi_message_observer.h"
#include "hmi_message_handler/hmi_message_sender.h"
+#include "application_manager/policies/policy_handler_observer.h"
#include "media_manager/media_manager_impl.h"
#include "connection_handler/connection_handler_observer.h"
#include "connection_handler/device.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
#include "interfaces/HMI_API.h"
#include "interfaces/HMI_API_schema.h"
@@ -65,9 +68,9 @@
#include "interfaces/v4_protocol_v1_2_no_extra.h"
#include "interfaces/v4_protocol_v1_2_no_extra_schema.h"
-#ifdef TIME_TESTER
-#include "time_metric_observer.h"
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+#include "telemetry_observer.h"
+#endif // TELEMETRY_MONITOR
#include "utils/macro.h"
#include "utils/shared_ptr.h"
@@ -77,31 +80,26 @@
#include "utils/threads/message_loop_thread.h"
#include "utils/lock.h"
#include "utils/singleton.h"
+#include "utils/data_accessor.h"
namespace application_manager {
- enum VRTTSSessionChanging {
- kVRSessionChanging = 0,
- kTTSSessionChanging
- };
+enum VRTTSSessionChanging { kVRSessionChanging = 0, kTTSSessionChanging };
namespace impl {
-struct MessageFromMobile: public utils::SharedPtr<Message> {
+struct MessageFromMobile : public utils::SharedPtr<Message> {
explicit MessageFromMobile(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {
- }
+ : utils::SharedPtr<Message>(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
}
};
-struct MessageToMobile: public utils::SharedPtr<Message> {
+struct MessageToMobile : public utils::SharedPtr<Message> {
explicit MessageToMobile(const utils::SharedPtr<Message>& message,
bool final_message)
- : utils::SharedPtr<Message>(message),
- is_final(final_message) {
- }
+ : utils::SharedPtr<Message>(message), is_final(final_message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
@@ -110,174 +108,240 @@ struct MessageToMobile: public utils::SharedPtr<Message> {
bool is_final;
};
-struct MessageFromHmi: public utils::SharedPtr<Message> {
+struct MessageFromHmi : public utils::SharedPtr<Message> {
explicit MessageFromHmi(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {
- }
+ : utils::SharedPtr<Message>(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
}
};
-struct MessageToHmi: public utils::SharedPtr<Message> {
+struct MessageToHmi : public utils::SharedPtr<Message> {
explicit MessageToHmi(const utils::SharedPtr<Message>& message)
- : utils::SharedPtr<Message>(message) {
- }
+ : utils::SharedPtr<Message>(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const {
return (*this)->Priority().OrderingValue();
}
};
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile> > FromMobileQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile> > ToMobileQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi> > FromHmiQueue;
-typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi> > ToHmiQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromMobile>>
+ FromMobileQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToMobile>>
+ ToMobileQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageFromHmi>>
+ FromHmiQueue;
+typedef threads::MessageLoopThread<utils::PrioritizedQueue<MessageToHmi>>
+ ToHmiQueue;
// AudioPassThru
-typedef struct {
-std::vector<uint8_t> binary_data;
-int32_t session_key;
+typedef struct {
+ std::vector<uint8_t> binary_data;
+ int32_t session_key;
} AudioData;
-typedef std::queue<AudioData> RawAudioDataQueue;
-typedef threads::MessageLoopThread<RawAudioDataQueue> AudioPassThruQueue;
+typedef std::queue<AudioData> RawAudioDataQueue;
+typedef threads::MessageLoopThread<RawAudioDataQueue> AudioPassThruQueue;
}
typedef std::vector<std::string> RPCParams;
-class ApplicationManagerImpl : public ApplicationManager,
- public hmi_message_handler::HMIMessageObserver,
- public protocol_handler::ProtocolObserver,
- public connection_handler::ConnectionHandlerObserver,
- public impl::FromMobileQueue::Handler, public impl::ToMobileQueue::Handler,
- public impl::FromHmiQueue::Handler, public impl::ToHmiQueue::Handler,
- public impl::AudioPassThruQueue::Handler,
- public utils::Singleton<ApplicationManagerImpl> {
-
- friend class ResumeCtrl;
- friend class CommandImpl;
+class ApplicationManagerImpl
+ : public ApplicationManager,
+ public hmi_message_handler::HMIMessageObserver,
+ public protocol_handler::ProtocolObserver,
+ public policy::PolicyHandlerObserver,
+ public connection_handler::ConnectionHandlerObserver,
+ public impl::FromMobileQueue::Handler,
+ public impl::ToMobileQueue::Handler,
+ public impl::FromHmiQueue::Handler,
+ public impl::ToHmiQueue::Handler,
+ public impl::AudioPassThruQueue::Handler,
+ public utils::Singleton<ApplicationManagerImpl> {
+ friend class ResumeCtrl;
+ friend class CommandImpl;
public:
- ApplicationManagerImpl() {
- std::cout << "ApplicationManagerImpl Mock created " << std::endl;
- }
+ ApplicationManagerImpl() {
+ std::cout << "ApplicationManagerImpl Mock created \n";
+ }
MOCK_METHOD0(Init, bool());
MOCK_METHOD0(Stop, bool());
- MOCK_METHOD1(OnMessageReceived, void (utils::SharedPtr<application_manager::Message>));
- MOCK_METHOD1(OnErrorSending, void (utils::SharedPtr<application_manager::Message>));
- MOCK_METHOD1(OnMessageReceived, void (const ::protocol_handler::RawMessagePtr));
- MOCK_METHOD1(OnMobileMessageSent, void (const ::protocol_handler::RawMessagePtr));
- MOCK_METHOD1(OnDeviceListUpdated, void (const connection_handler::DeviceMap&));
- MOCK_METHOD0(OnFindNewApplicationsRequest, void ());
- MOCK_METHOD1(RemoveDevice, void (const connection_handler::DeviceHandle&));
- MOCK_METHOD3(OnServiceStartedCallback, bool (const connection_handler::DeviceHandle&,
- const int32_t&,
- const protocol_handler::ServiceType&));
- MOCK_METHOD3(OnServiceEndedCallback, void (const int32_t&,
- const protocol_handler::ServiceType&,
- const connection_handler::CloseSessionReason&));
- MOCK_METHOD1(Handle, void (const impl::MessageFromMobile));
- MOCK_METHOD1(Handle, void (const impl::MessageToMobile));
- MOCK_METHOD1(Handle, void (const impl::MessageFromHmi));
- MOCK_METHOD1(Handle, void (const impl::MessageToHmi));
- MOCK_METHOD1(Handle, void (const impl::AudioData));
-
- //ApplicationManager methods
- MOCK_METHOD1(set_hmi_message_handler, void (hmi_message_handler::HMIMessageHandler*));
- MOCK_METHOD1(set_protocol_handler, void (protocol_handler::ProtocolHandler*));
- MOCK_METHOD1(set_connection_handler, void (connection_handler::ConnectionHandler*));
-
- //ApplicationManagerImpl methods:
-#ifdef TIME_TESTER
- MOCK_METHOD1(SetTimeMetricObserver, void(AMMetricObserver*));
+
+ // ApplicationManager methods
+ MOCK_METHOD1(set_hmi_message_handler,
+ void(hmi_message_handler::HMIMessageHandler*));
+ MOCK_METHOD1(set_protocol_handler, void(protocol_handler::ProtocolHandler*));
+ MOCK_METHOD1(set_connection_handler,
+ void(connection_handler::ConnectionHandler*));
+ MOCK_CONST_METHOD0(connection_handler,
+ connection_handler::ConnectionHandler&());
+
+ MOCK_CONST_METHOD0(applications, DataAccessor<ApplicationSet>());
+
+ MOCK_METHOD1(GetUserConsentForDevice,
+ policy::DeviceConsent(const std::string& device_id));
+ MOCK_METHOD1(OnMessageReceived,
+ void(utils::SharedPtr<application_manager::Message>));
+ MOCK_METHOD1(OnErrorSending,
+ void(utils::SharedPtr<application_manager::Message>));
+ MOCK_METHOD1(OnMessageReceived,
+ void(const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD1(OnMobileMessageSent,
+ void(const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD1(OnDeviceListUpdated, void(const connection_handler::DeviceMap&));
+ MOCK_METHOD0(OnFindNewApplicationsRequest, void());
+ MOCK_METHOD1(RemoveDevice, void(const connection_handler::DeviceHandle&));
+ MOCK_METHOD3(OnServiceStartedCallback,
+ bool(const connection_handler::DeviceHandle&,
+ const int32_t&,
+ const protocol_handler::ServiceType&));
+ MOCK_METHOD3(OnServiceEndedCallback,
+ void(const int32_t&,
+ const protocol_handler::ServiceType&,
+ const connection_handler::CloseSessionReason&));
+#ifdef ENABLE_SECURITY
+ MOCK_CONST_METHOD1(
+ GetHandshakeContext,
+ security_manager::SSLContext::HandshakeContext(uint32_t key));
+ MOCK_METHOD2(OnHandshakeDone,
+ bool(uint32_t connection_key,
+ security_manager::SSLContext::HandshakeResult result));
+#endif // ENABLE_SECURITY
+ MOCK_METHOD1(Handle, void(const impl::MessageFromMobile));
+ MOCK_METHOD1(Handle, void(const impl::MessageToMobile));
+ MOCK_METHOD1(Handle, void(const impl::MessageFromHmi));
+ MOCK_METHOD1(Handle, void(const impl::MessageToHmi));
+ MOCK_METHOD1(Handle, void(const impl::AudioData));
+
+// ApplicationManagerImpl methods:
+#ifdef TELEMETRY_MONITOR
+ MOCK_METHOD1(SetTelemetryObserver, void(AMTelemetryObserver*));
#endif
MOCK_METHOD1(RegisterApplication,
- ApplicationSharedPtr(const utils::SharedPtr<smart_objects::SmartObject>&));
- MOCK_METHOD0(hmi_capabilities, HMICapabilities& ());
- MOCK_METHOD1(ProcessQueryApp, void (const smart_objects::SmartObject& sm_object));
- MOCK_METHOD1(ManageHMICommand, bool (const utils::SharedPtr<smart_objects::SmartObject>&));
- MOCK_METHOD1(ManageMobileCommand, bool (const utils::SharedPtr<smart_objects::SmartObject>& message));
- MOCK_METHOD1(SendMessageToHMI, bool (const utils::SharedPtr<smart_objects::SmartObject>&));
- MOCK_METHOD2(SendMessageToMobile, bool (const utils::SharedPtr<smart_objects::SmartObject>&,
- bool));
- MOCK_METHOD1(SendMessageToMobile, bool (const utils::SharedPtr<smart_objects::SmartObject>&));
- MOCK_METHOD1(GetDeviceName, std::string (connection_handler::DeviceHandle));
- MOCK_METHOD1(GetDeviceTransportType, hmi_apis::Common_TransportType::eType (const std::string&));
- MOCK_METHOD1(application, ApplicationSharedPtr (uint32_t));
- MOCK_METHOD1(application_by_policy_id, ApplicationSharedPtr (const std::string&));
+ ApplicationSharedPtr(
+ const utils::SharedPtr<smart_objects::SmartObject>&));
+ MOCK_METHOD0(hmi_capabilities, HMICapabilities&());
+ MOCK_METHOD0(is_attenuated_supported, bool());
+ MOCK_METHOD1(ManageHMICommand,
+ bool(const application_manager::commands::MessageSharedPtr message));
+ MOCK_METHOD2(ManageMobileCommand,
+ bool(const smart_objects::SmartObjectSPtr message,
+ commands::Command::CommandOrigin));
+ MOCK_METHOD1(SendMessageToHMI,
+ void(const application_manager::commands::MessageSharedPtr));
+ MOCK_METHOD2(SendMessageToMobile,
+ void(const application_manager::commands::MessageSharedPtr, bool));
+ MOCK_METHOD1(SendMessageToMobile,
+ void(const application_manager::commands::MessageSharedPtr));
+ MOCK_METHOD1(GetDeviceName, std::string(connection_handler::DeviceHandle));
+ MOCK_METHOD1(GetDeviceTransportType,
+ hmi_apis::Common_TransportType::eType(const std::string&));
+ MOCK_CONST_METHOD1(application_by_policy_id,
+ ApplicationSharedPtr(const std::string&));
+
MOCK_METHOD1(RemoveAppDataFromHMI, bool(ApplicationSharedPtr));
- MOCK_METHOD1(HeadUnitReset, void(mobile_api::AppInterfaceUnregisteredReason::eType));
+ MOCK_METHOD1(HeadUnitReset,
+ void(mobile_api::AppInterfaceUnregisteredReason::eType));
+#ifdef CUSTOMER_PASA
+ MOCK_METHOD0(HeadUnitSuspend, void());
+ MOCK_CONST_METHOD0(state_suspended, bool());
+ MOCK_METHOD1(set_state_suspended, void(const bool));
+#endif // CUSTOMER_PASA
MOCK_METHOD1(LoadAppDataToHMI, bool(ApplicationSharedPtr));
- MOCK_METHOD1(ActivateApplication, bool (ApplicationSharedPtr));
- MOCK_METHOD1(IsHmiLevelFullAllowed, mobile_api::HMILevel::eType (ApplicationSharedPtr));
- MOCK_METHOD3(OnHMILevelChanged, void (uint32_t, mobile_apis::HMILevel::eType, mobile_apis::HMILevel::eType));
- MOCK_METHOD2(UnregisterRevokedApplication, void(uint32_t, mobile_apis::Result::eType));
- MOCK_METHOD1(SetUnregisterAllApplicationsReason, void(mobile_api::AppInterfaceUnregisteredReason::eType));
+ MOCK_METHOD1(ActivateApplication, bool(ApplicationSharedPtr));
+ MOCK_METHOD1(IsHmiLevelFullAllowed,
+ mobile_api::HMILevel::eType(ApplicationSharedPtr));
+ MOCK_METHOD3(OnHMILevelChanged,
+ void(uint32_t,
+ mobile_apis::HMILevel::eType,
+ mobile_apis::HMILevel::eType));
+ MOCK_METHOD1(SendHMIStatusNotification,
+ void(const utils::SharedPtr<Application>));
+
+ MOCK_METHOD2(UnregisterRevokedApplication,
+ void(uint32_t, mobile_apis::Result::eType));
+ MOCK_METHOD1(SetUnregisterAllApplicationsReason,
+ void(mobile_api::AppInterfaceUnregisteredReason::eType));
MOCK_METHOD0(UnregisterAllApplications, void());
MOCK_METHOD0(connection_handler, connection_handler::ConnectionHandler*());
MOCK_METHOD0(protocol_handler, protocol_handler::ProtocolHandler*());
MOCK_METHOD0(hmi_message_handler, hmi_message_handler::HMIMessageHandler*());
- MOCK_METHOD5(CheckPolicyPermissions, mobile_apis::Result::eType(const std::string&,
- mobile_apis::HMILevel::eType,
- mobile_apis::FunctionID::eType,
- const RPCParams&,
- CommandParametersPermissions*));
+ MOCK_METHOD5(CheckPolicyPermissions,
+ mobile_apis::Result::eType(const std::string&,
+ mobile_apis::HMILevel::eType,
+ mobile_apis::FunctionID::eType,
+ const RPCParams&,
+ CommandParametersPermissions*));
MOCK_METHOD3(updateRequestTimeout, void(uint32_t, uint32_t, uint32_t));
MOCK_METHOD0(GenerateGrammarID, uint32_t());
MOCK_METHOD0(GenerateNewHMIAppID, uint32_t());
MOCK_METHOD1(GetAvailableSpaceForApp, uint32_t(const std::string&));
- MOCK_METHOD0(begin_audio_pass_thru, bool ());
+ MOCK_METHOD0(begin_audio_pass_thru, bool());
MOCK_METHOD0(end_audio_pass_thru, uint32_t());
MOCK_METHOD1(StopAudioPassThru, void(uint32_t));
- MOCK_METHOD1(applications_by_button, std::vector<ApplicationSharedPtr>(uint32_t));
+ MOCK_METHOD1(applications_by_button,
+ std::vector<ApplicationSharedPtr>(uint32_t));
MOCK_METHOD0(applications_with_navi, std::vector<ApplicationSharedPtr>());
- MOCK_METHOD1(applications_by_ivi, std::vector<ApplicationSharedPtr>(uint32_t));
- MOCK_METHOD2(IviInfoUpdated, std::vector<utils::SharedPtr<Application>> (VehicleDataType,
- int));
- MOCK_METHOD6(StartAudioPassThruThread, void(uint32_t, uint32_t, uint32_t,
- uint32_t, uint32_t, uint32_t));
- MOCK_METHOD4(SaveBinary, mobile_apis::Result::eType(const std::vector<uint8_t>&,
- const std::string&,
- const std::string&,
- const int64_t));
+ MOCK_METHOD2(IviInfoUpdated,
+ std::vector<utils::SharedPtr<Application>>(VehicleDataType,
+ int));
+ MOCK_METHOD6(
+ StartAudioPassThruThread,
+ void(uint32_t, uint32_t, uint32_t, uint32_t, uint32_t, uint32_t));
+ MOCK_METHOD4(SaveBinary,
+ mobile_apis::Result::eType(const std::vector<uint8_t>&,
+ const std::string&,
+ const std::string&,
+ const int64_t));
MOCK_METHOD1(ReplaceHMIByMobileAppId, void(smart_objects::SmartObject&));
MOCK_METHOD1(ReplaceMobileByHMIAppId, void(smart_objects::SmartObject&));
- MOCK_METHOD0(resume_controller, ResumeCtrl&());
- MOCK_METHOD1(GetDefaultHmiLevel, mobile_api::HMILevel::eType (ApplicationSharedPtr));
+ MOCK_METHOD0(resume_controller, resumption::ResumeCtrl&());
+ MOCK_METHOD1(GetDefaultHmiLevel,
+ mobile_api::HMILevel::eType(ApplicationSharedPtr));
- MOCK_METHOD2(HMILevelAllowsStreaming, bool(uint32_t, protocol_handler::ServiceType));
+ MOCK_METHOD2(HMILevelAllowsStreaming,
+ bool(uint32_t, protocol_handler::ServiceType));
MOCK_METHOD2(CanAppStream, bool(uint32_t, protocol_handler::ServiceType));
MOCK_METHOD1(EndNaviServices, void(int32_t));
MOCK_METHOD1(ForbidStreaming, void(int32_t));
- MOCK_METHOD3(OnAppStreaming, void(int32_t, protocol_handler::ServiceType, bool));
+ MOCK_METHOD3(OnAppStreaming,
+ void(int32_t, protocol_handler::ServiceType, bool));
MOCK_METHOD1(Unmute, void(VRTTSSessionChanging));
MOCK_METHOD1(Mute, void(VRTTSSessionChanging));
MOCK_METHOD2(set_application_id, void(const int32_t, const uint32_t));
- MOCK_METHOD1(application_id, uint32_t(const int32_t));
+ MOCK_METHOD1(application_id, const uint32_t(const int32_t));
MOCK_METHOD1(removeNotification, void(const commands::Command*));
- MOCK_METHOD1(addNotification, void(const CommandSharedPtr ));
+ MOCK_METHOD1(addNotification, void(const CommandSharedPtr));
MOCK_METHOD0(StartDevicesDiscovery, void());
- MOCK_METHOD2(SendAudioPassThroughNotification, void(uint32_t, std::vector<uint8_t>&));
+ MOCK_METHOD2(SendAudioPassThroughNotification,
+ void(uint32_t, std::vector<uint8_t>&));
MOCK_METHOD1(set_all_apps_allowed, void(const bool));
- MOCK_METHOD4(CreateRegularState, HmiStatePtr (uint32_t, mobile_api::HMILevel::eType,
- mobile_apis::AudioStreamingState::eType,
- mobile_apis::SystemContext::eType));
+ MOCK_METHOD4(CreateRegularState,
+ HmiStatePtr(uint32_t,
+ mobile_api::HMILevel::eType,
+ mobile_apis::AudioStreamingState::eType,
+ mobile_apis::SystemContext::eType));
- template<bool SendActivateApp>
+ template <bool SendActivateApp>
MOCK_METHOD2(SetState, void(uint32_t, HmiState));
- template<bool SendActivateApp>
+ template <bool SendActivateApp>
MOCK_METHOD2(SetState, void(uint32_t, mobile_api::HMILevel::eType));
- template<bool SendActivateApp>
- MOCK_METHOD3(SetState, void(uint32_t, mobile_api::HMILevel::eType,
- mobile_apis::AudioStreamingState::eType));
- template<bool SendActivateApp>
- MOCK_METHOD4(SetState, void(uint32_t, mobile_api::HMILevel::eType,
- mobile_apis::AudioStreamingState::eType,
- mobile_apis::SystemContext::eType));
- MOCK_METHOD2(SetState, void(uint32_t,
- mobile_apis::AudioStreamingState::eType));
+ template <bool SendActivateApp>
+ MOCK_METHOD3(SetState,
+ void(uint32_t,
+ mobile_api::HMILevel::eType,
+ mobile_apis::AudioStreamingState::eType));
+
+ template <bool SendActivateApp>
+ MOCK_METHOD4(SetState,
+ void(uint32_t,
+ mobile_api::HMILevel::eType,
+ mobile_apis::AudioStreamingState::eType,
+ mobile_apis::SystemContext::eType));
+ MOCK_METHOD2(SetState,
+ void(uint32_t, mobile_apis::AudioStreamingState::eType));
MOCK_CONST_METHOD0(all_apps_allowed, bool());
MOCK_METHOD1(set_vr_session_started, void(const bool));
@@ -286,88 +350,70 @@ class ApplicationManagerImpl : public ApplicationManager,
MOCK_CONST_METHOD0(driver_distraction, bool());
MOCK_METHOD1(ConnectToDevice, void(uint32_t));
MOCK_METHOD0(OnHMIStartedCooperation, void());
- MOCK_METHOD0(GetNextHMICorrelationID, uint32_t ());
- MOCK_CONST_METHOD0(IsHMICooperating, bool());
+ MOCK_METHOD0(GetNextHMICorrelationID, uint32_t());
MOCK_METHOD0(OnTimerSendTTSGlobalProperties, void());
MOCK_METHOD0(CreatePhoneCallAppList, void());
MOCK_METHOD0(ResetPhoneCallAppList, void());
- MOCK_METHOD2(ChangeAppsHMILevel, void(uint32_t, mobile_apis::HMILevel::eType));
+ MOCK_METHOD2(ChangeAppsHMILevel,
+ void(uint32_t, mobile_apis::HMILevel::eType));
MOCK_METHOD1(AddAppToTTSGlobalPropertiesList, void(const uint32_t));
MOCK_METHOD1(RemoveAppFromTTSGlobalPropertiesList, void(const uint32_t));
- MOCK_METHOD1(application_by_hmi_app, ApplicationSharedPtr(uint32_t));
- MOCK_METHOD2(UnregisterApplication, void(const uint32_t,mobile_apis::Result::eType));
- MOCK_METHOD3(UnregisterApplication, void(const uint32_t,mobile_apis::Result::eType,
- bool));
- MOCK_METHOD4(UnregisterApplication, void(const uint32_t,mobile_apis::Result::eType,
- bool, bool));
+ MOCK_CONST_METHOD1(application_by_hmi_app, ApplicationSharedPtr(uint32_t));
+ MOCK_METHOD2(UnregisterApplication,
+ void(const uint32_t, mobile_apis::Result::eType));
+ MOCK_METHOD3(UnregisterApplication,
+ void(const uint32_t, mobile_apis::Result::eType, bool));
+ MOCK_METHOD4(UnregisterApplication,
+ void(const uint32_t, mobile_apis::Result::eType, bool, bool));
MOCK_METHOD1(OnAppUnauthorized, void(const uint32_t&));
MOCK_CONST_METHOD0(get_limited_media_application, ApplicationSharedPtr());
MOCK_CONST_METHOD0(get_limited_navi_application, ApplicationSharedPtr());
MOCK_CONST_METHOD0(get_limited_voice_application, ApplicationSharedPtr());
- MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited, bool(ApplicationSharedPtr));
- MOCK_CONST_METHOD0(active_application, ApplicationSharedPtr ());
+ MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited,
+ bool(ApplicationConstSharedPtr));
+ MOCK_METHOD1(OnApplicationRegistered, void(ApplicationSharedPtr));
+ MOCK_CONST_METHOD0(active_application, ApplicationSharedPtr());
MOCK_METHOD0(OnApplicationListUpdateTimer, void());
MOCK_METHOD0(OnLowVoltage, void());
MOCK_METHOD0(OnWakeUp, void());
- MOCK_METHOD1(OnUpdateHMIAppType, void(std::map<std::string, std::vector<std::string> >));
- MOCK_METHOD3(set_state, void(ApplicationSharedPtr app,
- mobile_apis::HMILevel::eType,
- mobile_apis::AudioStreamingState::eType));
-MOCK_CONST_METHOD0(IsStopping, bool());
-
- struct ApplicationsAppIdSorter {
- bool operator() (const ApplicationSharedPtr lhs,
- const ApplicationSharedPtr rhs) {
- return lhs->app_id() < rhs->app_id();
- }
+ MOCK_CONST_METHOD2(IsApplicationForbidden,
+ bool(uint32_t, const std::string&));
+ MOCK_METHOD1(OnUpdateHMIAppType,
+ void(std::map<std::string, std::vector<std::string>>));
+ MOCK_METHOD3(set_state,
+ void(ApplicationSharedPtr app,
+ mobile_apis::HMILevel::eType,
+ mobile_apis::AudioStreamingState::eType));
+ MOCK_CONST_METHOD1(GetDefaultHmiLevel,
+ mobile_apis::HMILevel::eType(ApplicationConstSharedPtr));
+ MOCK_CONST_METHOD1(application, ApplicationSharedPtr(uint32_t app_id));
+
+ bool IsHMICooperating() const {
+ return true;
};
- // typedef for Applications list
- typedef std::set<ApplicationSharedPtr,
- ApplicationsAppIdSorter> ApplictionSet;
-
- // typedef for Applications list iterator
- typedef ApplictionSet::iterator ApplictionSetIt;
-
- // typedef for Applications list const iterator
- typedef ApplictionSet::const_iterator ApplictionSetConstIt;
-
-
/**
* Class for thread-safe access to applications list
*/
- class ApplicationListAccessor: public DataAccessor<ApplictionSet> {
- public:
- ApplicationListAccessor() :
- DataAccessor<ApplictionSet>(ApplictionSet(),sync_primitives::Lock()) {
- }
- MOCK_CONST_METHOD0(applications, const ApplictionSet());
- MOCK_METHOD0(begin, ApplictionSetConstIt());
- MOCK_METHOD0(end, ApplictionSetConstIt());
- MOCK_METHOD1(Erase, void(ApplicationSharedPtr));
- MOCK_METHOD1(Insert, void(ApplicationSharedPtr));
- MOCK_METHOD0(Empty, bool());
- };
-
- friend class ApplicationListAccessor;
-
-
- class ApplicationListUpdateTimer : public timer::TimerThread<ApplicationManagerImpl> {
+ class ApplicationListAccessor : public DataAccessor<ApplicationSet> {
public:
- ApplicationListUpdateTimer(ApplicationManagerImpl* callee) :
- timer::TimerThread<ApplicationManagerImpl>("AM ListUpdater",
- callee, &ApplicationManagerImpl::OnApplicationListUpdateTimer
- ) {
- }
+ ApplicationListAccessor()
+ : DataAccessor<ApplicationSet>(ApplicationSet(),
+ sync_primitives::Lock()) {}
+ MOCK_CONST_METHOD0(applications, const ApplicationSet());
+ MOCK_METHOD0(begin, ApplicationSetConstIt());
+ MOCK_METHOD0(end, ApplicationSetConstIt());
+ MOCK_METHOD1(Erase, void(ApplicationSharedPtr));
+ MOCK_METHOD1(Insert, void(ApplicationSharedPtr));
+ MOCK_METHOD0(Empty, bool());
};
- typedef utils::SharedPtr<ApplicationListUpdateTimer> ApplicationListUpdateTimerSptr;
+ friend class ApplicationListAccessor;
- private:
- //FIXME(AKutsan) In resume_controller is is nessesery to change realisation for remove using application_list_
- ApplictionSet application_list_;
+private:
FRIEND_BASE_SINGLETON_CLASS(ApplicationManagerImpl);
};
-} //application_manager
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_INCLUDE_APPLICATION_MANAGER_H_
+} // application_manager
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_INCLUDE_APPLICATION_MANAGER_APPLICATION_MANAGER_H_
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command.h b/src/components/application_manager/test/mock/include/application_manager/commands/command.h
deleted file mode 120000
index 07b2c07963..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/command.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h
deleted file mode 120000
index eb9e9576d1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/command_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_notification_from_mobile_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_notification_from_mobile_impl.h
deleted file mode 120000
index 1e3d6f0afe..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_notification_from_mobile_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/command_notification_from_mobile_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_notification_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_notification_impl.h
deleted file mode 120000
index 2b946196d2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_notification_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/command_notification_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h
deleted file mode 120000
index 953008ead7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_request_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/command_request_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/command_response_impl.h b/src/components/application_manager/test/mock/include/application_manager/commands/command_response_impl.h
deleted file mode 120000
index 71136ecbf9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/command_response_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/command_response_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_request.h
deleted file mode 120000
index 5ebc425677..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/activate_app_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_response.h
deleted file mode 120000
index 74e0b401ae..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/activate_app_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/activate_app_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/add_statistics_info_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/add_statistics_info_notification.h
deleted file mode 120000
index 0a68ef8aa0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/add_statistics_info_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/add_statistics_info_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_request.h
deleted file mode 120000
index f110d55969..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/allow_all_apps_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_response.h
deleted file mode 120000
index 5d81eebc08..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_all_apps_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/allow_all_apps_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_request.h
deleted file mode 120000
index 4674c56259..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/allow_app_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_response.h
deleted file mode 120000
index a972bbe3fe..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/allow_app_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/allow_app_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
deleted file mode 120000
index a7f0223e3e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/basic_communication_on_awake_sdl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_request.h
deleted file mode 120000
index 4190191f1b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/basic_communication_system_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_response.h
deleted file mode 120000
index 62e9bdbac4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/basic_communication_system_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/basic_communication_system_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_request.h
deleted file mode 120000
index 8262591764..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/button_get_capabilities_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_response.h
deleted file mode 120000
index 8ca8d92829..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/button_get_capabilities_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/button_get_capabilities_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_request.h
deleted file mode 120000
index bac5ced3ba..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/close_popup_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_response.h
deleted file mode 120000
index 607da1f8bb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/close_popup_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/close_popup_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_request.h
deleted file mode 120000
index 45a17a4c4d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/get_system_info_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_response.h
deleted file mode 120000
index dd46df23e7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_system_info_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/get_system_info_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls.h
deleted file mode 120000
index 68789b0a50..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/get_urls.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls_response.h
deleted file mode 120000
index b76a19d07b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/get_urls_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/get_urls_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_request.h
deleted file mode 120000
index 73c501170c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/mixing_audio_supported_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_response.h
deleted file mode 120000
index 041b46c653..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/mixing_audio_supported_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/mixing_audio_supported_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_request.h
deleted file mode 120000
index 9b879237eb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_alert_maneuver_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_response.h
deleted file mode 120000
index 4ed6ec165d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_alert_maneuver_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_alert_maneuver_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_request.h
deleted file mode 120000
index 0c83f540ae..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_audio_start_stream_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_response.h
deleted file mode 120000
index fd9ca2d591..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_start_stream_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_audio_start_stream_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h
deleted file mode 120000
index 3b9a69ee37..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_audio_stop_stream_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h
deleted file mode 120000
index 46c13499ce..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_audio_stop_stream_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_audio_stop_stream_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_request.h
deleted file mode 120000
index beff169e82..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_is_ready_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_response.h
deleted file mode 120000
index e1c9b1266f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_is_ready_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_is_ready_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_request.h
deleted file mode 120000
index c3f11a7981..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_send_location_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_response.h
deleted file mode 120000
index 8728efe1e7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_send_location_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_send_location_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h
deleted file mode 120000
index 82bb72563c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_show_constant_tbt_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h
deleted file mode 120000
index 116c2428d1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_show_constant_tbt_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_show_constant_tbt_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_request.h
deleted file mode 120000
index 9f6e2036f4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_start_stream_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_response.h
deleted file mode 120000
index 788f569dd1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_start_stream_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_start_stream_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_request.h
deleted file mode 120000
index 433340adb1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_stop_stream_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_response.h
deleted file mode 120000
index 5015565371..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_stop_stream_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_stop_stream_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_request.h
deleted file mode 120000
index 2d8888a1b8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_update_turn_list_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_response.h
deleted file mode 120000
index 37f5dcf4b9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/navi_update_turn_list_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/navi_update_turn_list_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_from_hmi.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_from_hmi.h
deleted file mode 120000
index d2fb7da954..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_from_hmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/notification_from_hmi.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_to_hmi.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_to_hmi.h
deleted file mode 120000
index cd2036c6cb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/notification_to_hmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/notification_to_hmi.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h
deleted file mode 120000
index 7088e09776..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_allow_sdl_functionality_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_activated_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_activated_notification.h
deleted file mode 120000
index e3dee83334..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_activated_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_app_activated_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_deactivated_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_deactivated_notification.h
deleted file mode 120000
index 3db5068c21..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_deactivated_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_app_deactivated_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_changed_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_changed_notification.h
deleted file mode 120000
index 698c66aeeb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_changed_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_app_permission_changed_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_consent_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_consent_notification.h
deleted file mode 120000
index 4feacfd699..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_permission_consent_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_app_permission_consent_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_registered_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_registered_notification.h
deleted file mode 120000
index 8c6b32f1bd..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_registered_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_app_registered_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_unregistered_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_unregistered_notification.h
deleted file mode 120000
index e5a5bc23cd..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_app_unregistered_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_app_unregistered_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_event_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_event_notification.h
deleted file mode 120000
index 5276b6e208..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_event_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_button_event_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_press_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_press_notification.h
deleted file mode 120000
index 89460e876d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_press_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_button_press_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_subscription_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_subscription_notification.h
deleted file mode 120000
index f35c69137b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_button_subscription_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_button_subscription_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_chosen_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_chosen_notification.h
deleted file mode 120000
index 3cceadabde..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_chosen_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_device_chosen_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_state_changed_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_state_changed_notification.h
deleted file mode 120000
index 87c152730e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_device_state_changed_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_device_state_changed_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_driver_distraction_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_driver_distraction_notification.h
deleted file mode 120000
index 8d7b4e9990..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_driver_distraction_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_driver_distraction_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h
deleted file mode 120000
index 4458ec5028..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_emergency_event_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_emergency_event_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_all_applications_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
deleted file mode 120000
index 482ae71548..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_all_applications_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_exit_all_applications_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_application_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_application_notification.h
deleted file mode 120000
index ebe9dc9b9f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_exit_application_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_exit_application_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_file_removed_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_file_removed_notification.h
deleted file mode 120000
index bec80bf2c9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_file_removed_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_file_removed_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_find_applications.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_find_applications.h
deleted file mode 120000
index 5c427c8837..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_find_applications.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_find_applications.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h
deleted file mode 120000
index 8caf1afa59..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ignition_cycle_over_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h
deleted file mode 120000
index 2ef1136e29..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_navi_tbt_client_state_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h
deleted file mode 120000
index 4ab1c99860..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_phone_call_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_phone_call_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_play_tone_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_play_tone_notification.h
deleted file mode 120000
index 21fd85dac3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_play_tone_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_play_tone_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_policy_update.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_policy_update.h
deleted file mode 120000
index fb8c782b83..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_policy_update.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_policy_update.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_put_file_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_put_file_notification.h
deleted file mode 120000
index 61c4005e46..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_put_file_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_put_file_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ready_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ready_notification.h
deleted file mode 120000
index 735af42379..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ready_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ready_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_received_policy_update.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_received_policy_update.h
deleted file mode 120000
index c53f1ce658..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_received_policy_update.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_received_policy_update.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_record_start_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_record_start_notification.h
deleted file mode 120000
index 733827254b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_record_start_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_record_start_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_resume_audio_source_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_resume_audio_source_notification.h
deleted file mode 120000
index f7b6f6bba1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_resume_audio_source_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_resume_audio_source_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_close_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_close_notification.h
deleted file mode 120000
index a8cd1db472..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_close_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_sdl_close_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h
deleted file mode 120000
index 531002efa6..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_sdl_consent_needed_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h
deleted file mode 120000
index 2a8c51814d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_sdl_persistence_complete_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_start_device_discovery.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_start_device_discovery.h
deleted file mode 120000
index 459d55684a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_start_device_discovery.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_start_device_discovery.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_status_update_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_status_update_notification.h
deleted file mode 120000
index 5304b2fcbe..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_status_update_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_status_update_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_context_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_context_notification.h
deleted file mode 120000
index 4403b0fc90..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_context_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_system_context_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_error_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_error_notification.h
deleted file mode 120000
index 8612089978..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_error_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_system_error_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_info_changed_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_info_changed_notification.h
deleted file mode 120000
index 9bfb39bb89..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_info_changed_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_system_info_changed_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_request_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_request_notification.h
deleted file mode 120000
index 923cbe7956..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_system_request_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_system_request_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_language_change_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_language_change_notification.h
deleted file mode 120000
index 2ad7fd6287..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_language_change_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_tts_language_change_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h
deleted file mode 120000
index e91f381a03..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_tts_reset_timeout_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_started_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_started_notification.h
deleted file mode 120000
index c5c748cecc..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_started_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_tts_started_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_stopped_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_stopped_notification.h
deleted file mode 120000
index d40bc7ffb5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_tts_stopped_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_tts_stopped_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_command_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_command_notification.h
deleted file mode 120000
index 86b7591eb3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_command_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ui_command_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h
deleted file mode 120000
index 04873772df..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ui_keyboard_input_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_language_change_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_language_change_notification.h
deleted file mode 120000
index 419745c084..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_language_change_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ui_language_change_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h
deleted file mode 120000
index 3a68034b36..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ui_reset_timeout_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_touch_event_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_touch_event_notification.h
deleted file mode 120000
index 86531d491e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_ui_touch_event_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_ui_touch_event_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_update_device_list.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_update_device_list.h
deleted file mode 120000
index 2a6c0c4acf..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_update_device_list.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_update_device_list.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h
deleted file mode 120000
index 35f259dd5b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_acc_pedal_position_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_belt_status_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_belt_status_notification.h
deleted file mode 120000
index 2ca86120d9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_belt_status_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_belt_status_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_body_information_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_body_information_notification.h
deleted file mode 120000
index c0ff7d8c27..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_body_information_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_body_information_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_device_status_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_device_status_notification.h
deleted file mode 120000
index 4f32e21534..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_device_status_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_device_status_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h
deleted file mode 120000
index 01fc3fdf49..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_driver_braking_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_driver_braking_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h
deleted file mode 120000
index a2f074b766..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_engine_torque_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_engine_torque_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h
deleted file mode 120000
index aef5bd9136..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_external_temperature_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_external_temperature_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h
deleted file mode 120000
index 1f63c652b3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_fuel_level_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h
deleted file mode 120000
index 2f8a4a8aab..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_fuel_level_state_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_gps_data_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_gps_data_notification.h
deleted file mode 120000
index 9fcf1f9808..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_gps_data_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_gps_data_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h
deleted file mode 120000
index c837834b48..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_head_lamp_status_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h
deleted file mode 120000
index bdbbf718b9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_instant_fuel_consumption_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_my_key_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_my_key_notification.h
deleted file mode 120000
index d1d9ed76b4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_my_key_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_my_key_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_odometer_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_odometer_notification.h
deleted file mode 120000
index d1b3715060..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_odometer_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_odometer_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_prndl_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_prndl_notification.h
deleted file mode 120000
index 1e5fe3c22e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_prndl_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_prndl_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_rpm_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_rpm_notification.h
deleted file mode 120000
index 1be92ae38c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_rpm_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_rpm_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_speed_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_speed_notification.h
deleted file mode 120000
index 6ed9e5a224..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_speed_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_speed_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h
deleted file mode 120000
index 7dbf52e868..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_steering_wheel_angle_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h
deleted file mode 120000
index d86bd602c9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_tire_pressure_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h
deleted file mode 120000
index a86015d35e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_vehicle_data_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vin_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vin_notification.h
deleted file mode 120000
index 4d055a2dbe..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_vin_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_vin_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h
deleted file mode 120000
index 0de802fea8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vi_wiper_status_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vi_wiper_status_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_command_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_command_notification.h
deleted file mode 120000
index ca58b0c54c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_command_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vr_command_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_language_change_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_language_change_notification.h
deleted file mode 120000
index 0ee1334d1c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_language_change_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vr_language_change_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_started_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_started_notification.h
deleted file mode 120000
index 3ad1e6a4c2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_started_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vr_started_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_stopped_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_stopped_notification.h
deleted file mode 120000
index b230685cf3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/on_vr_stopped_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/on_vr_stopped_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_from_hmi.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_from_hmi.h
deleted file mode 120000
index cc64e0435d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_from_hmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/request_from_hmi.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_to_hmi.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_to_hmi.h
deleted file mode 120000
index 8f4f9bfc62..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/request_to_hmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/request_to_hmi.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_from_hmi.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_from_hmi.h
deleted file mode 120000
index 7352ba5033..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_from_hmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/response_from_hmi.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_to_hmi.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_to_hmi.h
deleted file mode 120000
index eea5e52522..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/response_to_hmi.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/response_to_hmi.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_request.h
deleted file mode 120000
index dbd2927575..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_activate_app_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_response.h
deleted file mode 120000
index 359281f715..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_activate_app_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_activate_app_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h
deleted file mode 120000
index 852f46c8e7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_get_list_of_permissions_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h
deleted file mode 120000
index aabab692de..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_get_list_of_permissions_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_request.h
deleted file mode 120000
index 19aea33e82..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_get_status_update_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_response.h
deleted file mode 120000
index 2b8a3579e2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_status_update_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_get_status_update_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h
deleted file mode 120000
index a7de550338..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_get_user_friendly_message_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h
deleted file mode 120000
index 888023b1c7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_get_user_friendly_message_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update.h
deleted file mode 120000
index fce6df879e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_policy_update.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update_response.h
deleted file mode 120000
index 32c5d5c9d0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/sdl_policy_update_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/sdl_policy_update_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_request.h
deleted file mode 120000
index 07988fae12..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_change_registration_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_response.h
deleted file mode 120000
index a3f6db17e4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_change_registration_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_change_registration_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_request.h
deleted file mode 120000
index bf50cc1ea8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_get_capabilities_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_response.h
deleted file mode 120000
index 2b3a1013ec..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_capabilities_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_get_capabilities_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_request.h
deleted file mode 120000
index 11363e063d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_get_language_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_response.h
deleted file mode 120000
index a60f44c467..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_language_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_get_language_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_request.h
deleted file mode 120000
index f3f6d97664..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_get_supported_languages_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_response.h
deleted file mode 120000
index 855129ba90..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_get_supported_languages_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_get_supported_languages_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_request.h
deleted file mode 120000
index 76a09f3446..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_is_ready_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_response.h
deleted file mode 120000
index 42e69db575..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_is_ready_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_is_ready_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_request.h
deleted file mode 120000
index 6ec0b44a60..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_set_global_properties_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_response.h
deleted file mode 120000
index 0067742926..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_set_global_properties_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_set_global_properties_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_request.h
deleted file mode 120000
index 09dd90b890..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_speak_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_response.h
deleted file mode 120000
index af8a6598fe..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_speak_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_speak_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_request.h
deleted file mode 120000
index 8d32593fd1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_stop_speaking_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_response.h
deleted file mode 120000
index d8cec177c0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/tts_stop_speaking_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/tts_stop_speaking_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_request.h
deleted file mode 120000
index 7c8ecca061..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_add_command_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_response.h
deleted file mode 120000
index c48d437da7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_command_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_add_command_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_request.h
deleted file mode 120000
index 07ed923893..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_add_submenu_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_response.h
deleted file mode 120000
index 1fb095cc44..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_add_submenu_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_add_submenu_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_request.h
deleted file mode 120000
index 576c8967ae..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_alert_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_response.h
deleted file mode 120000
index 78b58a1b20..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_alert_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_alert_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_request.h
deleted file mode 120000
index ae2a74d2ab..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_change_registration_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_response.h
deleted file mode 120000
index 4a207b3ea7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_change_registration_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_change_registration_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_request.h
deleted file mode 120000
index cd78986534..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_delete_command_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_response.h
deleted file mode 120000
index 0421c44faa..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_command_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_delete_command_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_request.h
deleted file mode 120000
index 4afa039810..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_delete_submenu_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_response.h
deleted file mode 120000
index 4374dea7cc..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_delete_submenu_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_delete_submenu_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h
deleted file mode 120000
index c19af2221d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_end_audio_pass_thru_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h
deleted file mode 120000
index 20a9a7ff12..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_end_audio_pass_thru_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_request.h
deleted file mode 120000
index c999d31f26..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_get_capabilities_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_response.h
deleted file mode 120000
index 4d8267f2de..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_capabilities_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_get_capabilities_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_request.h
deleted file mode 120000
index b5a3e98402..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_get_language_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_response.h
deleted file mode 120000
index e06614fba2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_language_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_get_language_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_request.h
deleted file mode 120000
index 90bedce441..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_get_supported_languages_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_response.h
deleted file mode 120000
index ae94b347bb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_get_supported_languages_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_get_supported_languages_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_request.h
deleted file mode 120000
index 53e9aadbb2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_is_ready_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_response.h
deleted file mode 120000
index b2e926541a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_is_ready_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_is_ready_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h
deleted file mode 120000
index 8255ac277f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_perform_audio_pass_thru_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h
deleted file mode 120000
index 3b26071854..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_perform_audio_pass_thru_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_request.h
deleted file mode 120000
index 668e395635..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_perform_interaction_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_response.h
deleted file mode 120000
index 30e74367b6..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_perform_interaction_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_perform_interaction_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_request.h
deleted file mode 120000
index c554acc317..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_scrollable_message_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_response.h
deleted file mode 120000
index e5bb7ab1b2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_scrollable_message_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_scrollable_message_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_request.h
deleted file mode 120000
index d79aae3c4d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_app_icon_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_response.h
deleted file mode 120000
index d961f29dcc..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_app_icon_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_app_icon_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_request.h
deleted file mode 120000
index f4d379ef2e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_display_layout_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_response.h
deleted file mode 120000
index e09307f1e2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_display_layout_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_display_layout_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_request.h
deleted file mode 120000
index 09760bc97f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_global_properties_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_response.h
deleted file mode 120000
index 7975cd942c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_global_properties_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_global_properties_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_request.h
deleted file mode 120000
index 8d3d935498..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_icon_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_response.h
deleted file mode 120000
index 6415eaf205..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_icon_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_icon_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h
deleted file mode 120000
index 65d9c7fbd4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_media_clock_timer_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h
deleted file mode 120000
index 3035e4f461..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_set_media_clock_timer_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_request.h
deleted file mode 120000
index 5669790e29..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_show_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_response.h
deleted file mode 120000
index 22d0aab4ab..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_show_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_show_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_request.h
deleted file mode 120000
index bc7ee7f1b7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_slider_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_response.h
deleted file mode 120000
index b630730e4f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/ui_slider_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/ui_slider_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_request.h
deleted file mode 120000
index 28a8e01032..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/update_app_list_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_response.h
deleted file mode 120000
index 11af157345..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_app_list_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/update_app_list_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_request.h
deleted file mode 120000
index bf55fd6c45..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/update_device_list_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_response.h
deleted file mode 120000
index 87653d8d0d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_device_list_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/update_device_list_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_request.h
deleted file mode 120000
index 116a6c36c8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/update_sdl_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_response.h
deleted file mode 120000
index d12d01f24f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/update_sdl_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/update_sdl_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_request.h
deleted file mode 120000
index d11b2d66cb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_diagnostic_message_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_response.h
deleted file mode 120000
index a9874fb19c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_diagnostic_message_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_diagnostic_message_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_request.h
deleted file mode 120000
index 5e5516e662..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_dtcs_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_response.h
deleted file mode 120000
index 378b95743b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_dtcs_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_dtcs_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h
deleted file mode 120000
index 2dde6fcea0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_vehicle_data_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h
deleted file mode 120000
index abc1bbb910..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_vehicle_data_request_template.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h
deleted file mode 120000
index 0f5636732a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_vehicle_data_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h
deleted file mode 120000
index cbde6eb303..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_vehicle_data_response_template.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h
deleted file mode 120000
index 534638fb6e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_vehicle_type_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h
deleted file mode 120000
index d346b466cc..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_get_vehicle_type_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_get_vehicle_type_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_request.h
deleted file mode 120000
index 2b345707b5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_is_ready_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_response.h
deleted file mode 120000
index 95ba17d5e5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_is_ready_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_is_ready_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_request.h
deleted file mode 120000
index de1f2ac0d6..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_read_did_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_response.h
deleted file mode 120000
index 2ba6a58d24..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_read_did_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_read_did_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h
deleted file mode 120000
index 61ddc3a548..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h
deleted file mode 120000
index 0822b5732a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_subscribe_vehicle_data_request_template.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h
deleted file mode 120000
index 485cc17afe..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h
deleted file mode 120000
index 6790cc663c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_subscribe_vehicle_data_response_template.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h
deleted file mode 120000
index 786a8cabe9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
deleted file mode 120000
index c95c2267a1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_request_template.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h
deleted file mode 120000
index 7fe6df28ee..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h
deleted file mode 120000
index aed21a8296..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vi_unsubscribe_vehicle_data_response_template.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_request.h
deleted file mode 120000
index 7fe9944f31..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_add_command_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_response.h
deleted file mode 120000
index 734f31c8d4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_add_command_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_add_command_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_request.h
deleted file mode 120000
index d8e68ce6d9..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_change_registration_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_response.h
deleted file mode 120000
index b220b61c94..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_change_registration_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_change_registration_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_request.h
deleted file mode 120000
index 864ab3d817..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_delete_command_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_response.h
deleted file mode 120000
index 02be59d164..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_delete_command_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_delete_command_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_request.h
deleted file mode 120000
index 48f24ad628..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_get_capabilities_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_response.h
deleted file mode 120000
index e5f7e2d645..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_capabilities_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_get_capabilities_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_request.h
deleted file mode 120000
index a625a08837..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_get_language_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_response.h
deleted file mode 120000
index 8facd3e436..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_language_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_get_language_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_request.h
deleted file mode 120000
index df9ab1ed8d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_get_supported_languages_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_response.h
deleted file mode 120000
index dbd01ab4ff..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_get_supported_languages_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_get_supported_languages_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_request.h
deleted file mode 120000
index 79cbd18e87..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_is_ready_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_response.h
deleted file mode 120000
index b9db7f3fda..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_is_ready_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_is_ready_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_request.h
deleted file mode 120000
index c26f6f8237..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_perform_interaction_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_response.h
deleted file mode 120000
index 6dcda065e2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/hmi/vr_perform_interaction_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/hmi/vr_perform_interaction_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_request.h
deleted file mode 120000
index cbae637fe0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/add_command_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_response.h
deleted file mode 120000
index d2bd280607..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_command_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/add_command_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_request.h
deleted file mode 120000
index e2e5940aae..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/add_sub_menu_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_response.h
deleted file mode 120000
index fdac5156c3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/add_sub_menu_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/add_sub_menu_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_request.h
deleted file mode 120000
index ff657e3327..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/alert_maneuver_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_response.h
deleted file mode 120000
index b78ff30d89..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_maneuver_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/alert_maneuver_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_request.h
deleted file mode 120000
index c251277605..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/alert_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_response.h
deleted file mode 120000
index 42269e9ed6..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/alert_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/alert_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_request.h
deleted file mode 120000
index aa92e20658..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/change_registration_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_response.h
deleted file mode 120000
index b0cb006227..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/change_registration_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/change_registration_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
deleted file mode 120000
index 64357af6c8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/create_interaction_choice_set_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_response.h
deleted file mode 120000
index eb4145c228..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/create_interaction_choice_set_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/create_interaction_choice_set_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_request.h
deleted file mode 120000
index d7187ab756..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_command_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_response.h
deleted file mode 120000
index 4d877b7cdb..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_command_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_command_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_request.h
deleted file mode 120000
index 7f82ed14e0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_file_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_response.h
deleted file mode 120000
index f419031684..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_file_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_file_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h
deleted file mode 120000
index d1ac513649..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_interaction_choice_set_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h
deleted file mode 120000
index abf9ed5eb5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_interaction_choice_set_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_interaction_choice_set_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_request.h
deleted file mode 120000
index 10baa78dd3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_sub_menu_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_response.h
deleted file mode 120000
index 22f6561919..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/delete_sub_menu_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/delete_sub_menu_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_request.h
deleted file mode 120000
index cfc9d7bc38..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/diagnostic_message_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_response.h
deleted file mode 120000
index 73fe20f089..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/diagnostic_message_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/diagnostic_message_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/dial_number_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/dial_number_request.h
deleted file mode 120000
index c448f3a5aa..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/dial_number_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/dial_number_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_request.h
deleted file mode 120000
index 331f7b8cca..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/end_audio_pass_thru_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_response.h
deleted file mode 120000
index 7b7eff611e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/end_audio_pass_thru_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/end_audio_pass_thru_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/generic_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/generic_response.h
deleted file mode 120000
index 10f5e3b009..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/generic_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/generic_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_request.h
deleted file mode 120000
index 995fb84419..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/get_dtcs_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_response.h
deleted file mode 120000
index 53786a9163..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_dtcs_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/get_dtcs_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_request.h
deleted file mode 120000
index 18e2658a63..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/get_vehicle_data_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_response.h
deleted file mode 120000
index 9641c9cb72..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/get_vehicle_data_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/get_vehicle_data_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_request.h
deleted file mode 120000
index 633ee9dda3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/list_files_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_response.h
deleted file mode 120000
index 75443a836e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/list_files_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/list_files_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h
deleted file mode 120000
index 82c74342aa..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_app_interface_unregistered_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h
deleted file mode 120000
index 7cf9f3d1c0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_audio_pass_thru_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_audio_pass_thru_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_event_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_event_notification.h
deleted file mode 120000
index d41cba2c0c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_event_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_button_event_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_press_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_press_notification.h
deleted file mode 120000
index 7ef855750a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_button_press_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_button_press_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_command_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_command_notification.h
deleted file mode 120000
index 759c4d33f1..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_command_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_command_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_driver_distraction_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_driver_distraction_notification.h
deleted file mode 120000
index ebe3fed8ff..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_driver_distraction_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_driver_distraction_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hash_change_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hash_change_notification.h
deleted file mode 120000
index 16aa5c9bb0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hash_change_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_hash_change_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification.h
deleted file mode 120000
index bc9cedbfb3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_hmi_status_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h
deleted file mode 120000
index 617cc46042..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_hmi_status_notification_from_mobile.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_keyboard_input_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_keyboard_input_notification.h
deleted file mode 120000
index 41474d2cb7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_keyboard_input_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_keyboard_input_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_language_change_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_language_change_notification.h
deleted file mode 120000
index d65fdc56a7..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_language_change_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_language_change_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_permissions_change_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_permissions_change_notification.h
deleted file mode 120000
index 9dff29eebf..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_permissions_change_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_permissions_change_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_system_request_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_system_request_notification.h
deleted file mode 120000
index 77c3741be5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_system_request_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_system_request_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_tbt_client_state_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_tbt_client_state_notification.h
deleted file mode 120000
index 63d770348d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_tbt_client_state_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_tbt_client_state_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_touch_event_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_touch_event_notification.h
deleted file mode 120000
index 6ec885678f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_touch_event_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_touch_event_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_vehicle_data_notification.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_vehicle_data_notification.h
deleted file mode 120000
index 4b628b7c62..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/on_vehicle_data_notification.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/on_vehicle_data_notification.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h
deleted file mode 120000
index 0316606c08..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/perform_audio_pass_thru_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h
deleted file mode 120000
index ba81d3e53b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_audio_pass_thru_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/perform_audio_pass_thru_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_request.h
deleted file mode 120000
index 9cb56984d5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/perform_interaction_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_response.h
deleted file mode 120000
index 8b90adea95..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/perform_interaction_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/perform_interaction_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_request.h
deleted file mode 120000
index be4b97728e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/put_file_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_response.h
deleted file mode 120000
index 664c76e53f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/put_file_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/put_file_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_request.h
deleted file mode 120000
index c9727e504f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/read_did_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_response.h
deleted file mode 120000
index 95e0c625a5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/read_did_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/read_did_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_request.h
deleted file mode 120000
index cc1fb2feef..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/register_app_interface_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_response.h
deleted file mode 120000
index 0f1ffccc69..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/register_app_interface_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/register_app_interface_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_request.h
deleted file mode 120000
index ea2ae40b8f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/reset_global_properties_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_response.h
deleted file mode 120000
index daba7103a2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/reset_global_properties_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/reset_global_properties_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_request.h
deleted file mode 120000
index 50bd0a294b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/scrollable_message_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_response.h
deleted file mode 120000
index d73af42f69..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/scrollable_message_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/scrollable_message_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_request.h
deleted file mode 120000
index d362057759..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/send_location_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_response.h
deleted file mode 120000
index 547cf897e5..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/send_location_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/send_location_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_request.h
deleted file mode 120000
index a2b137233e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_app_icon_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_response.h
deleted file mode 120000
index 6deebcabc8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_app_icon_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_app_icon_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_request.h
deleted file mode 120000
index f02f9317c6..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_display_layout_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_response.h
deleted file mode 120000
index b5b2e73549..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_display_layout_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_display_layout_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_request.h
deleted file mode 120000
index fee7f8c00b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_global_properties_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_response.h
deleted file mode 120000
index 76c7bf2497..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_global_properties_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_global_properties_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_request.h
deleted file mode 120000
index 2db9520a22..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_icon_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_response.h
deleted file mode 120000
index ac04c4d9f3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_icon_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_icon_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_request.h
deleted file mode 120000
index 1961671131..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_media_clock_timer_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_response.h
deleted file mode 120000
index ecffab999b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/set_media_clock_timer_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/set_media_clock_timer_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_request.h
deleted file mode 120000
index 35acb02f10..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/show_constant_tbt_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_response.h
deleted file mode 120000
index 5b3738ca80..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_constant_tbt_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/show_constant_tbt_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_request.h
deleted file mode 120000
index e299277b4d..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/show_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_response.h
deleted file mode 120000
index afa7d2547e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/show_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/show_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_request.h
deleted file mode 120000
index 8a1c85497e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/slider_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_response.h
deleted file mode 120000
index a869256ee0..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/slider_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/slider_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_request.h
deleted file mode 120000
index 5921def798..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/speak_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_response.h
deleted file mode 120000
index f4b69f7937..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/speak_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/speak_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_request.h
deleted file mode 120000
index e5da6a4484..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/subscribe_button_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_response.h
deleted file mode 120000
index dda081d9b4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_button_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/subscribe_button_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
deleted file mode 120000
index 8e4908abd8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/subscribe_vehicle_data_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h
deleted file mode 120000
index 262a56f0d4..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/subscribe_vehicle_data_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/subscribe_vehicle_data_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_request.h
deleted file mode 120000
index b4b9ca7641..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/system_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_response.h
deleted file mode 120000
index f71dd2f314..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/system_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/system_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_request.h
deleted file mode 120000
index 0851fea063..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/unregister_app_interface_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_response.h
deleted file mode 120000
index 16ed184de8..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unregister_app_interface_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/unregister_app_interface_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_request.h
deleted file mode 120000
index 98b4796053..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/unsubscribe_button_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_response.h
deleted file mode 120000
index 12d3efc86e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_button_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/unsubscribe_button_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h
deleted file mode 120000
index 8bd2f28445..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/unsubscribe_vehicle_data_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h
deleted file mode 120000
index 980a885341..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/unsubscribe_vehicle_data_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_request.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_request.h
deleted file mode 120000
index 4432804761..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_request.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/update_turn_list_request.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_response.h b/src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_response.h
deleted file mode 120000
index c778fb169e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/mobile/update_turn_list_response.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/commands/mobile/update_turn_list_response.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/commands/pending.h b/src/components/application_manager/test/mock/include/application_manager/commands/pending.h
deleted file mode 120000
index 4dd9a4a88f..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/commands/pending.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/commands/pending.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/event_engine/event.h b/src/components/application_manager/test/mock/include/application_manager/event_engine/event.h
deleted file mode 120000
index 7b6f069885..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/event_engine/event.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/event_engine/event.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher.h b/src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher.h
deleted file mode 120000
index b0f651781b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/event_engine/event_dispatcher.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher_impl.h b/src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher_impl.h
new file mode 120000
index 0000000000..1e76796cfe
--- /dev/null
+++ b/src/components/application_manager/test/mock/include/application_manager/event_engine/event_dispatcher_impl.h
@@ -0,0 +1 @@
+../../../../../include/application_manager/event_engine/event_dispatcher_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/event_engine/event_observer.h b/src/components/application_manager/test/mock/include/application_manager/event_engine/event_observer.h
deleted file mode 120000
index dc6af86240..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/event_engine/event_observer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/event_engine/event_observer.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/hmi_capabilities.h b/src/components/application_manager/test/mock/include/application_manager/hmi_capabilities.h
deleted file mode 120000
index 9ceb7b9b97..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/hmi_capabilities.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/hmi_capabilities.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/hmi_command_factory.h b/src/components/application_manager/test/mock/include/application_manager/hmi_command_factory.h
deleted file mode 120000
index 327faa9730..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/hmi_command_factory.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/hmi_command_factory.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/hmi_state.h b/src/components/application_manager/test/mock/include/application_manager/hmi_state.h
deleted file mode 120000
index 62e3c1a937..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/hmi_state.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/hmi_state.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/message.h b/src/components/application_manager/test/mock/include/application_manager/message.h
deleted file mode 120000
index 3ae48a9129..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/message.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/message.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/message_helper.h b/src/components/application_manager/test/mock/include/application_manager/message_helper.h
deleted file mode 120000
index 6227694b37..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/message_helper.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/message_helper.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/mobile_command_factory.h b/src/components/application_manager/test/mock/include/application_manager/mobile_command_factory.h
deleted file mode 120000
index 20bd35432a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/mobile_command_factory.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/mobile_command_factory.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h b/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h
deleted file mode 120000
index 8cfa824c4a..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/mobile_message_handler.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/mobile_message_handler.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/mock_statistics_manager.h b/src/components/application_manager/test/mock/include/application_manager/mock_statistics_manager.h
new file mode 100644
index 0000000000..20f7c83034
--- /dev/null
+++ b/src/components/application_manager/test/mock/include/application_manager/mock_statistics_manager.h
@@ -0,0 +1,63 @@
+/* Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_MOCK_STATISTICS_MANAGER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_MOCK_STATISTICS_MANAGER_H_
+
+#include <string>
+
+#include "gmock/gmock.h"
+
+#include "usage_statistics/statistics_manager.h"
+#include "application_manager/usage_statistics.h"
+
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+using namespace ::usage_statistics;
+class MockStatisticsManager: public StatisticsManager {
+ public:
+ MOCK_METHOD1(Increment, void(GlobalCounterId type));
+ MOCK_METHOD2(Increment, void(const std::string& app_id, AppCounterId type));
+ MOCK_METHOD3(Set, void(const std::string& app_id,
+ AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add, void(const std::string& app_id,
+ AppStopwatchId type,
+ int32_t timespan_seconds));
+ virtual ~MockStatisticsManager(){}
+};
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_INCLUDE_MOCK_STATISTICS_MANAGER_H_
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/delegates/app_permission_delegate.h b/src/components/application_manager/test/mock/include/application_manager/policies/delegates/app_permission_delegate.h
deleted file mode 120000
index 0dc895b545..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/delegates/app_permission_delegate.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/policies/delegates/app_permission_delegate.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/delegates/statistics_delegate.h b/src/components/application_manager/test/mock/include/application_manager/policies/delegates/statistics_delegate.h
deleted file mode 120000
index 4e71cefaa3..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/delegates/statistics_delegate.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../../include/application_manager/policies/delegates/statistics_delegate.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/policy_event_observer.h b/src/components/application_manager/test/mock/include/application_manager/policies/policy_event_observer.h
deleted file mode 120000
index 5cba69ed20..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/policy_event_observer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/policy_event_observer.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h b/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h
deleted file mode 120000
index 522113630c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/policy_handler.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler_observer.h b/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler_observer.h
deleted file mode 120000
index 22acc100db..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/policy_handler_observer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/policy_handler_observer.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/policy_retry_sequence.h b/src/components/application_manager/test/mock/include/application_manager/policies/policy_retry_sequence.h
deleted file mode 120000
index 569a62252b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/policy_retry_sequence.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/policy_retry_sequence.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler.h b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler.h
deleted file mode 120000
index 22e071c885..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/pt_exchange_handler.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_ext.h b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_ext.h
deleted file mode 120000
index 080045466b..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_ext.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/pt_exchange_handler_ext.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h b/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h
deleted file mode 120000
index f3a2017c58..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/policies/pt_exchange_handler_impl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../../include/application_manager/policies/pt_exchange_handler_impl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/request_controller.h b/src/components/application_manager/test/mock/include/application_manager/request_controller.h
deleted file mode 120000
index 1b619cf77c..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/request_controller.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/request_controller.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/request_info.h b/src/components/application_manager/test/mock/include/application_manager/request_info.h
deleted file mode 120000
index c726e09a39..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/request_info.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/request_info.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/resume_ctrl.h b/src/components/application_manager/test/mock/include/application_manager/resume_ctrl.h
deleted file mode 120000
index 889e967d4e..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/resume_ctrl.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/resume_ctrl.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h b/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h
deleted file mode 120000
index 94919c6ced..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/smart_object_keys.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/smart_object_keys.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/state_context.h b/src/components/application_manager/test/mock/include/application_manager/state_context.h
deleted file mode 120000
index f94c0054c2..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/state_context.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/state_context.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/state_controller.h b/src/components/application_manager/test/mock/include/application_manager/state_controller.h
deleted file mode 120000
index 6c61865d18..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/state_controller.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/state_controller.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/time_metric_observer.h b/src/components/application_manager/test/mock/include/application_manager/time_metric_observer.h
deleted file mode 120000
index 4786675fde..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/time_metric_observer.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/time_metric_observer.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/usage_statistics.h b/src/components/application_manager/test/mock/include/application_manager/usage_statistics.h
deleted file mode 120000
index bff65d5633..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/usage_statistics.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/usage_statistics.h \ No newline at end of file
diff --git a/src/components/application_manager/test/mock/include/application_manager/vehicle_info_data.h b/src/components/application_manager/test/mock/include/application_manager/vehicle_info_data.h
deleted file mode 120000
index 0ea43f1210..0000000000
--- a/src/components/application_manager/test/mock/include/application_manager/vehicle_info_data.h
+++ /dev/null
@@ -1 +0,0 @@
-../../../../include/application_manager/vehicle_info_data.h \ No newline at end of file
diff --git a/src/components/transport_manager/test/mock_transport_adapter.cc b/src/components/application_manager/test/mock/mock_telemetry_observer.h
index 8612ca363b..3130a7382a 100644
--- a/src/components/transport_manager/test/mock_transport_adapter.cc
+++ b/src/components/application_manager/test/mock/mock_telemetry_observer.h
@@ -30,28 +30,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "include/mock_connection.h"
-#include "include/mock_device.h"
-#include "include/mock_transport_adapter.h"
-#include "include/mock_device_scanner.h"
-#include "include/mock_connection_factory.h"
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include "application_manager/telemetry_observer.h"
namespace test {
namespace components {
-namespace transport_manager {
-
-MockTransportAdapter::MockTransportAdapter()
- : TransportAdapterImpl(new MockDeviceScanner(this),
- new MockConnectionFactory(this), NULL) {}
+namespace application_manager_test {
-void MockTransportAdapter::reset() {
- get_device_scanner()->reset();
-}
+class MockAMTelemetryObserver : public application_manager::AMTelemetryObserver {
+ public:
+ MOCK_METHOD1(OnMessage, void(MessageMetricSharedPtr));
+};
-MockDeviceScanner* MockTransportAdapter::get_device_scanner() const {
- return static_cast<MockDeviceScanner*>(device_scanner_);
-}
-
-} // namespace transport_manager
+} // namespace application_manager_test
} // namespace components
} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_APPLICATION_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
diff --git a/src/components/application_manager/test/mock/policy_handler_interface_mock.h b/src/components/application_manager/test/mock/policy_handler_interface_mock.h
new file mode 100644
index 0000000000..e92950823a
--- /dev/null
+++ b/src/components/application_manager/test/mock/policy_handler_interface_mock.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_POLICY_HANDLER_INTERFACE_MOCK_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_POLICY_HANDLER_INTERFACE_MOCK_H_
+
+#include "application_manager/policies/policy_handler_interface.h"
+#include "gmock/gmock.h"
+#include "policy/policy_types.h"
+
+
+namespace policy {
+
+class MockPolicyHandlerInterface : public PolicyHandlerInterface {
+ public:
+ MOCK_METHOD0(OnSystemReady, void());
+ MOCK_METHOD2(PTUpdatedAt, void(Counters counter, int value));
+};
+
+} // namespace policy
+
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_POLICY_HANDLER_INTERFACE_MOCK_H_
+
diff --git a/src/components/application_manager/test/mock_message_helper.cc b/src/components/application_manager/test/mock_message_helper.cc
new file mode 100644
index 0000000000..deec54e61f
--- /dev/null
+++ b/src/components/application_manager/test/mock_message_helper.cc
@@ -0,0 +1,302 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/message_helper.h"
+#include "mock_message_helper.h"
+
+namespace application_manager {
+
+void MessageHelper::SendHashUpdateNotification(uint32_t const app_id) {
+ MockMessageHelper::message_helper_mock()->SendHashUpdateNotification(app_id);
+}
+void MessageHelper::SendNaviStartStream(int32_t connection_key) {
+ MockMessageHelper::message_helper_mock()->SendNaviStartStream(connection_key);
+}
+void MessageHelper::SendNaviStopStream(int32_t connection_key) {
+ MockMessageHelper::message_helper_mock()->SendNaviStopStream(connection_key);
+}
+void MessageHelper::SendAudioStartStream(int32_t connection_key) {
+ MockMessageHelper::message_helper_mock()->SendAudioStartStream(
+ connection_key);
+}
+void MessageHelper::SendAudioStopStream(int32_t connection_key) {
+ MockMessageHelper::message_helper_mock()->SendAudioStopStream(connection_key);
+}
+void MessageHelper::SendOnDataStreaming(protocol_handler::ServiceType service,
+ bool available) {
+ MockMessageHelper::message_helper_mock()->SendOnDataStreaming(service,
+ available);
+}
+
+uint32_t MessageHelper::GetAppCommandLimit(const std::string& policy_app_id) {
+ return MockMessageHelper::message_helper_mock()->GetAppCommandLimit(
+ policy_app_id);
+}
+
+smart_objects::SmartObjectSPtr GetHashUpdateNotification(
+ const uint32_t app_id) {
+ return MockMessageHelper::message_helper_mock()->GetHashUpdateNotification(
+ app_id);
+}
+
+std::string MessageHelper::HMIResultToString(
+ hmi_apis::Common_Result::eType hmi_result) {
+ return MockMessageHelper::message_helper_mock()->HMIResultToString(
+ hmi_result);
+}
+
+hmi_apis::Common_Result::eType MessageHelper::HMIResultFromString(
+ const std::string& hmi_result) {
+ return MockMessageHelper::message_helper_mock()->HMIResultFromString(
+ hmi_result);
+}
+
+std::string MessageHelper::MobileResultToString(
+ mobile_apis::Result::eType mobile_result) {
+ return MockMessageHelper::message_helper_mock()->MobileResultToString(
+ mobile_result);
+}
+
+mobile_api::Result::eType MessageHelper::MobileResultFromString(
+ const std::string& mobile_result) {
+ return MockMessageHelper::message_helper_mock()->MobileResultFromString(
+ mobile_result);
+}
+
+mobile_api::Result::eType MessageHelper::HMIToMobileResult(
+ const hmi_apis::Common_Result::eType hmi_result) {
+ return MockMessageHelper::message_helper_mock()->HMIToMobileResult(
+ hmi_result);
+}
+
+hmi_apis::Common_Result::eType MessageHelper::MobileToHMIResult(
+ const mobile_api::Result::eType mobile_result) {
+ return MockMessageHelper::message_helper_mock()->MobileToHMIResult(
+ mobile_result);
+}
+
+mobile_api::HMILevel::eType MessageHelper::StringToHMILevel(
+ const std::string& hmi_level) {
+ return MockMessageHelper::message_helper_mock()->StringToHMILevel(hmi_level);
+}
+
+smart_objects::SmartObjectSPtr CreateDeviceListSO(
+ const connection_handler::DeviceMap& devices) {
+ return MockMessageHelper::message_helper_mock()->CreateDeviceListSO(devices);
+}
+
+void MessageHelper::SendOnAppPermissionsChangedNotification(
+ uint32_t connection_key, const policy::AppPermissions& permissions) {
+ MockMessageHelper::message_helper_mock()
+ ->SendOnAppPermissionsChangedNotification(connection_key, permissions);
+}
+
+void MessageHelper::SendGetUserFriendlyMessageResponse(
+ const std::vector<policy::UserFriendlyMessage>& msg,
+ uint32_t correlation_id) {
+ MockMessageHelper::message_helper_mock()->SendGetUserFriendlyMessageResponse(
+ msg, correlation_id);
+}
+
+void MessageHelper::SendGetStatusUpdateResponse(const std::string& status,
+ uint32_t correlation_id) {
+ MockMessageHelper::message_helper_mock()->SendGetStatusUpdateResponse(
+ status, correlation_id);
+}
+
+void MessageHelper::SendOnStatusUpdate(const std::string& status) {
+ MockMessageHelper::message_helper_mock()->SendOnStatusUpdate(status);
+}
+
+void MessageHelper::SendGetSystemInfoRequest() {
+ MockMessageHelper::message_helper_mock()->SendGetSystemInfoRequest();
+}
+
+void MessageHelper::CreateGetVehicleDataRequest(
+ uint32_t correlation_id, const std::vector<std::string>& params) {
+ MockMessageHelper::message_helper_mock()->CreateGetVehicleDataRequest(
+ correlation_id, params);
+}
+
+void MessageHelper::SendGetListOfPermissionsResponse(
+ const std::vector<policy::FunctionalGroupPermission>& permissions,
+ uint32_t correlation_id) {
+ MockMessageHelper::message_helper_mock()->SendGetListOfPermissionsResponse(
+ permissions, correlation_id);
+}
+
+void MessageHelper::SendOnPermissionsChangeNotification(
+ uint32_t connection_key, const policy::Permissions& permissions) {
+ MockMessageHelper::message_helper_mock()->SendOnPermissionsChangeNotification(
+ connection_key, permissions);
+}
+
+void MessageHelper::SendPolicySnapshotNotification(
+ unsigned int connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url) {
+ MockMessageHelper::message_helper_mock()->SendPolicySnapshotNotification(
+ connection_key, policy_data, url);
+}
+void MessageHelper::SendOnAppInterfaceUnregisteredNotificationToMobile(
+ int32_t connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::eType reason) {
+ MockMessageHelper::message_helper_mock()
+ ->SendOnAppInterfaceUnregisteredNotificationToMobile(connection_key,
+ reason);
+}
+
+void MessageHelper::SendSDLActivateAppResponse(
+ policy::AppPermissions& permissions, uint32_t correlation_id) {
+ MockMessageHelper::message_helper_mock()->SendSDLActivateAppResponse(
+ permissions, correlation_id);
+}
+
+void MessageHelper::SendPolicyUpdate(const std::string& file_path,
+ int timeout,
+ const std::vector<int>& retries) {
+ MockMessageHelper::message_helper_mock()->SendPolicyUpdate(
+ file_path, timeout, retries);
+}
+
+void MessageHelper::SendUpdateSDLResponse(const std::string& result,
+ uint32_t correlation_id) {
+ MockMessageHelper::message_helper_mock()->SendUpdateSDLResponse(
+ result, correlation_id);
+}
+
+void MessageHelper::SendOnLanguageChangeToMobile(uint32_t connection_key) {
+ MockMessageHelper::message_helper_mock()->SendOnLanguageChangeToMobile(connection_key);
+}
+
+void MessageHelper::SendDecryptCertificateToHMI(const std::string& file_name) {
+ MockMessageHelper::message_helper_mock()->SendDecryptCertificateToHMI(
+ file_name);
+}
+
+hmi_apis::Common_Language::eType MessageHelper::CommonLanguageFromString(const std::string& language) {
+ return MockMessageHelper::message_helper_mock()->CommonLanguageFromString(
+ language);
+}
+
+std::string MessageHelper::MobileLanguageToString(const mobile_apis::Language::eType language) {
+ return MockMessageHelper::message_helper_mock()->MobileLanguageToString(language);
+}
+
+mobile_apis::Language::eType MessageHelper::MobileLanguageFromString(const std::string& language) {
+ return MockMessageHelper::message_helper_mock()->MobileLanguageFromString(language);
+}
+
+hmi_apis::Common_Language::eType MessageHelper::MobileToCommonLanguage(const mobile_apis::Language::eType language) {
+ return MockMessageHelper::message_helper_mock()->MobileToCommonLanguage(language);
+}
+
+mobile_apis::Language::eType MessageHelper::CommonToMobileLanguage(const hmi_apis::Common_Language::eType language) {
+ return MockMessageHelper::message_helper_mock()->CommonToMobileLanguage(language);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::CreateModuleInfoSO (uint32_t function_id) {
+ return MockMessageHelper::message_helper_mock()->CreateModuleInfoSO(
+ function_id);
+}
+
+MockMessageHelper* MockMessageHelper::message_helper_mock() {
+ static MockMessageHelper message_helper_mock;
+ return &message_helper_mock;
+}
+void MessageHelper::SendAllOnButtonSubscriptionNotificationsForApp(
+ ApplicationConstSharedPtr app) {
+ MockMessageHelper::message_helper_mock()
+ ->SendAllOnButtonSubscriptionNotificationsForApp(app);
+}
+
+void MessageHelper::SendOnResumeAudioSourceToHMI(const uint32_t app_id) {
+ MockMessageHelper::message_helper_mock()->SendOnResumeAudioSourceToHMI(
+ app_id);
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateAddSubMenuRequestToHMI(
+ ApplicationConstSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()->CreateAddSubMenuRequestToHMI(
+ app);
+}
+
+smart_objects::SmartObjectList MessageHelper::CreateAddCommandRequestToHMI(
+ ApplicationConstSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()->CreateAddCommandRequestToHMI(
+ app);
+}
+
+smart_objects::SmartObjectList
+MessageHelper::CreateAddVRCommandRequestFromChoiceToHMI(
+ ApplicationConstSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()
+ ->CreateAddVRCommandRequestFromChoiceToHMI(app);
+}
+
+void MessageHelper::SendGlobalPropertiesToHMI(ApplicationConstSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()->SendGlobalPropertiesToHMI(
+ app);
+}
+
+smart_objects::SmartObjectList MessageHelper::GetIVISubscriptionRequests(
+ ApplicationSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()->GetIVISubscriptionRequests(
+ app);
+}
+
+mobile_apis::Result::eType MessageHelper::VerifyImageFiles(
+ smart_objects::SmartObject& message, ApplicationConstSharedPtr app) {
+ return MockMessageHelper::message_helper_mock()->VerifyImageFiles(message,
+ app);
+}
+std::string MessageHelper::CommonLanguageToString(
+ hmi_apis::Common_Language::eType lang) {
+ return MockMessageHelper::message_helper_mock()->CommonLanguageToString(lang);
+}
+
+bool MessageHelper::CheckWithPolicy(
+ mobile_apis::SystemAction::eType system_action,
+ const std::string& app_mobile_id) {
+ return MockMessageHelper::message_helper_mock()->CheckWithPolicy(
+ system_action, app_mobile_id);
+}
+
+smart_objects::SmartObjectSPtr MessageHelper::GetBCActivateAppRequestToHMI(
+ ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType hmi_level,
+ bool send_policy_priority) {
+ return MockMessageHelper::message_helper_mock()->
+ GetBCActivateAppRequestToHMI(app, hmi_level, send_policy_priority);
+}
+
+} // namespace application_manager
diff --git a/src/components/application_manager/test/mock_message_helper.h b/src/components/application_manager/test/mock_message_helper.h
new file mode 100644
index 0000000000..967653721f
--- /dev/null
+++ b/src/components/application_manager/test/mock_message_helper.h
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_MESSAGE_HELPER_H_
+#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_MESSAGE_HELPER_H_
+#include "gmock/gmock.h"
+#include "application_manager/application.h"
+#include "interfaces/HMI_API.h"
+#include "policy/policy_types.h"
+
+namespace application_manager {
+
+namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
+class MockMessageHelper {
+ public:
+ MOCK_METHOD1(GetHashUpdateNotification,
+ smart_objects::SmartObjectSPtr(const uint32_t app_id));
+ MOCK_METHOD1(SendHashUpdateNotification, void(const uint32_t app_id));
+ MOCK_METHOD1(HMIResultToString,
+ std::string(hmi_apis::Common_Result::eType hmi_result));
+ MOCK_METHOD1(HMIResultFromString,
+ hmi_apis::Common_Result::eType(const std::string& hmi_result));
+ MOCK_METHOD1(MobileResultToString,
+ std::string(mobile_apis::Result::eType mobile_result));
+ MOCK_METHOD1(MobileResultFromString,
+ mobile_api::Result::eType(const std::string& mobile_result));
+ MOCK_METHOD1(HMIToMobileResult,
+ mobile_api::Result::eType(
+ const hmi_apis::Common_Result::eType hmi_result));
+ MOCK_METHOD1(MobileToHMIResult,
+ hmi_apis::Common_Result::eType(
+ const mobile_api::Result::eType mobile_result));
+ MOCK_METHOD1(StringToHMILevel,
+ mobile_api::HMILevel::eType(const std::string& hmi_level));
+ MOCK_METHOD1(CreateDeviceListSO,
+ smart_objects::SmartObjectSPtr(
+ const connection_handler::DeviceMap& devices));
+ MOCK_METHOD1(SendNaviStartStream, void(int32_t connection_key));
+ MOCK_METHOD1(SendNaviStopStream, void(int32_t connection_key));
+ MOCK_METHOD2(SendOnAppPermissionsChangedNotification,
+ void(uint32_t connection_key,
+ const policy::AppPermissions& permissions));
+ MOCK_METHOD1(SendAudioStartStream, void(int32_t connection_key));
+ MOCK_METHOD1(SendAudioStopStream, void(int32_t connection_key));
+ MOCK_METHOD2(SendOnDataStreaming,
+ void(protocol_handler::ServiceType service, bool available));
+ MOCK_METHOD1(GetAppCommandLimit, uint32_t(const std::string& policy_app_id));
+ MOCK_METHOD2(CreateGetVehicleDataRequest,
+ void(uint32_t correlation_id,
+ const std::vector<std::string>& params));
+ MOCK_METHOD2(SendUpdateSDLResponse,
+ void(const std::string& result, uint32_t correlation_id));
+ MOCK_METHOD2(SendGetUserFriendlyMessageResponse,
+ void(const std::vector<policy::UserFriendlyMessage>& msg,
+ uint32_t correlation_id));
+ MOCK_METHOD2(SendGetStatusUpdateResponse,
+ void(const std::string& status, uint32_t correlation_id));
+ MOCK_METHOD1(SendOnStatusUpdate, void(const std::string& status));
+ MOCK_METHOD2(SendSDLActivateAppResponse,
+ void(policy::AppPermissions& permissions,
+ uint32_t correlation_id));
+ MOCK_METHOD0(SendGetSystemInfoRequest, void());
+ MOCK_METHOD1(SendDecryptCertificateToHMI, void(const std::string& file_name));
+ MOCK_METHOD3(SendPolicyUpdate,
+ void(const std::string& file_path,
+ int timeout,
+ const std::vector<int>& retries));
+ MOCK_METHOD2(
+ SendGetListOfPermissionsResponse,
+ void(const std::vector<policy::FunctionalGroupPermission>& permissions,
+ uint32_t correlation_id));
+ MOCK_METHOD2(SendOnPermissionsChangeNotification,
+ void(uint32_t connection_key,
+ const policy::Permissions& permissions));
+ MOCK_METHOD3(SendPolicySnapshotNotification,
+ void(unsigned int connection_key,
+ const std::vector<uint8_t>& policy_data,
+ const std::string& url));
+ MOCK_METHOD2(SendOnAppInterfaceUnregisteredNotificationToMobile,
+ void(int32_t connection_key,
+ mobile_apis::AppInterfaceUnregisteredReason::eType reason));
+ MOCK_METHOD1(SendOnLanguageChangeToMobile,
+ void(uint32_t connection_key));
+ MOCK_METHOD1(CommonLanguageFromString, hmi_apis::Common_Language::eType(
+ const std::string& language)) ;
+ MOCK_METHOD1(CommonLanguageToString, std::string(
+ hmi_apis::Common_Language::eType));
+ MOCK_METHOD1(MobileLanguageToString,
+ std::string(const mobile_apis::Language::eType language));
+ MOCK_METHOD1(MobileLanguageFromString,
+ mobile_apis::Language::eType(const std::string& lanugage));
+ MOCK_METHOD1(MobileToCommonLanguage,
+ hmi_apis::Common_Language::eType(const mobile_apis::Language::eType language));
+ MOCK_METHOD1(CommonToMobileLanguage,
+ mobile_apis::Language::eType(const hmi_apis::Common_Language::eType language));
+
+ MOCK_METHOD1(CreateModuleInfoSO, smart_objects::SmartObjectSPtr(uint32_t function_id));
+ MOCK_METHOD1(SendAllOnButtonSubscriptionNotificationsForApp,
+ void(ApplicationConstSharedPtr app));
+
+ MOCK_METHOD1(SendOnResumeAudioSourceToHMI, void(uint32_t app_id));
+ MOCK_METHOD1(CreateAddSubMenuRequestToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app));
+ MOCK_METHOD1(CreateAddCommandRequestToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app));
+ MOCK_METHOD1(CreateAddVRCommandRequestFromChoiceToHMI,
+ smart_objects::SmartObjectList(ApplicationConstSharedPtr app));
+ MOCK_METHOD1(SendGlobalPropertiesToHMI, void(ApplicationConstSharedPtr app));
+ MOCK_METHOD1(GetIVISubscriptionRequests,
+ smart_objects::SmartObjectList(ApplicationSharedPtr app));
+ MOCK_METHOD2(VerifyImageFiles,
+ mobile_apis::Result::eType(smart_objects::SmartObject& message,
+ ApplicationConstSharedPtr app));
+ MOCK_METHOD2(CheckWithPolicy,
+ bool(mobile_apis::SystemAction::eType, const std::string&));
+
+ MOCK_METHOD3(GetBCActivateAppRequestToHMI, smart_objects::SmartObjectSPtr (ApplicationConstSharedPtr app,
+ hmi_apis::Common_HMILevel::eType level,
+ bool send_policy_priority));
+
+ static MockMessageHelper* message_helper_mock();
+};
+
+} // namespace application_manager
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_MOCK_MESSAGE_HELPER_H_
diff --git a/src/components/application_manager/test/request_info_test.cc b/src/components/application_manager/test/request_info_test.cc
index 86103e7998..886736fa97 100644
--- a/src/components/application_manager/test/request_info_test.cc
+++ b/src/components/application_manager/test/request_info_test.cc
@@ -1,242 +1,487 @@
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
#include "application_manager/request_info.h"
-#include "application_manager/message_helper.h"
#include <iostream>
+#include <vector>
+#include <limits>
+#include "gmock/gmock.h"
+#include "utils/shared_ptr.h"
+#include "utils/make_shared.h"
namespace request_info = application_manager::request_controller;
-class MockRequest: public application_manager::commands::Command {
- public:
- MockRequest(uint32_t connection_key,
- uint32_t correlation_id):
- connection_key_(connection_key),
- correlation_id_(correlation_id) {
-
- }
- MOCK_METHOD0(CheckPermissions, bool ());
- MOCK_METHOD0(Init, bool ());
- MOCK_METHOD0(Run, void ());
- MOCK_METHOD0(CleanUp, bool ());
- MOCK_CONST_METHOD0(default_timeout, uint32_t ());
- MOCK_CONST_METHOD0(function_id, int32_t ());
- MOCK_METHOD0(onTimeOut, void ());
- MOCK_METHOD0(AllowedToTerminate, bool ());
- MOCK_METHOD1(SetAllowedToTerminate, void (bool));
-
- uint32_t connection_key_;
- uint32_t correlation_id_;
- virtual uint32_t connection_key() const;
- virtual uint32_t correlation_id() const;
-};
+namespace test {
+namespace components {
+namespace application_manager_test {
+
+class MockRequest : public application_manager::commands::Command {
+ public:
+ MockRequest(uint32_t connection_key, uint32_t correlation_id)
+ : connection_key_(connection_key), correlation_id_(correlation_id) {}
+ MOCK_METHOD0(CheckPermissions, bool());
+ MOCK_METHOD0(Init, bool());
+ MOCK_METHOD0(Run, void());
+ MOCK_METHOD0(CleanUp, bool());
+ MOCK_CONST_METHOD0(default_timeout, uint32_t());
+ MOCK_CONST_METHOD0(function_id, int32_t());
+ MOCK_METHOD0(onTimeOut, void());
+ MOCK_METHOD0(AllowedToTerminate, bool());
+ MOCK_METHOD1(SetAllowedToTerminate, void(bool));
-class TestRequestInfo: public request_info::RequestInfo {
- public:
- TestRequestInfo(request_info::RequestPtr request,
- const RequestType requst_type,
- const TimevalStruct& start_time,
- const uint64_t timeout_sec):
- RequestInfo(request, requst_type, start_time,timeout_sec) {
+ uint32_t connection_key_;
+ uint32_t correlation_id_;
+ virtual uint32_t connection_key() const {
+ return connection_key_;
+ }
+ virtual uint32_t correlation_id() const {
+ return correlation_id_;
+ }
+};
- }
- void SetEndTime(const TimevalStruct& end_time);
+class TestRequestInfo : public request_info::RequestInfo {
+ public:
+ TestRequestInfo(request_info::RequestPtr request,
+ const RequestType requst_type,
+ const TimevalStruct& start_time,
+ const uint64_t timeout_msec)
+ : RequestInfo(request, requst_type, start_time, timeout_msec) {}
+ void SetEndTime(const TimevalStruct& end_time) {
+ end_time_ = end_time;
+ }
};
+
class RequestInfoTest : public ::testing::Test {
- protected:
- virtual void SetUp() {
- //INIT_LOGGER("log4cxx.properties");
- count_of_requests_for_test_ = 1000;
- hmi_connection_key_ = 0;
- mobile_connection_key1_ = 65431;
- mobile_connection_key2_ = 65123;
- default_timeout_ = 10;
- srand(42);
- }
- virtual void TearDown() {
- //DEINIT_LOGGER();
- }
-
- request_info::RequestInfoSet request_info_set_;
- uint32_t count_of_requests_for_test_ ;
- uint32_t hmi_connection_key_;
- uint32_t mobile_connection_key1_;
- uint32_t mobile_connection_key2_;
- uint32_t default_timeout_;
-
- utils::SharedPtr<TestRequestInfo> create_test_info(uint32_t connection_key,
- uint32_t correlation_id,
- request_info::RequestInfo::RequestType requst_type,
- const TimevalStruct& start_time,
- uint64_t timeout_sec) {
- utils::SharedPtr<MockRequest> mock_request(new MockRequest(connection_key,correlation_id));
- TestRequestInfo* test_request_raw = new TestRequestInfo(mock_request,requst_type,
- start_time, timeout_sec);
- utils::SharedPtr<TestRequestInfo> request(test_request_raw);
- return request;
- }
+ protected:
+ virtual void SetUp() OVERRIDE {
+ count_of_requests_for_test_ = 1000;
+ hmi_connection_key_ = 0;
+ mobile_connection_key1_ = 65431;
+ mobile_connection_key2_ = 65123;
+ mobile_correlation_id = 111;
+ default_timeout_ = 10;
+ }
+
+ request_info::RequestInfoSet request_info_set_;
+ uint32_t count_of_requests_for_test_;
+ uint32_t hmi_connection_key_;
+ uint32_t mobile_connection_key1_;
+ uint32_t mobile_connection_key2_;
+ uint32_t default_timeout_;
+ uint32_t mobile_correlation_id;
+
+ utils::SharedPtr<TestRequestInfo> CreateTestInfo(
+ uint32_t connection_key,
+ uint32_t correlation_id,
+ request_info::RequestInfo::RequestType requst_type,
+ const TimevalStruct& start_time,
+ uint64_t timeout_msec) {
+ utils::SharedPtr<MockRequest> mock_request =
+ utils::MakeShared<MockRequest>(connection_key, correlation_id);
+ utils::SharedPtr<TestRequestInfo> request =
+ utils::MakeShared<TestRequestInfo>(
+ mock_request, requst_type, start_time, timeout_msec);
+ return request;
+ }
};
-TEST_F(RequestInfoTest, RequestInfoEqualEndTimeTest) {
- std::list<utils::SharedPtr<TestRequestInfo> > requests;
+TEST_F(RequestInfoTest, RequestInfoEqualEndTime) {
+ std::vector<utils::SharedPtr<TestRequestInfo>> requests;
const TimevalStruct& time = date_time::DateTime::getCurrentTime();
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request =
- create_test_info(rand(), rand(), request_info::RequestInfo::MobileRequest,
- time, default_timeout_);
+ utils::SharedPtr<TestRequestInfo> request = CreateTestInfo(
+ i, i, request_info::RequestInfo::MobileRequest, time, default_timeout_);
request->SetEndTime(time);
EXPECT_TRUE(request_info_set_.Add(request));
}
EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size());
}
-TEST_F(RequestInfoTest, RequestInfoSetInsertErazeTest) {
+TEST_F(RequestInfoTest, AddRemoveHMIRequests) {
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
utils::SharedPtr<TestRequestInfo> request =
- create_test_info(hmi_connection_key_, i, request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(), default_timeout_);
- EXPECT_TRUE(request_info_set_.Add(request));
- EXPECT_EQ(1, request_info_set_.RemoveRequest(request));
+ CreateTestInfo(hmi_connection_key_,
+ i,
+ request_info::RequestInfo::HMIRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+ EXPECT_TRUE(request_info_set_.Add(request));
+ EXPECT_TRUE(request_info_set_.RemoveRequest(request));
}
EXPECT_EQ(0u, request_info_set_.Size());
- std::list<utils::SharedPtr<TestRequestInfo> > requests;
+}
+TEST_F(RequestInfoTest, AddHMIRequests_RemoveAllRequests) {
+ std::vector<utils::SharedPtr<TestRequestInfo>> requests;
+
+ // Add hmi requests
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request =
- create_test_info(hmi_connection_key_, i, request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(), default_timeout_);
- requests.push_back(request);
- EXPECT_TRUE(request_info_set_.Add(request));
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(hmi_connection_key_,
+ i,
+ request_info::RequestInfo::HMIRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+ requests.push_back(request);
+ EXPECT_TRUE(request_info_set_.Add(request));
}
+ EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size());
- std::list<utils::SharedPtr<TestRequestInfo> >::iterator it = requests.begin();
- std::list<utils::SharedPtr<TestRequestInfo> >::iterator end = requests.end();
+ // Delete every request
+ std::vector<utils::SharedPtr<TestRequestInfo>>::iterator req_it =
+ requests.begin();
- for (; it != end; ++it) {
- EXPECT_EQ(1,request_info_set_.RemoveRequest(*it));
+ for (; req_it != requests.end(); ++req_it) {
+ EXPECT_TRUE(request_info_set_.RemoveRequest(*req_it));
}
EXPECT_EQ(0u, request_info_set_.Size());
- it = requests.begin();
- for (; it != end; ++it) {
- EXPECT_TRUE(request_info_set_.Add(*it));
+
+ // Delete requests by connection key
+ req_it = requests.begin();
+ for (; req_it != requests.end(); ++req_it) {
+ EXPECT_TRUE(request_info_set_.Add(*req_it));
}
EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size());
- EXPECT_EQ(count_of_requests_for_test_, request_info_set_.RemoveByConnectionKey(hmi_connection_key_));
+ EXPECT_EQ(count_of_requests_for_test_,
+ request_info_set_.RemoveByConnectionKey(hmi_connection_key_));
EXPECT_EQ(0u, request_info_set_.Size());
- it = requests.begin();
- for (; it != end; ++it) {
- EXPECT_TRUE(request_info_set_.Add(*it));
+}
+
+TEST_F(RequestInfoTest, CheckRequestsMaxCount) {
+ const uint32_t app_hmi_level_time_scale = 100;
+ const uint32_t hmi_level_count = 1000;
+
+ // Count of added requests is less than max possible
+ std::vector<utils::SharedPtr<TestRequestInfo>> requests;
+ for (uint32_t i = 0; i < hmi_level_count - 1; ++i) {
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(mobile_connection_key1_,
+ i,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+
+ request->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ requests.push_back(request);
+ EXPECT_TRUE(request_info_set_.Add(request));
}
- EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size());
+ EXPECT_EQ(hmi_level_count - 1, request_info_set_.Size());
+
+ EXPECT_TRUE(request_info_set_.CheckHMILevelTimeScaleMaxRequest(
+ mobile_apis::HMILevel::HMI_FULL,
+ mobile_connection_key1_,
+ app_hmi_level_time_scale,
+ hmi_level_count));
+
+ // Adding new request is correct
+ utils::SharedPtr<TestRequestInfo> new_request =
+ CreateTestInfo(mobile_connection_key1_,
+ hmi_level_count,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+ new_request->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_TRUE(request_info_set_.Add(new_request));
+ EXPECT_EQ(hmi_level_count, request_info_set_.Size());
+
+ // Count of added requests is max
+ EXPECT_FALSE(request_info_set_.CheckHMILevelTimeScaleMaxRequest(
+ mobile_apis::HMILevel::HMI_FULL,
+ mobile_connection_key1_,
+ app_hmi_level_time_scale,
+ hmi_level_count));
+
+ utils::SharedPtr<TestRequestInfo> new_request2 =
+ CreateTestInfo(mobile_connection_key1_,
+ hmi_level_count + 1,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+
+ EXPECT_TRUE(request_info_set_.Add(new_request2));
+}
+
+TEST_F(RequestInfoTest, CheckMaxCountOfRequest) {
+ const uint32_t app_hmi_level_time_scale = 100;
+ const uint32_t hmi_level_count = 1000;
+
+ // Count of added requests is less than max possible
+ std::vector<utils::SharedPtr<TestRequestInfo>> requests;
+ for (uint32_t i = 0; i < hmi_level_count - 1; ++i) {
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(mobile_connection_key1_,
+ i,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+ request->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ requests.push_back(request);
+ EXPECT_TRUE(request_info_set_.Add(request));
+ }
+ EXPECT_EQ(hmi_level_count - 1, request_info_set_.Size());
+
+ EXPECT_TRUE(request_info_set_.CheckTimeScaleMaxRequest(
+ mobile_connection_key1_, app_hmi_level_time_scale, hmi_level_count));
+
+ // Adding new request is correct
+ utils::SharedPtr<TestRequestInfo> new_request =
+ CreateTestInfo(mobile_connection_key1_,
+ hmi_level_count,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+ new_request->set_hmi_level(mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_TRUE(request_info_set_.Add(new_request));
+ EXPECT_EQ(hmi_level_count, request_info_set_.Size());
+
+ // Count of added requests is max
+ EXPECT_FALSE(request_info_set_.CheckTimeScaleMaxRequest(
+ mobile_connection_key1_, app_hmi_level_time_scale, hmi_level_count));
+
+ utils::SharedPtr<TestRequestInfo> new_request2 =
+ CreateTestInfo(mobile_connection_key1_,
+ hmi_level_count + 1,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+
+ EXPECT_TRUE(request_info_set_.Add(new_request2));
+}
+
+TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequests) {
utils::SharedPtr<TestRequestInfo> mobile_request1 =
- create_test_info(mobile_connection_key1_, 12345, request_info::RequestInfo::MobileRequest,
- date_time::DateTime::getCurrentTime(), default_timeout_);
+ CreateTestInfo(mobile_connection_key1_,
+ 12345,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
EXPECT_TRUE(request_info_set_.Add(mobile_request1));
utils::SharedPtr<TestRequestInfo> mobile_request2 =
- create_test_info(mobile_connection_key2_, 54321, request_info::RequestInfo::MobileRequest,
- date_time::DateTime::getCurrentTime(), default_timeout_);
+ CreateTestInfo(mobile_connection_key2_,
+ 54321,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
EXPECT_TRUE(request_info_set_.Add(mobile_request2));
- EXPECT_EQ(count_of_requests_for_test_ + 2, request_info_set_.Size());
+ EXPECT_EQ(2u, request_info_set_.Size());
EXPECT_EQ(2u, request_info_set_.RemoveMobileRequests());
- EXPECT_EQ(count_of_requests_for_test_, request_info_set_.Size());
- EXPECT_TRUE(request_info_set_.Add(mobile_request1));
- EXPECT_TRUE(request_info_set_.Add(mobile_request2));
- EXPECT_EQ(1u, request_info_set_.RemoveByConnectionKey(mobile_connection_key1_));
- EXPECT_EQ(count_of_requests_for_test_ + 1, request_info_set_.Size());
- EXPECT_EQ(count_of_requests_for_test_, request_info_set_.RemoveByConnectionKey(hmi_connection_key_));
- EXPECT_EQ(1u, request_info_set_.Size());
- EXPECT_EQ(1u, request_info_set_.RemoveMobileRequests());
EXPECT_EQ(0u, request_info_set_.Size());
}
-TEST_F(RequestInfoTest, RequestInfoSetFrontTest) {
+TEST_F(RequestInfoTest, AddMobileRequests_RemoveMobileRequestsByConnectionKey) {
+ std::vector<utils::SharedPtr<TestRequestInfo>> requests;
+ const uint32_t count_of_mobile_request1 = 200;
+ const uint32_t count_of_mobile_request2 = 100;
+ for (uint32_t i = 0; i < count_of_mobile_request1; ++i) {
+ utils::SharedPtr<TestRequestInfo> mobile_request1 =
+ CreateTestInfo(mobile_connection_key1_,
+ i,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+ requests.push_back(mobile_request1);
+ EXPECT_TRUE(request_info_set_.Add(mobile_request1));
+ }
+ EXPECT_EQ(count_of_mobile_request1, request_info_set_.Size());
+
+ for (uint32_t i = 0; i < count_of_mobile_request2; ++i) {
+ utils::SharedPtr<TestRequestInfo> mobile_request2 =
+ CreateTestInfo(mobile_connection_key2_,
+ i,
+ request_info::RequestInfo::MobileRequest,
+ date_time::DateTime::getCurrentTime(),
+ default_timeout_);
+
+ requests.push_back(mobile_request2);
+ EXPECT_TRUE(request_info_set_.Add(mobile_request2));
+ }
+ EXPECT_EQ(count_of_mobile_request1 + count_of_mobile_request2,
+ request_info_set_.Size());
+
+ EXPECT_EQ(count_of_mobile_request1,
+ request_info_set_.RemoveByConnectionKey(mobile_connection_key1_));
+ EXPECT_EQ(count_of_mobile_request2,
+ request_info_set_.RemoveByConnectionKey(mobile_connection_key2_));
+ EXPECT_EQ(0u, request_info_set_.Size());
+}
+
+TEST_F(RequestInfoTest, RequestInfoSetFront) {
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- utils::SharedPtr<TestRequestInfo> request =
- create_test_info(mobile_connection_key1_, i, request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(), i);
- request_info_set_.Add(request);
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(mobile_connection_key1_,
+ i,
+ request_info::RequestInfo::HMIRequest,
+ date_time::DateTime::getCurrentTime(),
+ i);
+ request_info_set_.Add(request);
}
for (uint32_t i = 1; i < count_of_requests_for_test_; ++i) {
request_info::RequestInfoPtr request_info = request_info_set_.Front();
EXPECT_TRUE(request_info.valid());
- EXPECT_EQ(0u, request_info->timeout_sec());
request_info = request_info_set_.FrontWithNotNullTimeout();
EXPECT_TRUE(request_info.valid());
- EXPECT_EQ(i, request_info->timeout_sec());
EXPECT_TRUE(request_info_set_.RemoveRequest(request_info));
}
EXPECT_EQ(1u, request_info_set_.Size());
- EXPECT_EQ(1u, request_info_set_.RemoveByConnectionKey(mobile_connection_key1_));
+ EXPECT_EQ(1u,
+ request_info_set_.RemoveByConnectionKey(mobile_connection_key1_));
EXPECT_EQ(0u, request_info_set_.Size());
}
-TEST_F(RequestInfoTest, RequestInfoSetFindTest) {
-
- std::list <std::pair<uint32_t, uint32_t> > appId_coorrId;
+TEST_F(RequestInfoTest, RequestInfoSetFind) {
+ std::vector<std::pair<uint32_t, uint32_t>> appid_connection_id;
for (uint32_t i = 0; i < count_of_requests_for_test_; ++i) {
- appId_coorrId.push_back(std::pair<uint32_t, uint32_t>(rand(),rand()));
+ appid_connection_id.push_back(
+ std::pair<uint32_t, uint32_t>(i, count_of_requests_for_test_ - i));
}
- std::list <std::pair<uint32_t, uint32_t> >::iterator it;
- std::list <std::pair<uint32_t, uint32_t> >::iterator end =
- appId_coorrId.end();;
+ std::vector<std::pair<uint32_t, uint32_t>>::iterator req_it =
+ appid_connection_id.begin();
+ const std::vector<std::pair<uint32_t, uint32_t>>::iterator end =
+ appid_connection_id.end();
- for (it = appId_coorrId.begin(); it != end; ++it) {
+ for (; req_it != end; ++req_it) {
utils::SharedPtr<TestRequestInfo> request =
- create_test_info(it->first, it->second, request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(), 10);
+ CreateTestInfo(req_it->first,
+ req_it->second,
+ request_info::RequestInfo::HMIRequest,
+ date_time::DateTime::getCurrentTime(),
+ 10);
EXPECT_TRUE(request_info_set_.Add(request));
}
- request_info::RequestInfoPtr request = request_info_set_.Find(rand(),rand());
+ request_info::RequestInfoPtr request = request_info_set_.Find(
+ count_of_requests_for_test_, count_of_requests_for_test_);
EXPECT_FALSE(request.valid());
- for (it = appId_coorrId.begin(); it != end; ++it) {
- request_info::RequestInfoPtr request = request_info_set_.Find(it->first, it->second);
+
+ req_it = appid_connection_id.begin();
+ for (; req_it != end; ++req_it) {
+ request_info::RequestInfoPtr request =
+ request_info_set_.Find(req_it->first, req_it->second);
EXPECT_TRUE(request.valid());
- EXPECT_EQ(1u, request_info_set_.RemoveRequest(request));
- request = request_info_set_.Find(it->first, it->second);
+ EXPECT_TRUE(request_info_set_.RemoveRequest(request));
+ request = request_info_set_.Find(req_it->first, req_it->second);
EXPECT_FALSE(request.valid());
}
EXPECT_EQ(0u, request_info_set_.Size());
}
-TEST_F(RequestInfoTest, RequestInfoSetEqualHashTest) {
+TEST_F(RequestInfoTest, RequestInfoSetEqualHash) {
request_info::RequestInfoSet request_info_set;
const uint32_t connection_key = 65483;
const uint32_t corr_id = 65483;
utils::SharedPtr<TestRequestInfo> request =
- create_test_info(connection_key, corr_id, request_info::RequestInfo::HMIRequest,
- date_time::DateTime::getCurrentTime(), 10);
+ CreateTestInfo(connection_key,
+ corr_id,
+ request_info::RequestInfo::HMIRequest,
+ date_time::DateTime::getCurrentTime(),
+ 10);
EXPECT_TRUE(request_info_set.Add(request));
EXPECT_FALSE(request_info_set.Add(request));
EXPECT_FALSE(request_info_set.Add(request));
EXPECT_EQ(1u, request_info_set.Size());
- request_info::RequestInfoPtr found = request_info_set.Find(connection_key, corr_id);
+ request_info::RequestInfoPtr found =
+ request_info_set.Find(connection_key, corr_id);
EXPECT_TRUE(found.valid());
- EXPECT_EQ(1u, request_info_set.RemoveRequest(found));
+ EXPECT_TRUE(request_info_set.RemoveRequest(found));
EXPECT_EQ(0u, request_info_set.Size());
EXPECT_TRUE(request_info_set.Add(request));
EXPECT_FALSE(request_info_set.Add(request));
- found = request_info_set.FrontWithNotNullTimeout();
+ found = request_info_set.FrontWithNotNullTimeout();
EXPECT_TRUE(found.valid());
- EXPECT_EQ(1u, request_info_set.RemoveRequest(found));
- found = request_info_set.FrontWithNotNullTimeout();
+ EXPECT_TRUE(request_info_set.RemoveRequest(found));
+ found = request_info_set.FrontWithNotNullTimeout();
+ EXPECT_FALSE(found.valid());
+ found = request_info_set.Front();
EXPECT_FALSE(found.valid());
EXPECT_EQ(0u, request_info_set.Size());
}
+TEST_F(RequestInfoTest, EndTimeisExpired) {
+ TimevalStruct time = date_time::DateTime::getCurrentTime();
-uint32_t MockRequest::correlation_id() const {
- return correlation_id_;
-}
+ TimevalStruct not_expired = date_time::DateTime::getCurrentTime();
+ not_expired.tv_usec = std::numeric_limits<time_t>::min();
-uint32_t MockRequest::connection_key() const {
- return connection_key_;
+ TimevalStruct expired = date_time::DateTime::getCurrentTime();
+ expired.tv_usec = std::numeric_limits<time_t>::max();
+
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(mobile_connection_key1_,
+ mobile_correlation_id,
+ request_info::RequestInfo::MobileRequest,
+ time,
+ default_timeout_);
+
+ request->SetEndTime(expired);
+ EXPECT_FALSE(request->isExpired());
+
+ request->SetEndTime(not_expired);
+ EXPECT_TRUE(request->isExpired());
}
+TEST_F(RequestInfoTest, UpdateEndTime) {
+ TimevalStruct time = date_time::DateTime::getCurrentTime();
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(mobile_connection_key1_,
+ mobile_correlation_id,
+ request_info::RequestInfo::MobileRequest,
+ time,
+ default_timeout_);
+ request->SetEndTime(time);
+ request->updateEndTime();
+ TimevalStruct last_time = request->end_time();
+ EXPECT_LE(time.tv_sec, last_time.tv_sec);
+}
+TEST_F(RequestInfoTest, UpdateTimeOut) {
+ TimevalStruct time = date_time::DateTime::getCurrentTime();
+ utils::SharedPtr<TestRequestInfo> request =
+ CreateTestInfo(mobile_connection_key1_,
+ mobile_correlation_id,
+ request_info::RequestInfo::MobileRequest,
+ time,
+ default_timeout_);
+ request->SetEndTime(time);
+ request->updateEndTime();
-void TestRequestInfo::SetEndTime(const TimevalStruct& end_time) {
- end_time_ = end_time;
+ request->updateTimeOut(100);
+ time = date_time::DateTime::getCurrentTime();
+ TimevalStruct last_time = request->end_time();
+ EXPECT_NEAR(time.tv_sec + 100, last_time.tv_sec, 500);
}
+
+} // namespace application_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/resumption/include/application_mock.h b/src/components/application_manager/test/resumption/include/application_mock.h
deleted file mode 100644
index 39c4b33539..0000000000
--- a/src/components/application_manager/test/resumption/include/application_mock.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/*
-* Copyright (c) 2015, Ford Motor Company
-* All rights reserved.
-*
-* Redistribution and use in source and binary forms, with or without
-* modification, are permitted provided that the following conditions are met:
-*
-* Redistributions of source code must retain the above copyright notice, this
-* list of conditions and the following disclaimer.
-*
-* Redistributions in binary form must reproduce the above copyright notice,
-* this list of conditions and the following
-* disclaimer in the documentation and/or other materials provided with the
-* distribution.
-*
-* Neither the name of the Ford Motor Company nor the names of its contributors
-* may be used to endorse or promote products derived from this software
-* without specific prior written permission.
-*
-* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*/
-#ifndef SRC_COMPONENTS_APPLICATION_MANAGER_TEST_RESUMPTION_INCLUDE_APPLICATION_MOCK_H_
-#define SRC_COMPONENTS_APPLICATION_MANAGER_TEST_RESUMPTION_INCLUDE_APPLICATION_MOCK_H_
-#include <string>
-#include "gmock/gmock.h"
-#include "application_manager/application.h"
-
-namespace test {
-namespace components {
-namespace resumption_test {
-
-class ApplicationMock : public ::application_manager::Application {
- public:
- MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(curHash, const std::string&());
- MOCK_METHOD0(UpdateHash, void());
- MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
- MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag));
- MOCK_CONST_METHOD0(is_application_data_changed, bool());
- MOCK_METHOD1(set_is_application_data_changed,
- void(bool state_application_data));
- MOCK_METHOD0(CloseActiveMessage, void());
- MOCK_CONST_METHOD0(IsFullscreen, bool());
- MOCK_METHOD0(ChangeSupportingAppHMIType, void());
- MOCK_CONST_METHOD0(is_navi, bool());
- MOCK_METHOD1(set_is_navi, void(bool allow));
- MOCK_CONST_METHOD0(video_streaming_approved, bool());
- MOCK_METHOD1(set_video_streaming_approved, void(bool state));
- MOCK_CONST_METHOD0(audio_streaming_approved, bool());
- MOCK_METHOD1(set_audio_streaming_approved, void(bool state));
- MOCK_CONST_METHOD0(video_streaming_allowed, bool());
- MOCK_METHOD1(set_video_streaming_allowed, void(bool state));
- MOCK_CONST_METHOD0(audio_streaming_allowed, bool());
- MOCK_METHOD1(set_audio_streaming_allowed, void(bool state));
- MOCK_METHOD1(StartStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(StopStreaming, void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(SuspendStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(WakeUpStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_CONST_METHOD0(is_voice_communication_supported, bool());
- MOCK_METHOD1(set_voice_communication_supported,
- void(bool is_voice_communication_supported));
- MOCK_CONST_METHOD0(app_allowed, bool());
- MOCK_CONST_METHOD0(has_been_activated, bool());
- MOCK_METHOD1(set_activated, bool(bool is_active));
- MOCK_CONST_METHOD0(version, const ::application_manager::Version&());
- MOCK_METHOD1(set_hmi_application_id, void(uint32_t hmi_app_id));
- MOCK_CONST_METHOD0(hmi_app_id, uint32_t());
- MOCK_CONST_METHOD0(name, const std::string&());
- MOCK_METHOD1(set_folder_name, void(const std::string& folder_name));
- MOCK_CONST_METHOD0(folder_name, const std::string());
- MOCK_CONST_METHOD0(is_media_application, bool());
- MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType());
- MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType());
- MOCK_CONST_METHOD0(audio_streaming_state,
- const mobile_apis::AudioStreamingState::eType());
- MOCK_CONST_METHOD0(app_icon_path, const std::string&());
- MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle());
- MOCK_METHOD0(tts_speak_state, bool());
- MOCK_CONST_METHOD0(CurrentHmiState,
- ::application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(RegularHmiState,
- ::application_manager::HmiStatePtr());
- MOCK_CONST_METHOD0(PostponedHmiState,
- ::application_manager::HmiStatePtr());
- MOCK_METHOD1(set_tts_properties_in_none, void(bool active));
- MOCK_METHOD0(tts_properties_in_none, bool());
- MOCK_METHOD1(set_tts_properties_in_full, void(bool active));
- MOCK_METHOD0(tts_properties_in_full, bool());
- MOCK_METHOD1(set_version,
- void(const ::application_manager::Version& version));
- MOCK_METHOD1(set_name, void(const std::string& name));
- MOCK_METHOD1(set_is_media_application, void(bool is_media));
- MOCK_METHOD0(increment_put_file_in_none_count, void());
- MOCK_METHOD0(increment_delete_file_in_none_count, void());
- MOCK_METHOD0(increment_list_files_in_none_count, void());
- MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name));
- MOCK_METHOD1(set_app_allowed, void(const bool& allowed));
- MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device));
- MOCK_CONST_METHOD0(get_grammar_id, uint32_t());
- MOCK_METHOD1(set_grammar_id, void(uint32_t value));
- MOCK_METHOD1(
- set_protocol_version,
- void(const ::application_manager::ProtocolVersion& protocol_version));
- MOCK_CONST_METHOD0(protocol_version,
- ::application_manager::ProtocolVersion());
- MOCK_METHOD1(set_is_resuming, void(bool));
- MOCK_CONST_METHOD0(is_resuming, bool());
- MOCK_METHOD1(AddFile, bool(const ::application_manager::AppFile& file));
- MOCK_CONST_METHOD0(getAppFiles, const ::application_manager::AppFilesMap&());
- MOCK_METHOD1(UpdateFile, bool(const ::application_manager::AppFile& file));
- MOCK_METHOD1(DeleteFile, bool(const std::string& file_name));
- MOCK_METHOD1(GetFile, const ::application_manager::AppFile*(
- const std::string& file_name));
- MOCK_METHOD1(SubscribeToButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(IsSubscribedToButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(UnsubscribeFromButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(SubscribeToIVI, bool(uint32_t vehicle_info_type));
- MOCK_CONST_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type));
- MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type));
- MOCK_METHOD0(ResetDataInNone, void());
- MOCK_METHOD2(IsCommandLimitsExceeded,
- bool(mobile_apis::FunctionID::eType cmd_id,
- ::application_manager::TLimitSource source));
- MOCK_METHOD0(usage_report, ::application_manager::UsageStatistics&());
- MOCK_METHOD1(SetRegularState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(SetPostponedState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(AddHMIState, void(::application_manager::HmiStatePtr state));
- MOCK_METHOD1(RemoveHMIState,
- void(::application_manager::HmiState::StateID state_id));
- MOCK_METHOD2(SubscribeToSoftButtons,
- void(int32_t cmd_id,
- const ::application_manager::SoftButtonID& softbuttons_id));
- MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id));
- MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id));
- MOCK_CONST_METHOD0(IsAudioApplication, bool());
- MOCK_METHOD0(LoadPersistentFiles, void());
- // InitialApplicationData methods
- MOCK_CONST_METHOD0(app_types, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_synonyms, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(policy_app_id, std::string());
- MOCK_CONST_METHOD0(tts_name, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(ngn_media_screen_name,
- const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(language, const mobile_apis::Language::eType&());
- MOCK_CONST_METHOD0(ui_language, const mobile_apis::Language::eType&());
- MOCK_METHOD1(set_app_types,
- void(const smart_objects::SmartObject& app_types));
- MOCK_METHOD1(set_vr_synonyms,
- void(const smart_objects::SmartObject& vr_synonyms));
- MOCK_METHOD1(set_policy_app_id, void(const std::string& policy_app_id));
- MOCK_METHOD1(set_tts_name, void(const smart_objects::SmartObject& tts_name));
- MOCK_METHOD1(set_ngn_media_screen_name,
- void(const smart_objects::SmartObject& ngn_name));
- MOCK_METHOD1(set_language,
- void(const mobile_apis::Language::eType& language));
- MOCK_METHOD1(set_ui_language,
- void(const mobile_apis::Language::eType& ui_language));
- // DynamicApplicationData methods
- MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_help_title, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_help, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(tbt_state, const mobile_apis::TBTState::eType&());
- MOCK_CONST_METHOD0(show_command, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(
- SubscribedButtons,
- DataAccessor< ::application_manager::ButtonSubscriptions >());
- MOCK_CONST_METHOD0(
- SubscribedIVI,
- DataAccessor< ::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*());
- MOCK_METHOD1(load_global_properties,
- void(const smart_objects::SmartObject& so));
- MOCK_METHOD1(set_help_prompt,
- void(const smart_objects::SmartObject& help_prompt));
- MOCK_METHOD1(set_timeout_prompt,
- void(const smart_objects::SmartObject& timeout_prompt));
- MOCK_METHOD1(set_vr_help_title,
- void(const smart_objects::SmartObject& vr_help_title));
- MOCK_METHOD0(reset_vr_help_title, void());
- MOCK_METHOD1(set_vr_help, void(const smart_objects::SmartObject& vr_help));
- MOCK_METHOD0(reset_vr_help, void());
- MOCK_METHOD1(set_tbt_state,
- void(const mobile_apis::TBTState::eType& tbt_state));
- MOCK_METHOD1(set_show_command,
- void(const smart_objects::SmartObject& show_command));
- MOCK_METHOD1(set_tbt_show_command,
- void(const smart_objects::SmartObject& tbt_show));
- MOCK_METHOD1(set_keyboard_props,
- void(const smart_objects::SmartObject& keyboard_props));
- MOCK_METHOD1(set_menu_title,
- void(const smart_objects::SmartObject& menu_title));
- MOCK_METHOD1(set_menu_icon,
- void(const smart_objects::SmartObject& menu_icon));
- MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t());
- MOCK_METHOD1(set_audio_stream_retry_number,
- void(const uint32_t& audio_stream_retry_number));
- MOCK_CONST_METHOD0(video_stream_retry_number, uint32_t());
- MOCK_METHOD1(set_video_stream_retry_number,
- void(const uint32_t& video_stream_retry_number));
- MOCK_METHOD2(AddCommand, void(uint32_t cmd_id,
- const smart_objects::SmartObject& command));
- MOCK_METHOD1(RemoveCommand, void(uint32_t cmd_id));
- MOCK_METHOD1(FindCommand, smart_objects::SmartObject*(uint32_t cmd_id));
- MOCK_METHOD2(AddSubMenu,
- void(uint32_t menu_id, const smart_objects::SmartObject& menu));
- MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id));
- MOCK_CONST_METHOD1(FindSubMenu,
- smart_objects::SmartObject*(uint32_t menu_id));
- MOCK_METHOD1(IsSubMenuNameAlreadyExist, bool(const std::string& name));
- MOCK_METHOD2(AddChoiceSet,
- void(uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set));
- MOCK_METHOD1(RemoveChoiceSet, void(uint32_t choice_set_id));
- MOCK_METHOD1(FindChoiceSet,
- smart_objects::SmartObject*(uint32_t choice_set_id));
- MOCK_METHOD3(AddPerformInteractionChoiceSet,
- void(uint32_t correlation_id, uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set));
- MOCK_METHOD1(DeletePerformInteractionChoiceSet,
- void(uint32_t correlation_id));
- MOCK_CONST_METHOD0(
- performinteraction_choice_set_map,
- DataAccessor< ::application_manager::PerformChoiceSetMap >());
- MOCK_CONST_METHOD0(commands_map,
- DataAccessor< ::application_manager::CommandsMap >());
- MOCK_CONST_METHOD0(sub_menu_map,
- DataAccessor< ::application_manager::SubMenuMap >());
- MOCK_CONST_METHOD0(choice_set_map,
- DataAccessor< ::application_manager::ChoiceSetMap >());
- MOCK_METHOD1(set_perform_interaction_active, void(uint32_t active));
- MOCK_CONST_METHOD0(is_perform_interaction_active, uint32_t());
- MOCK_METHOD1(set_perform_interaction_mode, void(int32_t mode));
- MOCK_CONST_METHOD0(perform_interaction_mode, int32_t());
- MOCK_METHOD1(set_reset_global_properties_active, void(bool active));
- MOCK_CONST_METHOD0(is_reset_global_properties_active, bool());
- MOCK_CONST_METHOD0(app_id, uint32_t());
-};
-
-} // namespace resumption_test
-} // namespace components
-} // namespace test
-
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_RESUMPTION_INCLUDE_APPLICATION_MOCK_H_
diff --git a/src/components/application_manager/test/resumption/include/resumption_data_mock.h b/src/components/application_manager/test/resumption/include/resumption_data_mock.h
index 2c9285b025..e3b0a07078 100644
--- a/src/components/application_manager/test/resumption/include/resumption_data_mock.h
+++ b/src/components/application_manager/test/resumption/include/resumption_data_mock.h
@@ -77,6 +77,8 @@ class ResumptionDataMock : public ::resumption::ResumptionData {
const std::string& device_id,
mobile_apis::HMILevel::eType hmi_level));
MOCK_METHOD0(Init, bool());
+ MOCK_METHOD2(DropAppDataResumption, bool(const std::string& device_id,
+ const std::string& app_id));
};
} // namespace resumption_test
diff --git a/src/components/application_manager/test/resumption/include/resumption_data_test.h b/src/components/application_manager/test/resumption/include/resumption_data_test.h
index 55767225b5..290bac41c5 100644
--- a/src/components/application_manager/test/resumption/include/resumption_data_test.h
+++ b/src/components/application_manager/test/resumption/include/resumption_data_test.h
@@ -57,7 +57,7 @@ class ResumptionDataTest : public ::testing::Test {
// Set data for resumption
virtual void PrepareData();
- utils::SharedPtr<NiceMock<ApplicationMock>> app_mock;
+ utils::SharedPtr<NiceMock<MockApplication>> app_mock;
HMILevel::eType hmi_level_;
size_t app_id_;
diff --git a/src/components/application_manager/test/resumption/resume_ctrl_test.cc b/src/components/application_manager/test/resumption/resume_ctrl_test.cc
deleted file mode 100644
index bfd41b0f08..0000000000
--- a/src/components/application_manager/test/resumption/resume_ctrl_test.cc
+++ /dev/null
@@ -1,937 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "application_manager/resumption/resume_ctrl.h"
-#include <string>
-#include <algorithm>
-#include "gtest/gtest.h"
-#include "application_manager/usage_statistics.h"
-#include "include/application_mock.h"
-#include "include/resumption_data_mock.h"
-#include "interfaces/MOBILE_API.h"
-#include "application_manager/application_manager_impl.h"
-#include "application_manager/application.h"
-#include "config_profile/profile.h"
-#include "utils/data_accessor.h"
-#include "application_manager/test/mock_message_helper.h"
-
-namespace test {
-namespace components {
-namespace resumption_test {
-
-using ::testing::_;
-using ::testing::Return;
-using ::testing::DoAll;
-using ::testing::SetArgReferee;
-using ::testing::Mock;
-using ::testing::NiceMock;
-using ::testing::AtLeast;
-
-using namespace resumption;
-using namespace mobile_apis::HMILevel;
-
-class ResumeCtrlTest : public ::testing::Test {
- public:
- virtual void SetUp() OVERRIDE {
- app_mngr = application_manager::ApplicationManagerImpl::instance();
- // Singleton should not be destroyed
- Mock::AllowLeak(app_mngr);
- mock_storage = new NiceMock<ResumptionDataMock>();
- app_mock = new NiceMock<ApplicationMock>();
- res_ctrl.set_resumption_storage(mock_storage);
- test_audio_state = mobile_apis::AudioStreamingState::NOT_AUDIBLE;
- test_app_id = 10;
- default_testType = eType::HMI_NONE;
- test_dev_id = 5;
- test_policy_app_id = "test_policy_app_id";
- test_grammar_id = 10;
- hash = "saved_hash";
- }
-
- protected:
- application_manager::ApplicationManagerImpl* app_mngr;
- ResumeCtrl res_ctrl;
- NiceMock<ResumptionDataMock>* mock_storage;
- NiceMock<ApplicationMock>* app_mock;
- mobile_apis::AudioStreamingState::eType test_audio_state;
- // app_mock.app_id() will return this value
- uint32_t test_app_id;
- std::string test_policy_app_id;
- mobile_apis::HMILevel::eType default_testType;
-
- // app_mock.Device() will return this value
- uint32_t test_dev_id;
- uint32_t test_grammar_id;
- std::string hash;
-};
-
-/**
- * @brief Group of tests which check starting resumption with different data
- */
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithGrammarId) {
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*app_mock, UpdateHash());
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-MATCHER_P4(CheckAppFile, is_persistent, is_download, file_name, file_type, "") {
- application_manager::AppFile app_file = arg;
- return app_file.is_persistent == is_persistent &&
- app_file.is_download_complete == is_download &&
- app_file.file_name == file_name && app_file.file_type == file_type;
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_WithoutGrammarId) {
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*app_mock, UpdateHash());
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id)).Times(0);
-
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_FALSE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithFiles) {
- smart_objects::SmartObject test_application_files;
- smart_objects::SmartObject test_file;
- const uint32_t count_of_files = 8;
-
- int file_types[count_of_files];
- std::string file_names[count_of_files];
- const size_t max_size = 12;
- char numb[max_size];
- for (uint32_t i = 0; i < count_of_files; i++) {
- file_types[i] = i;
- std::snprintf(numb, max_size, "%d", i);
- file_names[i] = "test_file" + std::string(numb);
- }
-
- // Should not been added
- test_file[application_manager::strings::persistent_file] = false;
- test_application_files[0] = test_file;
-
- for (uint32_t i = 0; i < count_of_files; ++i) {
- test_file[application_manager::strings::persistent_file] = true;
- test_file[application_manager::strings::is_download_complete] = true;
- test_file[application_manager::strings::file_type] = file_types[i];
- test_file[application_manager::strings::sync_file_name] = file_names[i];
- test_application_files[i + 1] = test_file;
- }
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_files] =
- test_application_files;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*app_mock, UpdateHash());
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
- for (uint32_t i = 0; i < count_of_files; ++i) {
- EXPECT_CALL(*app_mock,
- AddFile(CheckAppFile(
- true, true, file_names[i],
- static_cast<mobile_apis::FileType::eType>(file_types[i]))));
- }
-
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithSubmenues) {
- smart_objects::SmartObject test_application_submenues;
- smart_objects::SmartObject test_submenu;
-
- const uint32_t count_of_submenues = 20;
- for (uint32_t i = 0; i < count_of_submenues; ++i) {
- test_submenu[application_manager::strings::menu_id] = i;
- test_application_submenues[i] = test_submenu;
- }
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_submenus] =
- test_application_submenues;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- for (uint32_t i = 0; i < count_of_submenues; ++i) {
- EXPECT_CALL(*app_mock, AddSubMenu(i, test_application_submenues[i]));
- }
- smart_objects::SmartObjectList requests;
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateAddSubMenuRequestToHMI(_)).WillRepeatedly(Return(requests));
-
- EXPECT_CALL(*app_mock, UpdateHash());
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithCommands) {
- smart_objects::SmartObject test_application_commands;
- smart_objects::SmartObject test_commands;
- const uint32_t count_of_commands = 20;
-
- for (uint32_t i = 0; i < count_of_commands; ++i) {
- test_commands[application_manager::strings::cmd_id] = i;
- test_application_commands[i] = test_commands;
- }
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_commands] =
- test_application_commands;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*app_mock, UpdateHash());
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- for (uint32_t i = 0; i < count_of_commands; ++i) {
- EXPECT_CALL(*app_mock, AddCommand(i, test_application_commands[i]));
- }
-
- smart_objects::SmartObjectList requests;
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateAddCommandRequestToHMI(_)).WillRepeatedly(Return(requests));
-
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithChoiceSet) {
- smart_objects::SmartObject application_choice_sets;
- smart_objects::SmartObject app_choice_set;
-
- const uint32_t count_of_choice = 10;
- smart_objects::SmartObject choice_vector;
- smart_objects::SmartObject choice;
- const size_t max_size = 12;
- char numb[max_size];
- for (uint32_t i = 0; i < count_of_choice; ++i) {
- std::snprintf(numb, max_size, "%d", i);
- choice[application_manager::strings::vr_commands] =
- "VrCommand" + std::string(numb);
- choice[application_manager::strings::choice_id] = i;
- choice_vector[i] = choice;
- }
- const uint32_t count_of_choice_sets = 5;
- for (uint32_t i = 0; i < count_of_choice_sets; ++i) {
- app_choice_set[application_manager::strings::interaction_choice_set_id] = i;
- app_choice_set[application_manager::strings::choice_set] = choice_vector;
- application_choice_sets[i] = app_choice_set;
- }
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_choice_sets] =
- application_choice_sets;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_CALL(*app_mock, UpdateHash());
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- for (uint32_t i = 0; i < count_of_choice_sets; ++i) {
- EXPECT_CALL(*app_mock, AddChoiceSet(i, application_choice_sets[i]));
- }
-
- smart_objects::SmartObjectList requests;
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- CreateAddVRCommandRequestFromChoiceToHMI(_))
- .WillRepeatedly(Return(requests));
-
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithGlobalProperties) {
- // Prepare Data
- smart_objects::SmartObject test_global_properties;
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_global_properties] =
- test_global_properties;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- SendGlobalPropertiesToHMI(_));
-
- EXPECT_CALL(*app_mock, load_global_properties(test_global_properties));
-
- EXPECT_CALL(*app_mock, UpdateHash());
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscribeOnButtons) {
- // Prepare Data
- smart_objects::SmartObject test_subscriptions;
- smart_objects::SmartObject app_buttons;
-
- uint32_t count_of_buttons = 17;
- for (uint32_t i = 0; i < count_of_buttons; ++i) {
- app_buttons[i] = i;
- }
-
- test_subscriptions[application_manager::strings::application_buttons] =
- app_buttons;
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_subscribtions] =
- test_subscriptions;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- for (uint32_t i = 0; i < count_of_buttons; ++i) {
- EXPECT_CALL(*app_mock, SubscribeToButton(
- static_cast<mobile_apis::ButtonName::eType>(i)));
- }
- EXPECT_CALL(*app_mock, UpdateHash());
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- SendAllOnButtonSubscriptionNotificationsForApp(_)).Times(2);
-
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumption_AppWithSubscriptionToIVI) {
- // Prepare Data
- smart_objects::SmartObject test_subscriptions;
- smart_objects::SmartObject app_vi;
-
- int vtype = application_manager::VehicleDataType::GPS;
- uint i = 0;
- for (; vtype < application_manager::VehicleDataType::STEERINGWHEEL;
- ++i, ++vtype) {
- app_vi[i] = vtype;
- }
-
- test_subscriptions[application_manager::strings::application_vehicle_info] =
- app_vi;
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::application_subscribtions] =
- test_subscriptions;
-
- // Check RestoreApplicationData
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .Times(3)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mock, set_grammar_id(test_grammar_id));
-
- for (size_t i = 0; i < app_vi.length(); ++i) {
- EXPECT_CALL(
- *app_mock,
- SubscribeToIVI(static_cast<application_manager::VehicleDataType>(i)));
- }
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- smart_objects::SmartObjectList requests;
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- GetIVISubscriptionRequests(_)).WillRepeatedly(Return(requests));
-
- EXPECT_CALL(*app_mock, UpdateHash());
- bool res = res_ctrl.StartResumption(app_mock, hash);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartResumptionOnlyHMILevel) {
- smart_objects::SmartObject saved_app;
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
-
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- EXPECT_CALL(*mock_storage, GetSavedApplication(test_policy_app_id, _, _))
- .WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .Times(3)
- .WillRepeatedly(Return(default_testType));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr, SetState(test_app_id, default_testType,
- test_audio_state)).Times(2);
- bool res = res_ctrl.StartResumptionOnlyHMILevel(app_mock);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInFull) {
- mobile_apis::HMILevel::eType restored_testType = eType::HMI_FULL;
- uint32_t ign_off_count = 0;
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::ign_off_count] = ign_off_count;
- saved_app[application_manager::strings::hmi_level] = restored_testType;
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(true));
-
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr,
- SetHmiState(test_app_id, restored_testType)).Times(AtLeast(1));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*mock_storage, GetSavedApplication(test_policy_app_id, _, _))
- .Times(2)
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
-
- EXPECT_CALL(*mock_storage, RemoveApplicationFromSaved(_, _))
- .WillOnce(Return(true));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("12345"))
- .WillRepeatedly(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(true));
-
- res_ctrl.StartAppHmiStateResumption(app_mock);
-}
-
-TEST_F(ResumeCtrlTest, StartAppHmiStateResumption_AppInBackground) {
- uint32_t ign_off_count = 0;
- smart_objects::SmartObject saved_app;
-
- mobile_apis::HMILevel::eType restored_testType = eType::HMI_BACKGROUND;
- saved_app[application_manager::strings::ign_off_count] = ign_off_count;
- saved_app[application_manager::strings::hmi_level] = restored_testType;
-
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*mock_storage, GetSavedApplication(test_policy_app_id, _, _))
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("12345"))
- .WillOnce(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(true));
-
- res_ctrl.StartAppHmiStateResumption(app_mock);
-}
-
-/**
- * @brief Group of tests which check restoring resumption with different data
- */
-
-TEST_F(ResumeCtrlTest, RestoreAppHMIState_RestoreHMILevelFull) {
- mobile_apis::HMILevel::eType restored_testType = eType::HMI_FULL;
-
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::hash_id] = hash;
- saved_app[application_manager::strings::grammar_id] = test_grammar_id;
- saved_app[application_manager::strings::hmi_level] = restored_testType;
-
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice(""))
- .WillOnce(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillRepeatedly(Return(false));
-
- utils::SharedPtr<application_manager::Application> null_app;
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(null_app));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, restored_testType, test_audio_state));
-
- bool res = res_ctrl.RestoreAppHMIState(app_mock);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, SetupDefaultHMILevel) {
- smart_objects::SmartObject saved_app;
-
- saved_app[application_manager::strings::hmi_level] = default_testType;
-
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillRepeatedly(Return(default_testType));
-
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(true));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
- EXPECT_CALL(*app_mngr,
- SetHmiState(test_app_id, default_testType)).Times(AtLeast(1));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr, SetState(test_app_id, default_testType,
- test_audio_state)).Times(2);
-
- res_ctrl.SetupDefaultHMILevel(app_mock);
-}
-
-/**
- * @brief group of tests which check correct SetAppHMIState
-*/
-
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMINone_NotMedia_WithoutCheckPolicy) {
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(true));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr, SetState(test_app_id, default_testType,
- test_audio_state)).Times(2);
-
- bool res = res_ctrl.SetAppHMIState(app_mock, default_testType, false);
- EXPECT_TRUE(res);
-}
-
-// TODO(VVeremjova) APPLINK-16718
-TEST_F(ResumeCtrlTest,
- DISABLED_SetAppHMIState_HMILimited_NotMedia_WithoutCheckPolicy) {
- mobile_apis::HMILevel::eType testType = eType::HMI_LIMITED;
-
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice(""))
- .WillRepeatedly(Return(policy::DeviceConsent::kDeviceAllowed));
- EXPECT_CALL(*app_mngr, SetState(test_app_id, testType, test_audio_state));
-
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, false);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_NotMedia_WithoutCheckPolicy) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
- ::testing::InSequence seq;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(false));
-
- // Only mocked application is exist
- utils::SharedPtr<application_manager::Application> null_app;
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(null_app));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
-
- // GetDefaultHmiLevel should not be called
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_)).Times(0);
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- EXPECT_CALL(*app_mngr, SetState(test_app_id, testType, test_audio_state));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, false);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest,
- SetAppHMIState_HMIFull_NotMedia_WithoutPolicy_AnotherFullActiveExists) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
- ::testing::InSequence seq;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(false));
-
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- // Expect set default HMI state
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, false);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest,
- SetAppHMIState_HMIFull_MediaAudio_WithoutPolicy_AnotherActiveAppExists) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
-
- // In case application is media, audio state will be AUDIBLE
- test_audio_state = mobile_apis::AudioStreamingState::AUDIBLE;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- // Only our app in FULL
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(false));
-
- // Active app exists
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
-
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_)).Times(0);
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(true));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- mobile_apis::HMILevel::eType expected_testType = eType::HMI_LIMITED;
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, expected_testType, test_audio_state));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, false);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_Media_WithoutPolicy_FullExists) {
- default_testType = eType::HMI_FULL;
-
- // In case application is media, audio state will be AUDIBLE
- test_audio_state = mobile_apis::AudioStreamingState::AUDIBLE;
- ::testing::InSequence seq;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(true));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(true));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("")).Times(0);
- bool res = res_ctrl.SetAppHMIState(app_mock, default_testType, false);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_NotMedia_WithPolicy_DevAllowed) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
-
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("12345"))
- .WillOnce(Return(policy::kDeviceAllowed));
-
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(true));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
-
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, true);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_Media_WithCheckPolicy) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
-
- // In case application is media, audio state will be AUDIBLE
- test_audio_state = mobile_apis::AudioStreamingState::AUDIBLE;
- ::testing::InSequence seq;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- // App is allowed
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("12345"))
- .WillOnce(Return(policy::kDeviceAllowed));
- EXPECT_CALL(*app_mngr, IsAppTypeExistsInFullOrLimited(_))
- .WillOnce(Return(false));
- EXPECT_CALL(*app_mngr, active_application()).WillOnce(Return(app_mock));
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_)).Times(0);
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(true));
-
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- mobile_apis::HMILevel::eType expected_testType = eType::HMI_LIMITED;
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, expected_testType, test_audio_state));
-
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, true);
- EXPECT_TRUE(res);
-}
-
-TEST_F(ResumeCtrlTest, SetAppHMIState_HMIFull_Media_WithPolicy_DevDisallowed) {
- mobile_apis::HMILevel::eType testType = eType::HMI_FULL;
-
- ::testing::InSequence seq;
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- EXPECT_CALL(*app_mngr, GetUserConsentForDevice("12345"))
- .WillOnce(Return(policy::kDeviceDisallowed));
-
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(true));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
-
- bool res = res_ctrl.SetAppHMIState(app_mock, testType, true);
- EXPECT_FALSE(res);
-}
-
-TEST_F(ResumeCtrlTest, SaveApplication) {
- utils::SharedPtr<application_manager::Application> app_sh_mock =
- new ApplicationMock();
-
- EXPECT_CALL(*mock_storage, SaveApplication(app_sh_mock));
- res_ctrl.SaveApplication(app_sh_mock);
-}
-
-TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionHasStarted) {
- ::profile::Profile::instance()->config_file_name("smartDeviceLink_test.ini");
-
- smart_objects::SmartObject saved_app;
- EXPECT_CALL(*app_mngr, GetDefaultHmiLevel(_))
- .WillOnce(Return(default_testType));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- ON_CALL(*app_mock, is_media_application()).WillByDefault(Return(false));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
- EXPECT_CALL(*app_mngr,
- SetState(test_app_id, default_testType, test_audio_state));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- EXPECT_CALL(*mock_storage, GetSavedApplication(test_policy_app_id, _, _))
- .WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- ON_CALL(*app_mock, app_id()).WillByDefault(Return(test_app_id));
-
- bool res = res_ctrl.StartResumptionOnlyHMILevel(app_mock);
- EXPECT_TRUE(res);
-
- utils::SharedPtr<ApplicationMock> app_sh_mock = new ApplicationMock();
-
- EXPECT_CALL(*app_sh_mock, app_id()).WillOnce(Return(test_app_id));
- res_ctrl.OnAppActivated(app_sh_mock);
-}
-
-TEST_F(ResumeCtrlTest, OnAppActivated_ResumptionNotActive) {
- utils::SharedPtr<ApplicationMock> app_sh_mock = new ApplicationMock();
- EXPECT_CALL(*app_sh_mock, app_id()).Times(0);
- res_ctrl.OnAppActivated(app_sh_mock);
-}
-
-TEST_F(ResumeCtrlTest, IsHMIApplicationIdExist) {
- uint32_t hmi_app_id = 10;
-
- EXPECT_CALL(*mock_storage, IsHMIApplicationIdExist(hmi_app_id))
- .WillOnce(Return(true));
- EXPECT_TRUE(res_ctrl.IsHMIApplicationIdExist(hmi_app_id));
-}
-
-TEST_F(ResumeCtrlTest, GetHMIApplicationID) {
- uint32_t hmi_app_id = 10;
- std::string device_id = "test_device_id";
-
- EXPECT_CALL(*mock_storage, GetHMIApplicationID(test_policy_app_id, device_id))
- .WillOnce(Return(hmi_app_id));
- EXPECT_EQ(hmi_app_id,
- res_ctrl.GetHMIApplicationID(test_policy_app_id, device_id));
-}
-
-TEST_F(ResumeCtrlTest, IsApplicationSaved) {
- std::string policy_app_id = "policy_app_id";
- std::string device_id = "device_id";
-
- EXPECT_CALL(*mock_storage, IsApplicationSaved(policy_app_id, device_id))
- .WillOnce(Return(true));
- EXPECT_TRUE(res_ctrl.IsApplicationSaved(policy_app_id, device_id));
-}
-
-TEST_F(ResumeCtrlTest, CheckPersistenceFiles_WithoutCommandAndChoiceSets) {
- uint32_t ign_off_count = 0;
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::ign_off_count] = ign_off_count;
- saved_app[application_manager::strings::hmi_level] = HMI_FULL;
-
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_TRUE(res_ctrl.CheckPersistenceFilesForResumption(app_mock));
-}
-
-TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithCommands) {
- smart_objects::SmartObject test_application_commands;
- uint32_t ign_off_count = 0;
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::ign_off_count] = ign_off_count;
- saved_app[application_manager::strings::hmi_level] = HMI_FULL;
- saved_app[application_manager::strings::application_commands] =
- test_application_commands;
-
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_CALL(*application_manager::MockMessageHelper::message_helper_mock(),
- VerifyImageFiles(_, _))
- .WillRepeatedly(Return(mobile_apis::Result::SUCCESS));
-
- EXPECT_TRUE(res_ctrl.CheckPersistenceFilesForResumption(app_mock));
-}
-
-TEST_F(ResumeCtrlTest, CheckPersistenceFilesForResumption_WithChoiceSet) {
- smart_objects::SmartObject test_choice_sets;
- uint32_t ign_off_count = 0;
- smart_objects::SmartObject saved_app;
- saved_app[application_manager::strings::ign_off_count] = ign_off_count;
- saved_app[application_manager::strings::hmi_level] = HMI_FULL;
- saved_app[application_manager::strings::application_choice_sets] =
- test_choice_sets;
-
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
-
- EXPECT_CALL(*mock_storage, GetSavedApplication(_, _, _))
- .WillOnce(DoAll(SetArgReferee<2>(saved_app), Return(true)));
-
- EXPECT_TRUE(res_ctrl.CheckPersistenceFilesForResumption(app_mock));
-}
-
-// TODO (VVeremjova) APPLINK-16718
-TEST_F(ResumeCtrlTest, DISABLED_OnSuspend) {
- EXPECT_CALL(*mock_storage, OnSuspend());
- res_ctrl.OnSuspend();
-}
-
-TEST_F(ResumeCtrlTest, OnAwake) {
- EXPECT_CALL(*mock_storage, OnAwake());
- res_ctrl.OnAwake();
-}
-
-TEST_F(ResumeCtrlTest, RemoveApplicationFromSaved) {
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- EXPECT_CALL(*mock_storage, RemoveApplicationFromSaved(_, _))
- .WillOnce(Return(true));
- EXPECT_TRUE(res_ctrl.RemoveApplicationFromSaved(app_mock));
-}
-
-TEST_F(ResumeCtrlTest, CheckApplicationHash) {
- smart_objects::SmartObject saved_app;
-
- std::string test_hash = "saved_hash";
- saved_app[application_manager::strings::hash_id] = test_hash;
-
- ON_CALL(*app_mock, device()).WillByDefault(Return(test_dev_id));
- ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(test_policy_app_id));
- EXPECT_CALL(*mock_storage, GetSavedApplication(test_policy_app_id, _, _))
- .WillRepeatedly(DoAll(SetArgReferee<2>(saved_app), Return(true)));
- EXPECT_TRUE(res_ctrl.CheckApplicationHash(app_mock, test_hash));
-}
-
-} // namespace resumption_test
-} // namespace components
-} // namespace test
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 a6ced14349..247f269fff 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
@@ -33,15 +33,17 @@
#include <string>
#include <algorithm>
#include "gtest/gtest.h"
-#include "include/application_mock.h"
+#include "application_manager/mock_application.h"
#include "interfaces/MOBILE_API.h"
#include "sql_database.h"
#include "sql_query.h"
+#include "utils/make_shared.h"
#include "application_manager/application_manager_impl.h"
#include "config_profile/profile.h"
#include "utils/file_system.h"
-#include "include/resumption_data_test.h"
+#include "application_manager/resumption_data_test.h"
+#include "application_manager/test_resumption_data_db.h"
#include "application_manager/resumption/resumption_sql_queries.h"
#include "application_manager/resumption/resumption_data_db.h"
@@ -51,6 +53,7 @@ namespace components {
namespace resumption_test {
using ::testing::NiceMock;
+using application_manager_test::MockApplication;
namespace am = application_manager;
using namespace file_system;
@@ -58,17 +61,10 @@ using namespace file_system;
using namespace resumption;
using namespace mobile_apis;
-class TestResumptionDataDB : public ResumptionDataDB {
- public:
- utils::dbms::SQLDatabase* get_db_handle() { return db(); }
-
- TestResumptionDataDB(DbStorage db_storage) : ResumptionDataDB(db_storage) {}
-};
-
class ResumptionDataDBTest : public ResumptionDataTest {
protected:
virtual void SetUp() {
- app_mock = new NiceMock<ApplicationMock>();
+ app_mock = utils::MakeShared<NiceMock<MockApplication> >();
policy_app_id_ = "test_policy_app_id";
app_id_ = 10;
is_audio_ = true;
@@ -78,6 +74,7 @@ class ResumptionDataDBTest : public ResumptionDataTest {
ign_off_count_ = 0;
grammar_id_ = 16;
}
+
virtual void TearDown() {
utils::dbms::SQLQuery query(test_db());
EXPECT_TRUE(query.Prepare(remove_all_tables));
@@ -116,23 +113,29 @@ class ResumptionDataDBTest : public ResumptionDataTest {
delete res_db_;
}
- utils::dbms::SQLDatabase* test_db() { return test_db_; }
- std::string path() { return path_; }
+ utils::dbms::SQLDatabase* test_db() const {
+ return test_db_;
+ }
+
+ std::string path() const {
+ return path_;
+ }
void SetZeroIgnOffTime() {
utils::dbms::SQLQuery query(test_db());
- EXPECT_TRUE(query.Prepare(KUpdateLastIgnOffTime));
+ EXPECT_TRUE(query.Prepare(kUpdateLastIgnOffTime));
query.Bind(0, 0);
EXPECT_TRUE(query.Exec());
}
static TestResumptionDataDB* res_db_;
- TestResumptionDataDB* res_db() { return res_db_; }
+ TestResumptionDataDB* res_db() {
+ return res_db_;
+ }
// Check that db includes tables with given elements
void CheckSavedDB();
-
static const bool is_in_file = false;
const std::string tables_exist =
"SELECT COUNT(*) FROM sqlite_master WHERE `type` = 'table';";
@@ -205,7 +208,7 @@ void ResumptionDataDBTest::CheckSavedDB() {
void ResumptionDataDBTest::CheckExistenceApplication() {
utils::dbms::SQLQuery query(test_db());
EXPECT_TRUE(query.Prepare(kCheckApplication));
- query.Bind(0, device_id_);
+ query.Bind(0, mac_address_);
query.Bind(1, policy_app_id_);
EXPECT_TRUE(query.Exec());
EXPECT_EQ(1, query.GetInteger(0));
@@ -225,7 +228,7 @@ void ResumptionDataDBTest::CheckAppData() {
EXPECT_EQ(ign_off_count_, query.GetUInteger(6));
- EXPECT_EQ(device_id_, query.GetString(8));
+ EXPECT_EQ(mac_address_, query.GetString(8));
EXPECT_EQ(is_audio_, query.GetBoolean(9));
}
@@ -300,6 +303,7 @@ void ResumptionDataDBTest::CheckGlobalProportiesData() {
CheckVRHelpItem(global_properties_key);
}
}
+
void ResumptionDataDBTest::CheckVRHelpItem(int64_t global_properties_key) {
utils::dbms::SQLQuery checks_vrhelp_item(test_db());
EXPECT_TRUE(checks_vrhelp_item.Prepare(kChecksVrHelpItem));
@@ -528,7 +532,7 @@ void ResumptionDataDBTest::CheckAppFilesData() {
void ResumptionDataDBTest::BindId(utils::dbms::SQLQuery& query) {
query.Bind(0, policy_app_id_);
- query.Bind(1, device_id_);
+ query.Bind(1, mac_address_);
}
TEST_F(ResumptionDataDBTest, Init) {
@@ -565,11 +569,12 @@ TEST_F(ResumptionDataDBTest, RemoveApplicationFromSaved) {
EXPECT_TRUE(res_db()->Init());
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- EXPECT_TRUE(res_db()->RemoveApplicationFromSaved(policy_app_id_, device_id_));
+ EXPECT_TRUE(
+ res_db()->RemoveApplicationFromSaved(policy_app_id_, mac_address_));
sm::SmartObject remove_app;
EXPECT_FALSE(
- res_db()->GetSavedApplication(policy_app_id_, device_id_, remove_app));
+ res_db()->GetSavedApplication(policy_app_id_, mac_address_, remove_app));
EXPECT_TRUE(remove_app.empty());
}
@@ -608,7 +613,7 @@ TEST_F(ResumptionDataDBTest, IsApplicationSaved_ApplicationSaved) {
PrepareData();
EXPECT_TRUE(res_db()->Init());
res_db()->SaveApplication(app_mock);
- ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, device_id_);
+ ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, mac_address_);
EXPECT_EQ(0, result);
}
@@ -616,8 +621,9 @@ TEST_F(ResumptionDataDBTest, IsApplicationSaved_ApplicationRemoved) {
PrepareData();
EXPECT_TRUE(res_db()->Init());
res_db()->SaveApplication(app_mock);
- EXPECT_TRUE(res_db()->RemoveApplicationFromSaved(policy_app_id_, device_id_));
- ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, device_id_);
+ EXPECT_TRUE(
+ res_db()->RemoveApplicationFromSaved(policy_app_id_, mac_address_));
+ ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, mac_address_);
EXPECT_EQ(-1, result);
}
@@ -629,7 +635,7 @@ TEST_F(ResumptionDataDBTest, GetSavedApplication) {
sm::SmartObject saved_app;
EXPECT_TRUE(
- res_db()->GetSavedApplication(policy_app_id_, device_id_, saved_app));
+ res_db()->GetSavedApplication(policy_app_id_, mac_address_, saved_app));
CheckSavedApp(saved_app);
}
@@ -651,9 +657,10 @@ TEST_F(ResumptionDataDBTest, GetDataForLoadResumeData) {
res_db()->GetDataForLoadResumeData(saved_app);
EXPECT_EQ(policy_app_id_, saved_app[0][am::strings::app_id].asString());
- EXPECT_EQ(device_id_, saved_app[0][am::strings::device_id].asString());
- EXPECT_EQ(hmi_level_, static_cast<HMILevel::eType>(
- saved_app[0][am::strings::hmi_level].asInt()));
+ EXPECT_EQ(mac_address_, saved_app[0][am::strings::device_id].asString());
+ EXPECT_EQ(hmi_level_,
+ static_cast<HMILevel::eType>(
+ saved_app[0][am::strings::hmi_level].asInt()));
EXPECT_EQ(ign_off_count_, saved_app[0][am::strings::ign_off_count].asUInt());
}
@@ -664,7 +671,8 @@ TEST_F(ResumptionDataDBTest, GetDataForLoadResumeData_AppRemove) {
EXPECT_TRUE(res_db()->Init());
res_db()->SaveApplication(app_mock);
CheckSavedDB();
- EXPECT_TRUE(res_db()->RemoveApplicationFromSaved(policy_app_id_, device_id_));
+ EXPECT_TRUE(
+ res_db()->RemoveApplicationFromSaved(policy_app_id_, mac_address_));
res_db()->GetDataForLoadResumeData(saved_app);
EXPECT_TRUE(saved_app.empty());
}
@@ -675,7 +683,7 @@ TEST_F(ResumptionDataDBTest, UpdateHmiLevel) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
HMILevel::eType new_hmi_level = HMILevel::HMI_LIMITED;
- res_db()->UpdateHmiLevel(policy_app_id_, device_id_, new_hmi_level);
+ res_db()->UpdateHmiLevel(policy_app_id_, mac_address_, new_hmi_level);
hmi_level_ = new_hmi_level;
CheckSavedDB();
}
@@ -703,7 +711,7 @@ TEST_F(ResumptionDataDBTest, GetHMIApplicationID) {
res_db()->SaveApplication(app_mock);
CheckSavedDB();
EXPECT_EQ(hmi_app_id_,
- res_db()->GetHMIApplicationID(policy_app_id_, device_id_));
+ res_db()->GetHMIApplicationID(policy_app_id_, mac_address_));
}
TEST_F(ResumptionDataDBTest, GetHMIApplicationID_AppNotSaved) {
@@ -746,7 +754,7 @@ TEST_F(ResumptionDataDBTest, OnSuspendFourTimes) {
res_db()->OnSuspend();
- ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, device_id_);
+ ssize_t result = res_db()->IsApplicationSaved(policy_app_id_, mac_address_);
EXPECT_EQ(-1, result);
}
@@ -804,7 +812,7 @@ TEST_F(ResumptionDataDBTest, GetHashId) {
res_db()->SaveApplication(app_mock);
std::string test_hash;
- EXPECT_TRUE(res_db()->GetHashId(policy_app_id_, device_id_, test_hash));
+ EXPECT_TRUE(res_db()->GetHashId(policy_app_id_, mac_address_, test_hash));
EXPECT_EQ(hash_, test_hash);
}
@@ -832,6 +840,39 @@ TEST_F(ResumptionDataDBTest, GetIgnOffTime_AfterSuspendAndAwake) {
EXPECT_LE(after_suspend, after_awake);
}
+TEST_F(ResumptionDataDBTest, DropAppResumptionData) {
+ PrepareData();
+ EXPECT_TRUE(res_db()->Init());
+ SetZeroIgnOffTime();
+
+ res_db()->SaveApplication(app_mock);
+
+ EXPECT_TRUE(res_db()->DropAppDataResumption(mac_address_, policy_app_id_));
+
+ am::smart_objects::SmartObject app;
+ EXPECT_TRUE(res_db()->GetSavedApplication(policy_app_id_, mac_address_, app));
+
+ EXPECT_TRUE(app.keyExists(am::strings::application_commands) &&
+ app[am::strings::application_commands].empty());
+
+ EXPECT_TRUE(app.keyExists(am::strings::application_submenus) &&
+ app[am::strings::application_submenus].empty());
+
+ EXPECT_TRUE(app.keyExists(am::strings::application_choice_sets) &&
+ app[am::strings::application_choice_sets].empty());
+
+ EXPECT_TRUE(app.keyExists(am::strings::application_global_properties) &&
+ app[am::strings::application_global_properties].empty());
+
+ EXPECT_TRUE(app.keyExists(am::strings::application_subscribtions) &&
+ app[am::strings::application_subscribtions].empty());
+
+ EXPECT_TRUE(app.keyExists(am::strings::application_files) &&
+ app[am::strings::application_files].empty());
+
+ EXPECT_FALSE(app.keyExists(am::strings::grammar_id));
+}
+
} // namespace resumption_test
} // namespace components
} // namespace test
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
deleted file mode 100644
index 24a16596eb..0000000000
--- a/src/components/application_manager/test/resumption/resumption_data_json_test.cc
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <string>
-#include <algorithm>
-#include "gtest/gtest.h"
-
-#include "application_manager/usage_statistics.h"
-#include "include/application_mock.h"
-#include "include/resumption_data_mock.h"
-#include "interfaces/MOBILE_API.h"
-#include "resumption/last_state.h"
-
-#include "include/resumption_data_test.h"
-#include "formatters/CFormatterJsonBase.hpp"
-#include "config_profile/profile.h"
-#include "utils/file_system.h"
-
-#include "application_manager/resumption/resumption_data_json.h"
-namespace test {
-namespace components {
-namespace resumption_test {
-
-using ::testing::_;
-using ::testing::Return;
-using ::testing::NiceMock;
-
-namespace am = application_manager;
-using namespace Json;
-using namespace file_system;
-
-using namespace resumption;
-using namespace mobile_apis;
-namespace Formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
-
-class ResumptionDataJsonTest : public ResumptionDataTest {
- protected:
- virtual void SetUp() {
- app_mock = new NiceMock<ApplicationMock>();
-
- policy_app_id_ = "test_policy_app_id";
- app_id_ = 10;
- is_audio_ = true;
- grammar_id_ = 20;
- hash_ = "saved_hash";
- hmi_level_ = HMILevel::eType::HMI_FULL;
- hmi_app_id_ = 8;
- ign_off_count_ = 0;
- }
-
- void CheckSavedJson() {
- Value& dictionary = LastState::instance()->dictionary;
- ASSERT_TRUE(dictionary[am::strings::resumption].isObject());
- ASSERT_TRUE(
- dictionary[am::strings::resumption][am::strings::resume_app_list]
- .isArray());
- Value& resume_app_list =
- dictionary[am::strings::resumption][am::strings::resume_app_list];
- sm::SmartObject res_app_list;
- for (uint32_t i = 0; i < resume_app_list.size(); i++) {
- Formatters::CFormatterJsonBase::jsonValueToObj(resume_app_list[i],
- res_app_list);
- CheckSavedApp(res_app_list);
- }
- }
-
- void SetZeroIgnOff() {
- Value& dictionary = LastState::instance()->dictionary;
- Value& res = dictionary[am::strings::resumption];
- res[am::strings::last_ign_off_time] = 0;
- LastState::instance()->SaveToFileSystem();
- }
-};
-
-TEST_F(ResumptionDataJsonTest, SaveApplication) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-}
-
-TEST_F(ResumptionDataJsonTest, SavedApplicationTwice) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-}
-
-TEST_F(ResumptionDataJsonTest, SavedApplicationTwice_UpdateApp) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- (*vr_help_)[0][am::strings::position] = 2;
-
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-}
-
-TEST_F(ResumptionDataJsonTest, RemoveApplicationFromSaved) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- EXPECT_TRUE(res_json.RemoveApplicationFromSaved(policy_app_id_, device_id_));
-
- // Check that application was deleted
- smart_objects::SmartObject remove_app;
- EXPECT_FALSE(
- res_json.GetSavedApplication(policy_app_id_, device_id_, remove_app));
- EXPECT_TRUE(remove_app.empty());
-}
-
-TEST_F(ResumptionDataJsonTest, RemoveApplicationFromSaved_AppNotSaved) {
- ResumptionDataJson res_json;
- EXPECT_FALSE(res_json.RemoveApplicationFromSaved(policy_app_id_, "54321"));
-}
-
-TEST_F(ResumptionDataJsonTest, IsApplicationSaved_ApplicationSaved) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- ssize_t result = res_json.IsApplicationSaved(policy_app_id_, device_id_);
- EXPECT_EQ(0, result);
-}
-
-TEST_F(ResumptionDataJsonTest, IsApplicationSaved_ApplicationRemoved) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- EXPECT_TRUE(res_json.RemoveApplicationFromSaved(policy_app_id_, device_id_));
- ssize_t result = res_json.IsApplicationSaved(policy_app_id_, device_id_);
- EXPECT_EQ(-1, result);
-}
-
-TEST_F(ResumptionDataJsonTest, GetSavedApplication) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- smart_objects::SmartObject saved_app;
- EXPECT_TRUE(
- res_json.GetSavedApplication(policy_app_id_, device_id_, saved_app));
- CheckSavedApp(saved_app);
-}
-
-TEST_F(ResumptionDataJsonTest, GetSavedApplication_AppNotSaved) {
- ResumptionDataJson res_json;
- smart_objects::SmartObject saved_app;
- EXPECT_FALSE(
- res_json.GetSavedApplication(policy_app_id_, "54321", saved_app));
- EXPECT_TRUE(saved_app.empty());
-}
-
-TEST_F(ResumptionDataJsonTest, GetDataForLoadResumeData) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- smart_objects::SmartObject saved_app;
- res_json.GetDataForLoadResumeData(saved_app);
-
- EXPECT_EQ(policy_app_id_, saved_app[0][am::strings::app_id].asString());
- EXPECT_EQ(device_id_, saved_app[0][am::strings::device_id].asString());
- EXPECT_EQ(hmi_level_, static_cast<HMILevel::eType>(
- saved_app[0][am::strings::hmi_level].asInt()));
- EXPECT_EQ(ign_off_count_, saved_app[0][am::strings::ign_off_count].asUInt());
-}
-
-TEST_F(ResumptionDataJsonTest, GetDataForLoadResumeData_AppRemove) {
- ResumptionDataJson res_json;
- smart_objects::SmartObject saved_app;
-
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- EXPECT_TRUE(res_json.RemoveApplicationFromSaved(policy_app_id_, device_id_));
- res_json.GetDataForLoadResumeData(saved_app);
- EXPECT_TRUE(saved_app.empty());
-}
-
-TEST_F(ResumptionDataJsonTest, UpdateHmiLevel) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- HMILevel::eType new_hmi_level = HMILevel::HMI_LIMITED;
- res_json.UpdateHmiLevel(policy_app_id_, device_id_, new_hmi_level);
- hmi_level_ = new_hmi_level;
-
- CheckSavedJson();
-}
-
-TEST_F(ResumptionDataJsonTest, IsHMIApplicationIdExist_AppIsSaved) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- EXPECT_TRUE(res_json.IsHMIApplicationIdExist(hmi_app_id_));
-}
-
-TEST_F(ResumptionDataJsonTest, IsHMIApplicationIdExist_AppNotSaved) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
-
- CheckSavedJson();
- uint32_t new_hmi_app_id_ = hmi_app_id_ + 10;
- EXPECT_FALSE(res_json.IsHMIApplicationIdExist(new_hmi_app_id_));
-}
-
-TEST_F(ResumptionDataJsonTest, GetHMIApplicationID) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- EXPECT_EQ(hmi_app_id_,
- res_json.GetHMIApplicationID(policy_app_id_, device_id_));
-}
-
-TEST_F(ResumptionDataJsonTest, GetHMIApplicationID_AppNotSaved) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- EXPECT_EQ(0u, res_json.GetHMIApplicationID(policy_app_id_, "other_dev_id"));
-}
-
-TEST_F(ResumptionDataJsonTest, OnSuspend) {
- ResumptionDataJson res_json;
- ::profile::Profile::instance()->config_file_name("smartDeviceLink_test.ini");
- SetZeroIgnOff();
- PrepareData();
-
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-
- res_json.OnSuspend();
- ign_off_count_++;
- CheckSavedJson();
-
- EXPECT_TRUE(FileExists("./test_app_info.dat"));
- EXPECT_TRUE(DirectoryExists("./test_storage"));
- EXPECT_TRUE(RemoveDirectory("./test_storage", true));
- EXPECT_TRUE(DeleteFile("./test_app_info.dat"));
- ::profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
-}
-
-TEST_F(ResumptionDataJsonTest, OnSuspendFourTimes) {
- ResumptionDataJson res_json;
- PrepareData();
- ::profile::Profile::instance()->config_file_name("smartDeviceLink_test.ini");
- SetZeroIgnOff();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-
- res_json.OnSuspend();
- ign_off_count_++;
- CheckSavedJson();
-
- res_json.OnSuspend();
- res_json.OnSuspend();
- res_json.OnSuspend();
-
- ssize_t result = res_json.IsApplicationSaved(policy_app_id_, device_id_);
- EXPECT_EQ(-1, result);
-
- EXPECT_TRUE(FileExists("./test_app_info.dat"));
- EXPECT_TRUE(DirectoryExists("./test_storage"));
- EXPECT_TRUE(RemoveDirectory("./test_storage", true));
- EXPECT_TRUE(DeleteFile("./test_app_info.dat"));
- ::profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
-}
-
-TEST_F(ResumptionDataJsonTest, OnSuspendOnAwake) {
- ResumptionDataJson res_json;
- PrepareData();
- ::profile::Profile::instance()->config_file_name("smartDeviceLink_test.ini");
- SetZeroIgnOff();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-
- res_json.OnSuspend();
- ign_off_count_++;
- CheckSavedJson();
-
- res_json.OnAwake();
- ign_off_count_ = 0;
- CheckSavedJson();
- EXPECT_TRUE(RemoveDirectory("./test_storage", true));
- EXPECT_TRUE(DeleteFile("./test_app_info.dat"));
- ::profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
-}
-
-TEST_F(ResumptionDataJsonTest, Awake_AppNotSuspended) {
- ResumptionDataJson res_json;
- SetZeroIgnOff();
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-
- res_json.OnAwake();
- ign_off_count_ = 0;
- CheckSavedJson();
-}
-
-TEST_F(ResumptionDataJsonTest, TwiceAwake_AppNotSuspended) {
- ResumptionDataJson res_json;
- SetZeroIgnOff();
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-
- res_json.OnSuspend();
- res_json.OnAwake();
- ign_off_count_ = 0;
- CheckSavedJson();
-
- res_json.OnAwake();
- CheckSavedJson();
-}
-
-TEST_F(ResumptionDataJsonTest, GetHashId) {
- ResumptionDataJson res_json;
- PrepareData();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
-
- std::string test_hash;
- EXPECT_TRUE(res_json.GetHashId(policy_app_id_, device_id_, test_hash));
- EXPECT_EQ(hash_, test_hash);
-}
-
-TEST_F(ResumptionDataJsonTest, GetIgnOffTime_AfterSuspendAndAwake) {
- ResumptionDataJson res_json;
- uint32_t last_ign_off_time;
- PrepareData();
- ::profile::Profile::instance()->config_file_name("smartDeviceLink_test.ini");
- SetZeroIgnOff();
- res_json.SaveApplication(app_mock);
- CheckSavedJson();
- last_ign_off_time = res_json.GetIgnOffTime();
- EXPECT_EQ(0u, last_ign_off_time);
-
- res_json.OnSuspend();
-
- uint32_t after_suspend;
- after_suspend = res_json.GetIgnOffTime();
- EXPECT_LE(last_ign_off_time, after_suspend);
-
- uint32_t after_awake;
- res_json.OnAwake();
-
- after_awake = res_json.GetIgnOffTime();
- EXPECT_LE(after_suspend, after_awake);
-
- EXPECT_TRUE(RemoveDirectory("./test_storage", true));
- EXPECT_TRUE(DeleteFile("./test_app_info.dat"));
- ::profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
-}
-
-} // namespace resumption_test
-} // namespace components
-} // namespace test
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 b8054b0d85..4b5970daa6 100644
--- a/src/components/application_manager/test/resumption/resumption_data_test.cc
+++ b/src/components/application_manager/test/resumption/resumption_data_test.cc
@@ -37,7 +37,7 @@
#include "application_manager/usage_statistics.h"
#include "include/application_mock.h"
#include "include/resumption_data_mock.h"
-
+#include "utils/custom_string.h"
#include "application_manager/application_manager_impl.h"
#include "application_manager/application.h"
#include "utils/data_accessor.h"
@@ -45,16 +45,10 @@
#include "include/resumption_data_test.h"
-std::string application_manager::MessageHelper::GetDeviceMacAddressForHandle(
- const uint32_t device_handle) {
- std::string device_mac_address = "12345";
- return device_mac_address;
-}
-
namespace test {
namespace components {
namespace resumption_test {
-
+namespace custom_str = utils::custom_string;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::ReturnPointee;
@@ -66,8 +60,9 @@ void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
EXPECT_EQ(hmi_app_id_, resume_app_list[am::strings::hmi_app_id].asUInt());
EXPECT_EQ(ign_off_count_,
resume_app_list[am::strings::ign_off_count].asUInt());
- EXPECT_EQ(hmi_level_, static_cast<HMILevel::eType>(
- resume_app_list[am::strings::hmi_level].asInt()));
+ EXPECT_EQ(hmi_level_,
+ static_cast<HMILevel::eType>(
+ resume_app_list[am::strings::hmi_level].asInt()));
EXPECT_EQ(is_audio_,
resume_app_list[am::strings::is_media_application].asBool());
EXPECT_EQ("12345", resume_app_list[am::strings::device_id].asString());
@@ -85,9 +80,9 @@ void ResumptionDataTest::CheckSavedApp(sm::SmartObject& resume_app_list) {
void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
for (uint32_t i = 0; i < count_of_commands; ++i) {
EXPECT_EQ(i, res_list[i][am::strings::cmd_id].asUInt());
- std::string name =
- (*test_commands_map[i])[am::strings::menu_params]
- [am::strings::menu_name].asString();
+ std::string name = (*test_commands_map[i])[am::strings::menu_params]
+ [am::strings::menu_name]
+ .asString();
EXPECT_EQ(name,
res_list[i][am::strings::menu_params][am::strings::menu_name]
.asString());
@@ -99,7 +94,8 @@ void ResumptionDataTest::CheckCommands(sm::SmartObject& res_list) {
res_list[i][am::strings::menu_params][am::strings::position].asInt());
int parent_id = (*test_commands_map[i])[am::strings::menu_params]
- [am::hmi_request::parent_id].asInt();
+ [am::hmi_request::parent_id]
+ .asInt();
EXPECT_EQ(parent_id,
res_list[i][am::strings::menu_params][am::hmi_request::parent_id]
.asInt());
@@ -158,20 +154,24 @@ void ResumptionDataTest::CheckChoiceSet(sm::SmartObject& res_list) {
std::snprintf(numb, 12, "%d", i + j);
std::string test_choice =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::vr_commands][0].asString();
+ [am::strings::vr_commands][0]
+ .asString();
EXPECT_EQ(test_choice, command[am::strings::vr_commands][0].asString());
std::string menu_name =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::menu_name].asString();
+ [am::strings::menu_name]
+ .asString();
EXPECT_EQ(menu_name, command[am::strings::menu_name].asString());
std::string secondary_text =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::secondary_text].asString();
+ [am::strings::secondary_text]
+ .asString();
EXPECT_EQ(secondary_text,
command[am::strings::secondary_text].asString());
std::string tertiary_text =
(*test_choiceset_map[i])[am::strings::choice_set][j]
- [am::strings::tertiary_text].asString();
+ [am::strings::tertiary_text]
+ .asString();
EXPECT_EQ(tertiary_text, command[am::strings::tertiary_text].asString());
std::string image_value =
@@ -189,13 +189,15 @@ void ResumptionDataTest::CheckChoiceSet(sm::SmartObject& res_list) {
image_value = (*test_choiceset_map[i])[am::strings::choice_set][j]
[am::strings::secondary_image]
- [am::strings::value].asString();
+ [am::strings::value]
+ .asString();
EXPECT_EQ(
image_value,
command[am::strings::secondary_image][am::strings::value].asString());
image_type = (*test_choiceset_map[i])[am::strings::choice_set][j]
[am::strings::secondary_image]
- [am::strings::image_type].asInt();
+ [am::strings::image_type]
+ .asInt();
EXPECT_EQ(image_type,
command[am::strings::secondary_image][am::strings::image_type]
.asInt());
@@ -261,13 +263,15 @@ void ResumptionDataTest::CheckKeyboardProperties(sm::SmartObject& res_list) {
res_list[am::strings::limited_character_list][i].asString());
}
- EXPECT_EQ(testlanguage, static_cast<Language::eType>(
- res_list[am::strings::language].asInt()));
+ EXPECT_EQ(
+ testlanguage,
+ static_cast<Language::eType>(res_list[am::strings::language].asInt()));
EXPECT_EQ(testlayout,
static_cast<KeyboardLayout::eType>(
res_list[am::hmi_request::keyboard_layout].asInt()));
- EXPECT_EQ(testmode, static_cast<KeypressMode::eType>(
- res_list[am::strings::key_press_mode].asInt()));
+ EXPECT_EQ(testmode,
+ static_cast<KeypressMode::eType>(
+ res_list[am::strings::key_press_mode].asInt()));
EXPECT_EQ(auto_complete_text,
res_list[am::strings::auto_complete_text].asString());
}
@@ -283,8 +287,9 @@ void ResumptionDataTest::CheckMenuIcon(sm::SmartObject& res_list) {
(*menu_icon_)[am::strings::image_type].asInt());
EXPECT_EQ(value, res_list[am::strings::value].asString());
- EXPECT_EQ(type, static_cast<ImageType::eType>(
- res_list[am::strings::image_type].asInt()));
+ EXPECT_EQ(
+ type,
+ static_cast<ImageType::eType>(res_list[am::strings::image_type].asInt()));
}
void ResumptionDataTest::CheckHelpPrompt(sm::SmartObject& res_list) {
@@ -302,8 +307,9 @@ void ResumptionDataTest::CheckTimeoutPrompt(
SpeechCapabilities::eType speech = static_cast<SpeechCapabilities::eType>(
(*timeout_prompt_)[i][am::strings::type].asInt());
EXPECT_EQ(text, res_list[i][am::strings::text].asString());
- EXPECT_EQ(speech, static_cast<SpeechCapabilities::eType>(
- res_list[i][am::strings::type].asInt()));
+ EXPECT_EQ(speech,
+ static_cast<SpeechCapabilities::eType>(
+ res_list[i][am::strings::type].asInt()));
}
}
@@ -342,6 +348,7 @@ void ResumptionDataTest::PrepareData() {
ON_CALL(*app_mock, is_application_data_changed()).WillByDefault(Return(true));
ON_CALL(*app_mock, policy_app_id()).WillByDefault(Return(policy_app_id_));
+ ON_CALL(*app_mock, mac_address()).WillByDefault(ReturnRef(mac_address_));
ON_CALL(*app_mock, curHash()).WillByDefault(ReturnRef(hash_));
ON_CALL(*app_mock, get_grammar_id()).WillByDefault(Return(grammar_id_));
ON_CALL(*app_mock, device()).WillByDefault(Return(device_handle_));
@@ -379,6 +386,7 @@ void ResumptionDataTest::SetGlobalProporties() {
}
void ResumptionDataTest::SetMenuTitleAndIcon() {
+ custom_str::CustomString icon_name("test icon");
sm::SmartObject sm_icon;
sm_icon[am::strings::value] = "test icon";
sm_icon[am::strings::image_type] = ImageType::STATIC;
diff --git a/src/components/application_manager/test/resumption/resumption_data_test.h b/src/components/application_manager/test/resumption/resumption_data_test.h
new file mode 100755
index 0000000000..7fc49a53d0
--- /dev/null
+++ b/src/components/application_manager/test/resumption/resumption_data_test.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+#include <algorithm>
+#include "gtest/gtest.h"
+#include "application_manager/usage_statistics.h"
+#include "application_mock.h"
+#include "application_manager/application_manager_impl.h"
+#include "utils/data_accessor.h"
+
+namespace test {
+namespace components {
+namespace resumption_test {
+
+using ::testing::NiceMock;
+namespace am = application_manager;
+namespace sm = smart_objects;
+using namespace Json;
+
+using namespace resumption;
+using namespace mobile_apis;
+
+class ResumptionDataTest : public ::testing::Test {
+ protected:
+ // Check structure in saved application
+ void CheckSavedApp(sm::SmartObject& saved_data);
+
+ // Set data for resumption
+ virtual void PrepareData();
+ utils::SharedPtr<NiceMock<MockApplication>> app_mock;
+
+ HMILevel::eType hmi_level_;
+ size_t app_id_;
+ size_t hmi_app_id_;
+ std::string policy_app_id_;
+ size_t ign_off_count_;
+ const size_t tts_chunks_count = 4;
+
+ size_t grammar_id_;
+ std::string hash_;
+ bool is_audio_;
+ const connection_handler::DeviceHandle device_handle_ = 10;
+
+ sm::SmartObject* help_prompt_;
+ sm::SmartObject* timeout_prompt_;
+ sm::SmartObject* vr_help_;
+ sm::SmartObject* vr_help_title_;
+ sm::SmartObject* vr_synonyms_;
+ sm::SmartObject* keyboard_props_;
+ sm::SmartObject* menu_title_;
+ sm::SmartObject* menu_icon_;
+
+ void SetCommands();
+ void SetSubmenues();
+ void SetChoiceSet();
+ void SetAppFiles();
+ void SetGlobalProporties();
+ void SetKeyboardProperties();
+ void SetMenuTitleAndIcon();
+ void SetHelpAndTimeoutPrompt();
+ void SetVRHelpTitle();
+ void SetSubscriptions();
+
+ void CheckCommands(sm::SmartObject& res_list);
+ void CheckGlobalProporties(sm::SmartObject& res_list);
+ void CheckSubmenues(sm::SmartObject& res_list);
+ void CheckChoiceSet(sm::SmartObject& res_list);
+ void CheckAppFiles(sm::SmartObject& res_list);
+ void CheckKeyboardProperties(sm::SmartObject& res_list);
+ void CheckMenuTitle(sm::SmartObject& res_list);
+ void CheckMenuIcon(sm::SmartObject& res_list);
+ void CheckHelpPrompt(sm::SmartObject& res_list);
+ void CheckTimeoutPrompt(sm::SmartObject& res_list);
+ void CheckVRHelp(NsSmartDeviceLink::NsSmartObjects::SmartObject& res_list);
+ void CheckVRTitle(sm::SmartObject& res_list);
+ void CheckSubscriptions(sm::SmartObject& res_list);
+
+ const size_t count_of_commands = 5;
+ const size_t count_of_choice = 2;
+ const size_t count_of_choice_sets = 4;
+ const size_t count_of_submenues = 3;
+ const size_t count_of_files = 8;
+ const size_t count_of_vrhelptitle = 2;
+ const std::string mac_address = "12345";
+
+ am::CommandsMap test_commands_map;
+ am::SubMenuMap test_submenu_map;
+ am::ChoiceSetMap test_choiceset_map;
+ am::AppFilesMap app_files_map_;
+
+ am::ButtonSubscriptions btn_subscr;
+ am::VehicleInfoSubscriptions ivi;
+
+ sync_primitives::Lock sublock_;
+ sync_primitives::Lock comlock_;
+ sync_primitives::Lock setlock_;
+ sync_primitives::Lock btnlock_;
+ sync_primitives::Lock ivilock_;
+};
+
+} // namespace resumption_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/resumption_sql_queries_test.cc b/src/components/application_manager/test/resumption_sql_queries_test.cc
new file mode 100644
index 0000000000..ceeb0f2846
--- /dev/null
+++ b/src/components/application_manager/test/resumption_sql_queries_test.cc
@@ -0,0 +1,2421 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <algorithm>
+#include <vector>
+#include <string>
+#include <sstream>
+#include <utility>
+#include "gtest/gtest.h"
+
+#include "sqlite_wrapper/sql_database.h"
+#include "sqlite_wrapper/sql_query.h"
+#include "utils/file_system.h"
+#include "config_profile/profile.h"
+#include "resumption_sql_queries.h"
+#include "policy/sql_pt_queries.h"
+
+namespace resumption {
+namespace test {
+
+using std::string;
+using std::pair;
+using utils::dbms::SQLDatabase;
+using utils::dbms::SQLQuery;
+
+enum AccessoryVRCommand { kVRCommandFromChoice = 0, kVRCommandFromCommand };
+
+const string kDeleteData =
+ "BEGIN; "
+ "DELETE FROM `resumption`; "
+ "DELETE FROM `image`; "
+ "DELETE FROM `applicationChoiceSet`; "
+ "DELETE FROM `file`; "
+ "DELETE FROM `subMenu`; "
+ "DELETE FROM `TTSChunk`; "
+ "DELETE FROM `vrHelpItem`; "
+ "DELETE FROM `tableLimitedCharacterList`; "
+ "DELETE FROM `characterArray`; "
+ "DELETE FROM `choice`; "
+ "DELETE FROM `command`; "
+ "DELETE FROM `globalProperties`; "
+ "DELETE FROM `choiceArray`; "
+ "DELETE FROM `vrCommandsArray`; "
+ "DELETE FROM `helpTimeoutPromptArray`; "
+ "DELETE FROM `vrHelpItemArray`; "
+ "DELETE FROM `application`; "
+ "DELETE FROM `applicationChoiceSetArray`; "
+ "DELETE FROM `applicationCommandsArray`; "
+ "DELETE FROM `applicationFilesArray`; "
+ "DELETE FROM `applicationSubMenuArray`; "
+ "DELETE FROM `applicationSubscribtionsArray`; "
+ "DELETE FROM `_internal_data`; "
+ "COMMIT; "
+ "VACUUM;";
+
+const std::string kJournalOff = "PRAGMA journal_mode = OFF;";
+
+class ResumptionSqlQueriesTest : public ::testing::Test {
+ public:
+ typedef pair<int, string> ValToPosPair;
+
+ protected:
+ std::vector<string> db_schema;
+ static const string kDatabaseName;
+ static SQLDatabase* db_;
+ static const string app_id1;
+ static const string app_id2;
+ static const string device_id;
+ static const string device_id2;
+ static const string test_hash;
+ static const string test_hash2;
+ static const string test_image;
+ static const int connection_key;
+ static const int grammarID;
+ static const int hmiAppID;
+ static const int hmiAppID2;
+ static const int hmiLevel;
+ static const int hmiLevel2;
+ static const int ign_off_count;
+ static const int ign_off_count2;
+ static const int timeStamp;
+ static const int timeStamp2;
+
+ static void SetUpTestCase() {
+ db_ = new SQLDatabase();
+ ASSERT_TRUE(db_->Open());
+ ASSERT_TRUE(db_->IsReadWrite());
+ SQLQuery query(db_);
+ ASSERT_TRUE(query.Exec(resumption::kCreateSchema));
+ SQLQuery query_logging_off(db_);
+ ASSERT_TRUE(query_logging_off.Exec(kJournalOff));
+ }
+
+ static void TearDownTestCase() {
+ db_->Close();
+ delete db_;
+ string file_to_delete = kDatabaseName + ".sqlite";
+ file_system::DeleteFile(file_to_delete);
+ }
+ void TearDown() { DeleteTablesData();
+ }
+
+ void CheckDeleteQuery(const string& count_query, const string& query_to_check,
+ pair<int, string> app_info, pair<int, string> dev_info,
+ const int value_before, const int value_after,
+ const int position_in_result);
+
+ void CheckSelectQuery(const string& query_to_check, const int control_value,
+ const int position_in_result);
+
+ void CheckSelectQuery(const string& query_to_check, const char* control_value,
+ const int position_in_result);
+
+ void CheckSelectQuery(const string& query_to_check, const bool control_value,
+ const int position_in_result);
+
+ void CheckSelectQuery(const string& query_to_check,
+ const string& control_value,
+ const int position_in_result);
+
+ void CheckSelectQuery(const string& query_to_check,
+ pair<int, string> app_info, pair<int, string> dev_info,
+ const int control_value, const int position_in_result);
+
+ void CheckSelectQuery(const string& query_to_check,
+ pair<int, string> app_info, pair<int, string> dev_info,
+ const string& control_value,
+ const int position_in_result);
+
+ string IntToString(const int64_t key) const {
+ std::stringstream ss;
+ ss << key;
+ return ss.str();
+ }
+
+ SQLQuery& FillGlobalPropertiesTable(
+ SQLQuery& query, const string& vrHelpTitle, const string& menuTitle,
+ const int language, const int keyboardLayout, const int keypressMode,
+ const string& autoCompleteText, const int64_t image_key);
+
+ SQLQuery& FillApplicationTable(SQLQuery& query, const int connection_key,
+ const int grammarID, const string& hashID,
+ const int hmiAppID, const int hmiLevel,
+ const int ign_off_count, const int timeStamp,
+ bool isMediaApplication, const string& appID,
+ const string& deviceID,
+ const int64_t glob_prop_key);
+
+ SQLQuery& FillImageTable(SQLQuery& query, const int imageType,
+ const string& value);
+
+ SQLQuery& FillTableLimitedCharacterListTable(
+ SQLQuery& query, const string& limitedCharacterList);
+
+ SQLQuery& FillCharacterArrayTable(SQLQuery& query,
+ const int64_t glob_prop_key,
+ const int64_t lim_char_list_key);
+
+ SQLQuery& FillTTSChunkTable(SQLQuery& query, const int type,
+ const string& text);
+
+ SQLQuery& FillHelpTimeoutPromptArrayTable(SQLQuery& query,
+ const int64_t glob_prop_key,
+ const int64_t tts_chunk_key,
+ const int idhelpPrompt);
+
+ SQLQuery& FillFileTable(SQLQuery& query, const int fileType,
+ bool is_download_complete, bool persistentFile,
+ const string& syncFileName);
+
+ SQLQuery& FillApplicationFilesArrayTable(SQLQuery& query,
+ const int64_t app_key,
+ const int64_t file_key);
+
+ SQLQuery& FillSubMenuTable(SQLQuery& query, const int menuID,
+ const string& menuName, const int position);
+
+ SQLQuery& FillApplicationSubMenuArrayTable(SQLQuery& query, const int app_key,
+ const int sub_menu_key);
+
+ SQLQuery& FillAppSubscriptionsArrayTable(SQLQuery& query,
+ const int vehicleValue,
+ const int ButtonNameValue,
+ const int app_key);
+
+ SQLQuery& FillCommandTable(SQLQuery& query, const int cmdID,
+ const string& menuName, const int parentID,
+ const int position, const int64_t image_key);
+
+ SQLQuery& FillApplicationCommandsArrayTable(SQLQuery& query,
+ const int64_t application_key,
+ const int64_t command_key);
+
+ SQLQuery& FillChoiceTable(SQLQuery& query, const int choiceID,
+ const string& menuName, const string& secondaryText,
+ const string& tertiaryText,
+ const int64_t image_key);
+
+ SQLQuery& FillChoiceArrayTable(SQLQuery& query,
+ const int64_t app_choice_set_key,
+ const int64_t choice_key);
+
+ SQLQuery& FillApplicationChoiceSetTable(SQLQuery& query, const int grammarID,
+ const int interactionChoiceSetID);
+
+ SQLQuery& FillApplicationChoiceSetArrayTable(SQLQuery& query,
+ const int64_t app_choice_set_key,
+ const int64_t app_key);
+
+ SQLQuery& FillVRCommandsArrayTable(SQLQuery& query, const string& vrCommand,
+ AccessoryVRCommand value,
+ const int64_t foreing_key);
+
+ SQLQuery& FillVRHelpItemTable(SQLQuery& query, const string& text,
+ const int position, const int64_t image_key);
+
+ SQLQuery& FillVRHelpItemArrayTable(SQLQuery& query,
+ const int64_t global_prop_key,
+ const int64_t vr_help_item_key);
+
+ void CreateSchema() {
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Exec(kCreateSchema));
+ }
+
+ void DestroySchema() {
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Exec(kDropSchema));
+ }
+
+ void DeleteTablesData() {
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Exec(kDeleteData));
+ }
+
+ SQLDatabase* db() const { return db_; }
+
+ void db_schema_fill() {
+ db_schema.push_back("resumption");
+ db_schema.push_back("image");
+ db_schema.push_back("applicationChoiceSet");
+ db_schema.push_back("file");
+ db_schema.push_back("subMenu");
+ db_schema.push_back("TTSChunk");
+ db_schema.push_back("vrHelpItem");
+ db_schema.push_back("tableLimitedCharacterList");
+ db_schema.push_back("characterArray");
+ db_schema.push_back("choice");
+ db_schema.push_back("command");
+ db_schema.push_back("globalProperties");
+ db_schema.push_back("choiceArray");
+ db_schema.push_back("vrCommandsArray");
+ db_schema.push_back("helpTimeoutPromptArray");
+ db_schema.push_back("vrHelpItemArray");
+ db_schema.push_back("application");
+ db_schema.push_back("applicationChoiceSetArray");
+ db_schema.push_back("applicationCommandsArray");
+ db_schema.push_back("applicationFilesArray");
+ db_schema.push_back("applicationSubMenuArray");
+ db_schema.push_back("applicationSubscribtionsArray");
+ db_schema.push_back("_internal_data");
+ std::sort(db_schema.begin(), db_schema.end());
+ }
+};
+
+SQLDatabase* ResumptionSqlQueriesTest::db_ = NULL;
+const string ResumptionSqlQueriesTest::kDatabaseName = "test_database";
+const string ResumptionSqlQueriesTest::app_id1 = "baax";
+const string ResumptionSqlQueriesTest::app_id2 = "caax";
+const string ResumptionSqlQueriesTest::device_id = "ZZZ";
+const string ResumptionSqlQueriesTest::device_id2 = "XXX";
+const string ResumptionSqlQueriesTest::test_hash = "test_hash";
+const string ResumptionSqlQueriesTest::test_hash2 = "test_hash2";
+const string ResumptionSqlQueriesTest::test_image = "test_image";
+const int ResumptionSqlQueriesTest::connection_key = 1;
+const int ResumptionSqlQueriesTest::grammarID = 2;
+const int ResumptionSqlQueriesTest::hmiAppID = 111;
+const int ResumptionSqlQueriesTest::hmiAppID2 = 112;
+const int ResumptionSqlQueriesTest::hmiLevel = 2;
+const int ResumptionSqlQueriesTest::hmiLevel2 = 3;
+const int ResumptionSqlQueriesTest::ign_off_count = 3;
+const int ResumptionSqlQueriesTest::ign_off_count2 = 4;
+const int ResumptionSqlQueriesTest::timeStamp = 2015;
+const int ResumptionSqlQueriesTest::timeStamp2 = 2016;
+
+void ResumptionSqlQueriesTest::CheckDeleteQuery(const string& count_query,
+ const string& query_to_check,
+ pair<int, string> app_info,
+ pair<int, string> dev_info,
+ const int value_before,
+ const int value_after,
+ const int position_in_result) {
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Prepare(count_query));
+ EXPECT_TRUE(query.Exec());
+ EXPECT_EQ(value_before, query.GetInteger(position_in_result));
+ EXPECT_TRUE(query.Reset());
+ // Act
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ if (!app_info.second.empty()) {
+ query_to_check_request.Bind(app_info.first, app_info.second);
+ }
+ if (!dev_info.second.empty()) {
+ query_to_check_request.Bind(dev_info.first, dev_info.second);
+ }
+ EXPECT_TRUE(query_to_check_request.Exec());
+ // Check after action
+ EXPECT_TRUE(query.Exec());
+ EXPECT_EQ(value_after, query.GetInteger(position_in_result));
+}
+
+void ResumptionSqlQueriesTest::CheckSelectQuery(const string& query_to_check,
+ pair<int, string> app_info,
+ pair<int, string> dev_info,
+ const int control_value,
+ const int position_in_result) {
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ if (!app_info.second.empty()) {
+ query_to_check_request.Bind(app_info.first, app_info.second);
+ }
+ if (!dev_info.second.empty()) {
+ query_to_check_request.Bind(dev_info.first, dev_info.second);
+ }
+ EXPECT_TRUE(query_to_check_request.Exec());
+ EXPECT_EQ(control_value,
+ query_to_check_request.GetInteger(position_in_result));
+}
+
+void ResumptionSqlQueriesTest::CheckSelectQuery(const string& query_to_check,
+ const int control_value,
+ const int position_in_result) {
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ EXPECT_TRUE(query_to_check_request.Exec());
+ EXPECT_EQ(control_value,
+ query_to_check_request.GetInteger(position_in_result));
+}
+
+void ResumptionSqlQueriesTest::CheckSelectQuery(const string& query_to_check,
+ const bool control_value,
+ const int position_in_result) {
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ EXPECT_TRUE(query_to_check_request.Exec());
+ EXPECT_EQ(control_value,
+ query_to_check_request.GetBoolean(position_in_result));
+}
+
+void ResumptionSqlQueriesTest::CheckSelectQuery(const string& query_to_check,
+ const string& control_value,
+ const int position_in_result) {
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ EXPECT_TRUE(query_to_check_request.Exec());
+ EXPECT_EQ(control_value,
+ query_to_check_request.GetString(position_in_result));
+}
+
+void ResumptionSqlQueriesTest::CheckSelectQuery(const string& query_to_check,
+ const char* control_value,
+ const int position_in_result) {
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ EXPECT_TRUE(query_to_check_request.Exec());
+ EXPECT_EQ(string(control_value),
+ query_to_check_request.GetString(position_in_result));
+}
+
+void ResumptionSqlQueriesTest::CheckSelectQuery(const string& query_to_check,
+ pair<int, string> app_info,
+ pair<int, string> dev_info,
+ const string& control_value,
+ const int position_in_result) {
+ SQLQuery query_to_check_request(db());
+ EXPECT_TRUE(query_to_check_request.Prepare(query_to_check));
+ if (!app_info.second.empty()) {
+ query_to_check_request.Bind(app_info.first, app_info.second);
+ }
+ if (!dev_info.second.empty()) {
+ query_to_check_request.Bind(dev_info.first, dev_info.second);
+ }
+ EXPECT_TRUE(query_to_check_request.Exec());
+ EXPECT_EQ(control_value,
+ query_to_check_request.GetString(position_in_result));
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillImageTable(SQLQuery& query,
+ const int imageType,
+ const string& value) {
+ EXPECT_TRUE(query.Prepare(kInsertImage));
+ query.Bind(0, imageType);
+ query.Bind(1, value);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillTableLimitedCharacterListTable(
+ SQLQuery& query, const string& limitedCharacterList) {
+ EXPECT_TRUE(query.Prepare(kInsertTableLimitedCharacter));
+ query.Bind(0, limitedCharacterList);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillCharacterArrayTable(
+ SQLQuery& query, const int64_t glob_prop_key,
+ const int64_t lim_char_list_key) {
+ EXPECT_TRUE(query.Prepare(kInsertCharacterArray));
+ query.Bind(0, glob_prop_key);
+ query.Bind(1, lim_char_list_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillTTSChunkTable(SQLQuery& query,
+ const int type,
+ const string& text) {
+ EXPECT_TRUE(query.Prepare(kInsertTTSChunk));
+ query.Bind(0, type);
+ query.Bind(1, text);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillHelpTimeoutPromptArrayTable(
+ SQLQuery& query, int64_t glob_prop_key, int64_t tts_chunk_key,
+ const int idhelpPrompt) {
+ EXPECT_TRUE(query.Prepare(kInsertHelpTimeoutPromptArray));
+ query.Bind(0, glob_prop_key);
+ query.Bind(1, tts_chunk_key);
+ query.Bind(2, idhelpPrompt);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillApplicationTable(
+ SQLQuery& query, const int connection_key, const int grammarID,
+ const string& hashID, const int hmiAppID, const int hmiLevel,
+ const int ign_off_count, const int timeStamp, bool isMediaApplication,
+ const string& appID, const string& deviceID, const int64_t glob_prop_key) {
+ EXPECT_TRUE(query.Prepare(kInsertApplication));
+ query.Bind(0, connection_key);
+ query.Bind(1, grammarID);
+ query.Bind(2, hashID);
+ query.Bind(3, hmiAppID);
+ query.Bind(4, hmiLevel);
+ query.Bind(5, ign_off_count);
+ query.Bind(6, timeStamp);
+ query.Bind(7, glob_prop_key);
+ query.Bind(8, isMediaApplication);
+ query.Bind(9, appID);
+ query.Bind(10, deviceID);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillGlobalPropertiesTable(
+ SQLQuery& query, const string& vrHelpTitle, const string& menuTitle,
+ const int language, const int keyboardLayout, const int keypressMode,
+ const string& autoCompleteText, const int64_t image_key) {
+ EXPECT_TRUE(query.Prepare(kInsertGlobalProperties));
+ query.Bind(0, vrHelpTitle);
+ query.Bind(1, menuTitle);
+ query.Bind(2, image_key);
+ query.Bind(3, language);
+ query.Bind(4, keyboardLayout);
+ query.Bind(5, keypressMode);
+ query.Bind(6, autoCompleteText);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillApplicationCommandsArrayTable(
+ SQLQuery& query, const int64_t application_key, const int64_t command_key) {
+ EXPECT_TRUE(query.Prepare(kInsertApplicationCommandArray));
+ query.Bind(0, application_key);
+ query.Bind(1, command_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillCommandTable(
+ SQLQuery& query, const int cmdID, const string& menuName,
+ const int parentID, const int position, const int64_t image_key) {
+ EXPECT_TRUE(query.Prepare(kInsertToCommand));
+ query.Bind(0, cmdID);
+ query.Bind(1, image_key);
+ query.Bind(2, menuName);
+ query.Bind(3, parentID);
+ query.Bind(4, position);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillChoiceTable(SQLQuery& query,
+ const int choiceID,
+ const string& menuName,
+ const string& secondaryText,
+ const string& tertiaryText,
+ const int64_t image_key) {
+ EXPECT_TRUE(query.Prepare(kInsertChoice));
+ query.Bind(0, choiceID);
+ query.Bind(1, menuName);
+ query.Bind(2, secondaryText);
+ query.Bind(3, tertiaryText);
+ query.Bind(4, image_key);
+ query.Bind(5, image_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillChoiceArrayTable(
+ SQLQuery& query, const int64_t app_choice_set_key,
+ const int64_t choice_key) {
+ EXPECT_TRUE(query.Prepare(kInsertChoiceArray));
+ query.Bind(0, app_choice_set_key);
+ query.Bind(1, choice_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillApplicationChoiceSetTable(
+ SQLQuery& query, const int grammarID, const int interactionChoiceSetID) {
+ EXPECT_TRUE(query.Prepare(kInsertApplicationChoiceSet));
+ query.Bind(0, grammarID);
+ query.Bind(1, interactionChoiceSetID);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillApplicationChoiceSetArrayTable(
+ SQLQuery& query, const int64_t app_choice_set_key, const int64_t app_key) {
+ EXPECT_TRUE(query.Prepare(kInsertApplicationChoiceSetArray));
+ query.Bind(0, app_choice_set_key);
+ query.Bind(1, app_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillVRCommandsArrayTable(
+ SQLQuery& query, const string& vrCommand, AccessoryVRCommand value,
+ const int64_t foreing_key) {
+ EXPECT_TRUE(query.Prepare(kInsertVrCommand));
+ query.Bind(0, vrCommand);
+ if (AccessoryVRCommand::kVRCommandFromCommand == value) {
+ query.Bind(1, foreing_key);
+ query.Bind(2);
+ } else if (AccessoryVRCommand::kVRCommandFromChoice == value) {
+ query.Bind(1);
+ query.Bind(2, foreing_key);
+ }
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillVRHelpItemTable(
+ SQLQuery& query, const string& text, const int position,
+ const int64_t image_key) {
+ EXPECT_TRUE(query.Prepare(kInsertVRHelpItem));
+ query.Bind(0, text);
+ query.Bind(1, position);
+ query.Bind(2, image_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillVRHelpItemArrayTable(
+ SQLQuery& query, const int64_t global_prop_key,
+ const int64_t vr_help_item_key) {
+ EXPECT_TRUE(query.Prepare(kInsertVRHelpItemArray));
+ query.Bind(0, global_prop_key);
+ query.Bind(1, vr_help_item_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillApplicationSubMenuArrayTable(
+ SQLQuery& query, const int app_key, const int sub_menu_key) {
+ EXPECT_TRUE(query.Prepare(kInsertToApplicationSubMenuArray));
+ query.Bind(0, app_key);
+ query.Bind(1, sub_menu_key);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillAppSubscriptionsArrayTable(
+ SQLQuery& query, const int vehicleValue, const int ButtonNameValue,
+ const int app_key) {
+ EXPECT_TRUE(query.Prepare(kInsertSubscriptions));
+ query.Bind(0, app_key);
+ query.Bind(1, vehicleValue);
+ query.Bind(2, ButtonNameValue);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillFileTable(SQLQuery& query,
+ const int fileType,
+ bool is_download_complete,
+ bool persistentFile,
+ const string& syncFileName) {
+ EXPECT_TRUE(query.Prepare(kInsertToFile));
+ query.Bind(0, fileType);
+ query.Bind(1, is_download_complete);
+ query.Bind(2, persistentFile);
+ query.Bind(3, syncFileName);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillSubMenuTable(SQLQuery& query,
+ const int menuID,
+ const string& menuName,
+ const int position) {
+ EXPECT_TRUE(query.Prepare(kInsertToSubMenu));
+ query.Bind(0, menuID);
+ query.Bind(1, menuName);
+ query.Bind(2, position);
+ EXPECT_TRUE(query.Exec());
+ return query;
+}
+
+SQLQuery& ResumptionSqlQueriesTest::FillApplicationFilesArrayTable(
+ SQLQuery& query, const int64_t app_key, const int64_t file_key) {
+ SQLQuery query_insert_application_files_array(db());
+ EXPECT_TRUE(query_insert_application_files_array.Prepare(
+ kInsertToApplicationFilesArray));
+ query_insert_application_files_array.Bind(0, app_key);
+ query_insert_application_files_array.Bind(1, file_key);
+ EXPECT_TRUE(query_insert_application_files_array.Exec());
+ return query;
+}
+
+TEST_F(ResumptionSqlQueriesTest, kCreateSchemaTest_ExpectSchemaCreated) {
+ // Arrange
+ SQLQuery query(db());
+ DestroySchema();
+ const std::string kCheckTablesNumber =
+ "SELECT COUNT(*) FROM sqlite_master WHERE `type` = 'table'";
+ // Check schema is not yet created
+ CheckSelectQuery(kCheckTablesNumber, 0, 0);
+ // Act
+ CreateSchema();
+ // Check schema created successfully
+ EXPECT_TRUE(query.Prepare(kCheckTablesNumber) && query.Exec());
+ EXPECT_GT(query.GetInteger(0), 0);
+ ASSERT_TRUE(query.Reset());
+ const std::string query_select_all_tbl_names =
+ "SELECT `tbl_name` FROM sqlite_master WHERE `type` = 'table'";
+ EXPECT_TRUE(query.Prepare(query_select_all_tbl_names));
+ std::vector<std::string> result;
+ db_schema_fill();
+ while (query.Next()) {
+ result.push_back(query.GetString(0));
+ }
+ std::sort(result.begin(), result.end());
+ EXPECT_TRUE(db_schema == result);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDropSchemaTest_ExpectSchemaDestroyed) {
+ // Arrange
+ const std::string kCheckTablesNumber =
+ "SELECT COUNT(*) FROM sqlite_master WHERE `type` = 'table'";
+ // Act
+ DestroySchema();
+ // Check schema is already destroyed
+ CheckSelectQuery(kCheckTablesNumber, 0, 0);
+ // Restore Created database schema as used as shared source
+ CreateSchema();
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertInitData_ExpectInitDataInserted) {
+ // Arrange
+ SQLQuery query_insert_resumption(db());
+ const std::string kCheckInitData = "SELECT COUNT(*) FROM `resumption`";
+ CheckSelectQuery(kCheckInitData, 0, 0);
+ const std::string kCheckInitData2 = "SELECT COUNT(*) FROM `_internal_data`";
+ CheckSelectQuery(kCheckInitData2, 0, 0);
+ // Act
+ EXPECT_TRUE(query_insert_resumption.Exec(kInsertInitData));
+
+ // Checks
+ CheckSelectQuery(kCheckInitData, 1, 0);
+ CheckSelectQuery(kCheckInitData2, 1, 0);
+
+ const std::string kCheckResumptionInitValue =
+ "SELECT last_ign_off_time FROM `resumption`";
+ CheckSelectQuery(kCheckResumptionInitValue, 0, 0);
+ const std::string kCheckInternalDataInitValue =
+ "SELECT db_version_hash FROM `_internal_data`";
+ CheckSelectQuery(kCheckInternalDataInitValue, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kChecksResumptionData_ExpectDataCorrect) {
+ // Arrange
+ CheckSelectQuery(kChecksResumptionData, 0, 0);
+ // Act
+ SQLQuery query_insert_resumption(db());
+ EXPECT_TRUE(query_insert_resumption.Exec(kInsertInitData));
+ // Check
+ CheckSelectQuery(kChecksResumptionData, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountHMILevel_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kSelectCountHMILevel, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectHMILevel_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kSelectHMILevel, p1, p2, hmiLevel, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kCheckHMIId_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ ValToPosPair p1(0, IntToString(hmiAppID));
+ ValToPosPair p2(1, "");
+ // Check
+ CheckSelectQuery(kCheckHMIId, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectHMIId_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kSelectHMIId, p1, p2, hmiAppID, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountHMIId_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kSelectCountHMIId, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kCountHashId_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kCountHashId, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectHashId_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kSelectHashId, p1, p2, test_hash, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectIgnOffTime_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery query_insert_init_data(db());
+ // Act
+ EXPECT_TRUE(query_insert_init_data.Exec(kInsertInitData));
+ // Check
+ CheckSelectQuery(kSelectIgnOffTime, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kCheckApplication_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kCheckApplication, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kCountApplications_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ key = FillImageTable(temp_query, 1, "tst_img2").LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash2,
+ hmiAppID2, hmiLevel2, ign_off_count, timeStamp2, false,
+ app_id2, device_id, key);
+ // Check
+ CheckSelectQuery(kCountApplications, 2, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kSelectDataForLoadResumeData_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ // Checks
+ CheckSelectQuery(kSelectDataForLoadResumeData, hmiLevel, 0);
+ CheckSelectQuery(kSelectDataForLoadResumeData, ign_off_count, 1);
+ CheckSelectQuery(kSelectDataForLoadResumeData, timeStamp, 2);
+ CheckSelectQuery(kSelectDataForLoadResumeData, app_id1, 3);
+ CheckSelectQuery(kSelectDataForLoadResumeData, device_id, 4);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kUpdateHMILevel_ExpectDataUpdated) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+ // Act
+ SQLQuery query_update_hmi_level(db());
+ EXPECT_TRUE(query_update_hmi_level.Prepare(kUpdateHMILevel));
+ query_update_hmi_level.Bind(0, hmiLevel2);
+ query_update_hmi_level.Bind(1, device_id);
+ query_update_hmi_level.Bind(2, app_id1);
+ EXPECT_TRUE(query_update_hmi_level.Exec());
+ ValToPosPair p1(0, device_id);
+ ValToPosPair p2(1, app_id1);
+ // Check
+ CheckSelectQuery(kSelectHMILevel, p1, p2, hmiLevel2, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kUpdateIgnOffCount_ExpectDataUpdated) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ const std::string kSelectIgnOffCount =
+ "SELECT ign_off_count FROM application;";
+ // Check before action
+ CheckSelectQuery(kSelectIgnOffCount, ign_off_count, 0);
+ SQLQuery query(db());
+ // Act
+ EXPECT_TRUE(query.Exec(resumption::kUpdateIgnOffCount));
+ // Check after action
+ CheckSelectQuery(kSelectIgnOffCount, ign_off_count - 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kCountApplicationsIgnOff_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash2,
+ hmiAppID2, hmiLevel2, ign_off_count2, timeStamp2, false,
+ app_id2, device_id, key);
+
+ ValToPosPair p1(0, IntToString(4));
+ ValToPosPair p2(1, "");
+ // Check
+ CheckSelectQuery(kCountApplicationsIgnOff, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kSelectApplicationsIgnOffCount_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key);
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash2,
+ hmiAppID2, hmiLevel2, ign_off_count2, timeStamp2, false,
+ app_id2, device_id, key);
+
+ ValToPosPair p1(0, IntToString(4));
+ ValToPosPair p2(1, "");
+
+ CheckSelectQuery(kSelectApplicationsIgnOffCount, p1, p2, device_id, 0);
+ CheckSelectQuery(kSelectApplicationsIgnOffCount, p1, p2, app_id2, 1);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kUpdateSuspendData_ExpectDataUpdated) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ FillApplicationTable(temp_query, 1, 1, test_hash, 111, 1, 3, 45127, false,
+ app_id1, device_id, key);
+
+ // Act
+ SQLQuery query_update_suspend_data(db());
+ EXPECT_TRUE(query_update_suspend_data.Exec(kUpdateSuspendData));
+ // Check
+ const std::string kSelectIgnOffCount =
+ "SELECT ign_off_count FROM `application`;";
+ CheckSelectQuery(kSelectIgnOffCount, 4, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, KUpdateLastIgnOffTime_ExpectDataUpdated) {
+ // Arrange
+ SQLQuery query_insert_init_data(db());
+ EXPECT_TRUE(query_insert_init_data.Exec(kInsertInitData));
+ // Check before action
+ CheckSelectQuery(kSelectIgnOffTime, 0, 0);
+ // Act
+ SQLQuery query_update_ign_off_time(db());
+ EXPECT_TRUE(query_update_ign_off_time.Prepare(KUpdateLastIgnOffTime));
+ query_update_ign_off_time.Bind(0, 1);
+ EXPECT_TRUE(query_update_ign_off_time.Exec());
+ // Check after action
+ CheckSelectQuery(kSelectIgnOffTime, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteFile_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+ int64_t key2 =
+ FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
+ FillApplicationFilesArrayTable(temp_query, key1, key2);
+ // Check before action
+ const std::string select_count_file = "SELECT COUNT(*) from `file` ";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_file, kDeleteFile, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteApplicationFilesArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+ int64_t key2 =
+ FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
+ FillApplicationFilesArrayTable(temp_query, key1, key2);
+ // Check
+ const std::string select_count_applicationsFilesArray =
+ "SELECT COUNT(*) from `applicationFilesArray` ";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_applicationsFilesArray,
+ kDeleteApplicationFilesArray, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteSubMenu_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ key = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key).LastInsertId();
+ int64_t submenu_key =
+ FillSubMenuTable(temp_query, 1, "tst_menuName", 2).LastInsertId();
+
+ FillApplicationSubMenuArrayTable(temp_query, key, submenu_key);
+ // Check
+ const std::string select_count_subMenu = "SELECT COUNT(*) FROM subMenu;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_subMenu, kDeleteSubMenu, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteApplicationSubMenuArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key).LastInsertId();
+ key = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key).LastInsertId();
+
+ int64_t submenu_key =
+ FillSubMenuTable(temp_query, 1, "tst_menuName", 2).LastInsertId();
+
+ FillApplicationSubMenuArrayTable(temp_query, key, submenu_key);
+ // Check
+ const std::string select_count_subMenu =
+ "SELECT COUNT(*) FROM applicationSubMenuArray;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_subMenu, kDeleteApplicationSubMenuArray, p1, p2,
+ 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteApplicationSubscribtionsArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+ int64_t key2 =
+ FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
+ key1 = FillApplicationFilesArrayTable(temp_query, key1, key2).LastInsertId();
+ FillAppSubscriptionsArrayTable(temp_query, 7, 2, key1);
+ // Check
+ const std::string select_count_applicationSubscribtionsArray =
+ "SELECT COUNT(*) FROM applicationSubscribtionsArray;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_applicationSubscribtionsArray,
+ kDeleteApplicationSubscribtionsArray, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteImageFromCommands_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
+ .LastInsertId();
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+ FillApplicationCommandsArrayTable(temp_query, key1, key2);
+ // Check before action
+ const std::string select_count_image = "SELECT COUNT(*) FROM image;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_image, kDeleteImageFromCommands, p1, p2, 1, 0,
+ 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteVrCommands_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
+ .LastInsertId();
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+
+ FillVRCommandsArrayTable(temp_query, "tst_vr_command", kVRCommandFromCommand,
+ key2);
+ FillApplicationCommandsArrayTable(temp_query, key1, key2);
+ // Check
+ const std::string select_count_vrCommandsArray =
+ "SELECT COUNT(*) FROM vrCommandsArray;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_vrCommandsArray, kDeleteVrCommands, p1, p2, 1,
+ 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteCommands_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
+ .LastInsertId();
+
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+
+ FillApplicationCommandsArrayTable(temp_query, key1, key2);
+ // Check
+ const std::string select_count_command = "SELECT COUNT(*) FROM command;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_command, kDeleteCommands, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteApplicationCommandsArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillCommandTable(temp_query, 1, "tst_menu_name", 1, 2, key1)
+ .LastInsertId();
+
+ key1 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+
+ FillApplicationCommandsArrayTable(temp_query, key1, key2);
+ // Check
+ const std::string select_count_applicationCommandsArray =
+ "SELECT COUNT(*) FROM applicationCommandsArray;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_applicationCommandsArray,
+ kDeleteApplicationCommandsArray, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteImageFromChoiceSet_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 =
+ FillChoiceTable(temp_query, 2, "tst_menu_name", "secondary_txt",
+ "tst_tert_text", key1).LastInsertId();
+ int64_t key3 =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, key1).LastInsertId();
+ int64_t key4 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
+ FillChoiceArrayTable(temp_query, key4, key2);
+ FillApplicationChoiceSetArrayTable(temp_query, key4, key3);
+
+ // Check
+ const std::string select_count_image = "SELECT COUNT(*) FROM image;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_image, kDeleteImageFromChoiceSet, p1, p2, 1, 0,
+ 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteVrCommandsFromChoiceSet_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillChoiceTable(temp_query, 1, "tst_menu_name", "second_text",
+ "tert_txt", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+
+ FillVRCommandsArrayTable(temp_query, "tst_vr_command", kVRCommandFromChoice,
+ key2);
+
+ int64_t key3 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
+
+ FillChoiceArrayTable(temp_query, key3, key2);
+ FillApplicationChoiceSetArrayTable(temp_query, key3, key1);
+ // Check before action
+ const std::string select_count_vrCommandsArray =
+ "SELECT COUNT(*) FROM vrCommandsArray;";
+ // Check
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_vrCommandsArray, kDeleteVrCommandsFromChoiceSet,
+ p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteChoice_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillChoiceTable(temp_query, 1, "tst_menu_name", "second_text",
+ "tert_txt", key1).LastInsertId();
+ key1 = FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp,
+ false, app_id2, device_id, key1).LastInsertId();
+ int64_t key3 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
+ FillChoiceArrayTable(temp_query, key3, key2);
+ FillApplicationChoiceSetArrayTable(temp_query, key3, key1);
+
+ // Check before action
+ const std::string select_count_choice = "SELECT COUNT(*) FROM choice;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_choice, kDeleteChoice, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteChoiceArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t choice_table_key =
+ FillChoiceTable(temp_query, 1, "tst_menu_name", "second_text", "tert_txt",
+ 0).LastInsertId();
+
+ int64_t application_choiceset_table_key =
+ FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
+ int64_t application_table_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, 1).LastInsertId();
+ FillApplicationChoiceSetArrayTable(
+ temp_query, application_choiceset_table_key, application_table_key);
+ FillChoiceArrayTable(temp_query, application_choiceset_table_key,
+ choice_table_key);
+ // Check
+ const std::string select_count_choice_array =
+ "SELECT COUNT(*) FROM choiceArray;";
+
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_choice_array, kDeleteChoiceArray, p1, p2, 1, 0,
+ 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteApplicationChoiceSet_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, 1).LastInsertId();
+
+ int64_t key2 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
+ FillApplicationChoiceSetArrayTable(temp_query, key2, key1);
+
+ // Check before action
+ const std::string select_count_applicationChoiceSet =
+ "SELECT COUNT(*) FROM applicationChoiceSet;";
+
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_applicationChoiceSet,
+ kDeleteApplicationChoiceSet, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteApplicationChoiceSetArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, 1).LastInsertId();
+
+ int64_t key2 = FillApplicationChoiceSetTable(temp_query, 1, 2).LastInsertId();
+ FillApplicationChoiceSetArrayTable(temp_query, key2, key1);
+
+ // Check
+ const std::string select_count_applicationChoiceSetArray =
+ "SELECT COUNT(*) FROM applicationChoiceSetArray;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_applicationChoiceSetArray,
+ kDeleteApplicationChoiceSetArray, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteImageFromGlobalProperties_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1,
+ 1, 2, "auto", key1).LastInsertId();
+ key1 = FillVRHelpItemTable(temp_query, "tst_text", 1, key1).LastInsertId();
+ FillVRHelpItemArrayTable(temp_query, key2, key1);
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, key2);
+ // Check
+ const std::string select_count_image = "SELECT COUNT(*) FROM image;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_image, kDeleteImageFromGlobalProperties, p1, p2,
+ 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeletevrHelpItem_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1,
+ 1, 2, "auto", key1).LastInsertId();
+ key1 = FillVRHelpItemTable(temp_query, "tst_text", 1, key1).LastInsertId();
+ FillVRHelpItemArrayTable(temp_query, key2, key1);
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, key2);
+ // Check
+ const std::string select_count_vrhelp_item =
+ "SELECT COUNT(*) FROM vrHelpItem;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_vrhelp_item, kDeletevrHelpItem, p1, p2, 1, 0,
+ 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeletevrHelpItemArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t key1 = FillImageTable(temp_query, 1, test_image).LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1,
+ 1, 2, "auto", key1).LastInsertId();
+ key1 = FillVRHelpItemTable(temp_query, "tst_text", 1, key1).LastInsertId();
+ FillVRHelpItemArrayTable(temp_query, key2, key1);
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id, key2);
+ // Check
+ const std::string select_count_vrhelp_item_array =
+ "SELECT COUNT(*) FROM vrHelpItemArray;";
+ ValToPosPair p1(0, app_id2);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_vrhelp_item_array, kDeletevrHelpItemArray, p1,
+ p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteTableLimitedCharacterList_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ string character_list = "abcdefghij";
+ int64_t key1 = FillTableLimitedCharacterListTable(temp_query, character_list)
+ .LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1,
+ 1, 2, "auto", 0).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key2);
+ FillCharacterArrayTable(temp_query, key2, key1);
+ // Check
+ const std::string select_count_tableLimitedCharacterList =
+ "SELECT COUNT(*) FROM tableLimitedCharacterList;";
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_tableLimitedCharacterList,
+ kDeleteTableLimitedCharacterList, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteCharacterArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ string character_list = "abcdefghij";
+ int64_t key1 = FillTableLimitedCharacterListTable(temp_query, character_list)
+ .LastInsertId();
+ int64_t key2 = FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1,
+ 1, 2, "auto", 0).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, key2);
+ FillCharacterArrayTable(temp_query, key2, key1);
+ // Check
+ const std::string select_count_characterArray =
+ "SELECT COUNT(*) FROM characterArray;";
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_characterArray, kDeleteCharacterArray, p1, p2,
+ 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteTTSChunk_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t tts_chunk_key =
+ FillTTSChunkTable(temp_query, 1, "tst_text").LastInsertId();
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", 0).LastInsertId();
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, glob_prop_key);
+
+ FillHelpTimeoutPromptArrayTable(temp_query, glob_prop_key, tts_chunk_key, 1);
+ // Check
+ const std::string select_count_tts_chunk = "SELECT COUNT(*) FROM TTSChunk;";
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_tts_chunk, kDeleteTTSChunk, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteFromApplicationTable_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 1);
+ // Check
+ const std::string select_count_application =
+ "SELECT COUNT(*) FROM application;";
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_application, kDeleteFromApplicationTable, p1,
+ p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kDeleteHelpTimeoutPromptArray_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t tts_chunk_key =
+ FillTTSChunkTable(temp_query, 1, "tst_text").LastInsertId();
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", 0).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, glob_prop_key);
+
+ FillHelpTimeoutPromptArrayTable(temp_query, glob_prop_key, tts_chunk_key, 1);
+ // Check
+ const std::string select_count_helpTimeoutPromptArray =
+ "SELECT COUNT(*) FROM helpTimeoutPromptArray;";
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_helpTimeoutPromptArray,
+ kDeleteHelpTimeoutPromptArray, p1, p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kDeleteGlobalProperties_ExpectDataDeleted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "vrHelp", "menuTitle", 1, 1, 2,
+ "auto", 0).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, glob_prop_key);
+ // Check
+ const std::string select_count_globalProperties =
+ "SELECT COUNT(*) FROM globalProperties;";
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckDeleteQuery(select_count_globalProperties, kDeleteGlobalProperties, p1,
+ p2, 1, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountImage_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillImageTable(temp_query, 2, "tst_image");
+ ValToPosPair p1(0, "tst_image");
+ ValToPosPair p2(1, "");
+ // Check
+ CheckSelectQuery(kSelectCountImage, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectPrimaryKeyImage_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+ ValToPosPair p1(0, "tst_image");
+ ValToPosPair p2(1, "");
+ // Check
+ CheckSelectQuery(kSelectPrimaryKeyImage, p1, p2, image_key, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertImage_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillImageTable(temp_query, 2, "tst_image");
+ const std::string select_count_image = "SELECT COUNT(*) FROM image;";
+ // Check
+ CheckSelectQuery(select_count_image, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertToFile_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillFileTable(temp_query, 1, true, true, "tst_file_name");
+ // Check
+ const std::string select_count_file = "SELECT COUNT(*) FROM file;";
+ CheckSelectQuery(select_count_file, 1, 0);
+ const std::string select_file_name = "SELECT syncFileName FROM file;";
+ CheckSelectQuery(select_file_name, "tst_file_name", 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertToApplicationFilesArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationFilesArrayTable(temp_query, 1, 2);
+ // Checks
+ const std::string select_count_applicationFilesArray =
+ "SELECT COUNT(*) FROM applicationFilesArray;";
+ CheckSelectQuery(select_count_applicationFilesArray, 1, 0);
+ const std::string select_idApplication =
+ "SELECT idApplication FROM applicationFilesArray;";
+ CheckSelectQuery(select_idApplication, 1, 0);
+ const std::string select_idfile = "SELECT idfile FROM applicationFilesArray;";
+ CheckSelectQuery(select_idfile, 2, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertToSubMenu_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillSubMenuTable(temp_query, 1, "tst_menu", 3);
+ // Checks
+ const std::string select_count_subMenu = "SELECT COUNT(*) FROM subMenu;";
+ CheckSelectQuery(select_count_subMenu, 1, 0);
+ const std::string select_menuID = "SELECT menuID FROM subMenu;";
+ CheckSelectQuery(select_menuID, 1, 0);
+ const std::string select_menuName = "SELECT menuName FROM subMenu;";
+ CheckSelectQuery(select_menuName, "tst_menu", 0);
+ const std::string select_position = "SELECT position FROM subMenu;";
+ CheckSelectQuery(select_position, 3, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertToApplicationSubMenuArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationSubMenuArrayTable(temp_query, 2, 5);
+ // Checks
+ const std::string select_count_applicationFilesArray =
+ "SELECT COUNT(*) FROM applicationSubMenuArray;";
+ CheckSelectQuery(select_count_applicationFilesArray, 1, 0);
+ const std::string select_idApplication =
+ "SELECT idApplication FROM applicationSubMenuArray;";
+ CheckSelectQuery(select_idApplication, 2, 0);
+ const std::string select_idsubMenu =
+ "SELECT idsubMenu FROM applicationSubMenuArray;";
+ CheckSelectQuery(select_idsubMenu, 5, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertToCommand_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillCommandTable(temp_query, 1, "tst_menu", 1, 2, 5);
+ // Checks
+ const std::string select_count_command = "SELECT COUNT(*) FROM command;";
+ CheckSelectQuery(select_count_command, 1, 0);
+ const std::string select_cmdID = "SELECT cmdID FROM command;";
+ CheckSelectQuery(select_cmdID, 1, 0);
+ const std::string select_menuName = "SELECT menuName FROM command;";
+ CheckSelectQuery(select_menuName, "tst_menu", 0);
+ const std::string select_parentID = "SELECT parentID FROM command;";
+ CheckSelectQuery(select_parentID, 1, 0);
+ const std::string select_position = "SELECT position FROM command;";
+ CheckSelectQuery(select_position, 2, 0);
+ const std::string select_idimage = "SELECT idimage FROM command;";
+ CheckSelectQuery(select_idimage, 5, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertApplicationCommandArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationCommandsArrayTable(temp_query, 3, 7);
+ // Checks
+ const std::string select_count_applicationCommandsArray =
+ "SELECT COUNT(*) FROM applicationCommandsArray;";
+ CheckSelectQuery(select_count_applicationCommandsArray, 1, 0);
+ const std::string select_idApplication =
+ "SELECT idApplication FROM applicationCommandsArray;";
+ CheckSelectQuery(select_idApplication, 3, 0);
+ const std::string select_idcommand =
+ "SELECT idcommand FROM applicationCommandsArray;";
+ CheckSelectQuery(select_idcommand, 7, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertVrCommandFromChoice_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillVRCommandsArrayTable(temp_query, "vr_cmd", kVRCommandFromChoice, 8);
+ // Checks
+ const std::string select_count_vrCommandsArray =
+ "SELECT COUNT(*) FROM vrCommandsArray;";
+ CheckSelectQuery(select_count_vrCommandsArray, 1, 0);
+ const std::string select_vrCommand = "SELECT vrCommand FROM vrCommandsArray;";
+ CheckSelectQuery(select_vrCommand, "vr_cmd", 0);
+ const std::string select_idcommand = "SELECT idcommand FROM vrCommandsArray;";
+ CheckSelectQuery(select_idcommand, 0, 0);
+ const std::string select_idchoice = "SELECT idchoice FROM vrCommandsArray;";
+ CheckSelectQuery(select_idchoice, 8, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertVrCommandFromCommand_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillVRCommandsArrayTable(temp_query, "vr_cmd", kVRCommandFromCommand, 9);
+ // Checks
+ const std::string select_count_vrCommandsArray =
+ "SELECT COUNT(*) FROM vrCommandsArray;";
+ CheckSelectQuery(select_count_vrCommandsArray, 1, 0);
+ const std::string select_vrCommand = "SELECT vrCommand FROM vrCommandsArray;";
+ CheckSelectQuery(select_vrCommand, "vr_cmd", 0);
+ const std::string select_idcommand = "SELECT idcommand FROM vrCommandsArray;";
+ CheckSelectQuery(select_idcommand, 9, 0);
+ const std::string select_idchoice = "SELECT idchoice FROM vrCommandsArray;";
+ CheckSelectQuery(select_idchoice, 0, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertSubscriptions_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillAppSubscriptionsArrayTable(temp_query, 2, 3, 4);
+ // Checks
+ const std::string select_count_applicationSubscribtionsArray =
+ "SELECT COUNT(*) FROM applicationSubscribtionsArray;";
+ CheckSelectQuery(select_count_applicationSubscribtionsArray, 1, 0);
+ const std::string select_idApplication =
+ "SELECT idApplication FROM applicationSubscribtionsArray;";
+ CheckSelectQuery(select_idApplication, 4, 0);
+ const std::string select_vehicleValue =
+ "SELECT vehicleValue FROM applicationSubscribtionsArray;";
+ CheckSelectQuery(select_vehicleValue, 2, 0);
+ const std::string select_ButtonNameValue =
+ "SELECT ButtonNameValue FROM applicationSubscribtionsArray;";
+ CheckSelectQuery(select_ButtonNameValue, 3, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertChoice_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillChoiceTable(temp_query, 1, "tst_menu", "second_text", "tert_txt", 5);
+ // Checks
+ const std::string select_count_choice = "SELECT COUNT(*) FROM choice;";
+ CheckSelectQuery(select_count_choice, 1, 0);
+
+ const std::string select_choiceID = "SELECT choiceID FROM choice;";
+ CheckSelectQuery(select_choiceID, 1, 0);
+ const std::string select_menuName = "SELECT menuName FROM choice;";
+ CheckSelectQuery(select_menuName, "tst_menu", 0);
+ const std::string select_secondaryText = "SELECT secondaryText FROM choice;";
+ CheckSelectQuery(select_secondaryText, "second_text", 0);
+ const std::string select_tertiaryText = "SELECT tertiaryText FROM choice;";
+ CheckSelectQuery(select_tertiaryText, "tert_txt", 0);
+ const std::string select_idimage = "SELECT idimage FROM choice;";
+ CheckSelectQuery(select_idimage, 5, 0);
+ const std::string select_idsecondaryImage =
+ "SELECT idsecondaryImage FROM choice;";
+ CheckSelectQuery(select_idsecondaryImage, 5, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertApplicationChoiceSet_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationChoiceSetTable(temp_query, 7, 12);
+ // Checks
+ const std::string select_count_applicationChoiceSet =
+ "SELECT COUNT(*) FROM applicationChoiceSet;";
+ CheckSelectQuery(select_count_applicationChoiceSet, 1, 0);
+
+ const std::string select_grammarID =
+ "SELECT grammarID FROM applicationChoiceSet;";
+ CheckSelectQuery(select_grammarID, 7, 0);
+ const std::string select_interactionChoiceSetID =
+ "SELECT interactionChoiceSetID FROM applicationChoiceSet;";
+ CheckSelectQuery(select_interactionChoiceSetID, 12, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertChoiceArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillChoiceArrayTable(temp_query, 3, 5);
+ // Checks
+ const std::string select_count_choiceArray =
+ "SELECT COUNT(*) FROM choiceArray;";
+ CheckSelectQuery(select_count_choiceArray, 1, 0);
+ const std::string select_idapplicationChoiceSet =
+ "SELECT idapplicationChoiceSet FROM choiceArray;";
+ CheckSelectQuery(select_idapplicationChoiceSet, 3, 0);
+ const std::string select_idchoice = "SELECT idchoice FROM choiceArray;";
+ CheckSelectQuery(select_idchoice, 5, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertApplicationChoiceSetArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationChoiceSetArrayTable(temp_query, 3, 5);
+ // Checks
+ const std::string select_count_applicationChoiceSetArray =
+ "SELECT COUNT(*) FROM applicationChoiceSetArray;";
+ CheckSelectQuery(select_count_applicationChoiceSetArray, 1, 0);
+ const std::string select_idapplicationChoiceSet =
+ "SELECT idapplicationChoiceSet FROM applicationChoiceSetArray;";
+ CheckSelectQuery(select_idapplicationChoiceSet, 3, 0);
+ const std::string select_idApplication =
+ "SELECT idApplication FROM applicationChoiceSetArray;";
+ CheckSelectQuery(select_idApplication, 5, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertGlobalProperties_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillGlobalPropertiesTable(temp_query, "vr_title", "menu_title", 2, 1, 3,
+ "auto", 7);
+ // Checks
+ const std::string select_count_globalProperties =
+ "SELECT COUNT(*) FROM globalProperties;";
+ CheckSelectQuery(select_count_globalProperties, 1, 0);
+ const std::string select_vrHelpTitle =
+ "SELECT vrHelpTitle FROM globalProperties;";
+ CheckSelectQuery(select_vrHelpTitle, "vr_title", 0);
+ const std::string select_menuTitle =
+ "SELECT menuTitle FROM globalProperties;";
+ CheckSelectQuery(select_menuTitle, "menu_title", 0);
+ const std::string select_idmenuIcon =
+ "SELECT idmenuIcon FROM globalProperties;";
+ CheckSelectQuery(select_idmenuIcon, 7, 0);
+ const std::string select_language = "SELECT language FROM globalProperties;";
+ CheckSelectQuery(select_language, 2, 0);
+ const std::string select_keyboardLayout =
+ "SELECT keyboardLayout FROM globalProperties;";
+ CheckSelectQuery(select_keyboardLayout, 1, 0);
+ const std::string select_keypressMode =
+ "SELECT keypressMode FROM globalProperties;";
+ CheckSelectQuery(select_keypressMode, 3, 0);
+ const std::string select_autoCompleteText =
+ "SELECT autoCompleteText FROM globalProperties;";
+ CheckSelectQuery(select_autoCompleteText, "auto", 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertTableLimitedCharacter_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ string character_list = "abcdefghijkl";
+ FillTableLimitedCharacterListTable(temp_query, character_list);
+ // Checks
+ const std::string select_count_tableLimitedCharacterList =
+ "SELECT COUNT(*) FROM tableLimitedCharacterList;";
+ CheckSelectQuery(select_count_tableLimitedCharacterList, 1, 0);
+ const std::string select_limitedCharacterList =
+ "SELECT limitedCharacterList FROM tableLimitedCharacterList;";
+ CheckSelectQuery(select_limitedCharacterList, character_list, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertCharacterArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillCharacterArrayTable(temp_query, 2, 4);
+ // Checks
+ const std::string select_count_characterArray =
+ "SELECT COUNT(*) FROM characterArray;";
+ CheckSelectQuery(select_count_characterArray, 1, 0);
+ const std::string select_idglobalProperties =
+ "SELECT idglobalProperties FROM characterArray;";
+ CheckSelectQuery(select_idglobalProperties, 2, 0);
+ const std::string select_idtableLimitedCharacterList =
+ "SELECT idtableLimitedCharacterList FROM characterArray;";
+ CheckSelectQuery(select_idtableLimitedCharacterList, 4, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertVRHelpItem_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillVRHelpItemTable(temp_query, "tst_txt", 1, 3);
+ // Checks
+ const std::string select_count_vrHelpItem =
+ "SELECT COUNT(*) FROM vrHelpItem;";
+ CheckSelectQuery(select_count_vrHelpItem, 1, 0);
+ const std::string select_text = "SELECT text FROM vrHelpItem;";
+ CheckSelectQuery(select_text, "tst_txt", 0);
+ const std::string select_position = "SELECT position FROM vrHelpItem;";
+ CheckSelectQuery(select_position, 1, 0);
+ const std::string select_idimage = "SELECT idimage FROM vrHelpItem;";
+ CheckSelectQuery(select_idimage, 3, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertVRHelpItemArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillVRHelpItemArrayTable(temp_query, 4, 5);
+ // Checks
+ const std::string select_count_vrHelpItemArray =
+ "SELECT COUNT(*) FROM vrHelpItemArray;";
+ CheckSelectQuery(select_count_vrHelpItemArray, 1, 0);
+ const std::string select_idglobalProperties =
+ "SELECT idglobalProperties FROM vrHelpItemArray;";
+ CheckSelectQuery(select_idglobalProperties, 4, 0);
+ const std::string select_idvrHelpItem =
+ "SELECT idvrHelpItem FROM vrHelpItemArray;";
+ CheckSelectQuery(select_idvrHelpItem, 5, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kInsertHelpTimeoutPromptArray_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillHelpTimeoutPromptArrayTable(temp_query, 1, 2, 3);
+ // Checks
+ const std::string select_count_helpTimeoutPromptArray =
+ "SELECT COUNT(*) FROM helpTimeoutPromptArray;";
+ CheckSelectQuery(select_count_helpTimeoutPromptArray, 1, 0);
+ const std::string select_idglobalProperties =
+ "SELECT idglobalProperties FROM helpTimeoutPromptArray;";
+ CheckSelectQuery(select_idglobalProperties, 1, 0);
+ const std::string select_idtimeoutPrompt =
+ "SELECT idtimeoutPrompt FROM helpTimeoutPromptArray;";
+ CheckSelectQuery(select_idtimeoutPrompt, 2, 0);
+ const std::string select_idhelpPrompt =
+ "SELECT idhelpPrompt FROM helpTimeoutPromptArray;";
+ CheckSelectQuery(select_idhelpPrompt, 3, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertTTSChunk_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillTTSChunkTable(temp_query, 2, "text");
+ // Checks
+ const std::string select_count_kInsertTTSChunk =
+ "SELECT COUNT(*) FROM TTSChunk;";
+ CheckSelectQuery(select_count_kInsertTTSChunk, 1, 0);
+ const std::string select_type = "SELECT type FROM TTSChunk;";
+ CheckSelectQuery(select_type, 2, 0);
+ const std::string select_text = "SELECT text FROM TTSChunk;";
+ CheckSelectQuery(select_text, "text", 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kInsertApplication_ExpectDataInserted) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9);
+ // Checks
+ const std::string select_count_application =
+ "SELECT COUNT(*) FROM application;";
+ CheckSelectQuery(select_count_application, 1, 0);
+
+ const std::string select_connection_key =
+ "SELECT connection_key FROM application;";
+ CheckSelectQuery(select_connection_key, connection_key, 0);
+ const std::string select_grammarID = "SELECT grammarID FROM application;";
+ CheckSelectQuery(select_grammarID, grammarID, 0);
+ const std::string select_hashID = "SELECT hashID FROM application;";
+ CheckSelectQuery(select_hashID, test_hash, 0);
+ const std::string select_hmiAppID = "SELECT hmiAppID FROM application;";
+ CheckSelectQuery(select_hmiAppID, hmiAppID, 0);
+ const std::string select_hmiLevel = "SELECT hmiLevel FROM application;";
+ CheckSelectQuery(select_hmiLevel, hmiLevel, 0);
+ const std::string select_ign_off_count =
+ "SELECT ign_off_count FROM application;";
+ CheckSelectQuery(select_ign_off_count, ign_off_count, 0);
+ const std::string select_timeStamp = "SELECT timeStamp FROM application;";
+ CheckSelectQuery(select_timeStamp, timeStamp, 0);
+ const std::string select_idglobalProperties =
+ "SELECT idglobalProperties FROM application;";
+ CheckSelectQuery(select_idglobalProperties, 9, 0);
+ const std::string select_isMediaApplication =
+ "SELECT isMediaApplication FROM application;";
+ CheckSelectQuery(select_isMediaApplication, false, 0);
+ const std::string select_appID = "SELECT appID FROM application;";
+ CheckSelectQuery(select_appID, app_id1, 0);
+ const std::string select_deviceID = "SELECT deviceID FROM application;";
+ CheckSelectQuery(select_deviceID, device_id, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountFiles_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t file_key =
+ FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
+ FillApplicationFilesArrayTable(temp_query, app_key, file_key);
+
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectCountFiles, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectFiles_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t file_key =
+ FillFileTable(temp_query, 1, true, true, "tst_name").LastInsertId();
+ FillApplicationFilesArrayTable(temp_query, app_key, file_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectFiles, p1, p2, 1, 0);
+ CheckSelectQuery(kSelectFiles, p1, p2, true, 1);
+ CheckSelectQuery(kSelectFiles, p1, p2, true, 2);
+ CheckSelectQuery(kSelectFiles, p1, p2, "tst_name", 3);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountSubMenu_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t submenu_key =
+ FillSubMenuTable(temp_query, 1, "menu_name", 1).LastInsertId();
+ FillApplicationSubMenuArrayTable(temp_query, app_key, submenu_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectCountSubMenu, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectSubMenu_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t submenu_key =
+
+ FillSubMenuTable(temp_query, 1, "menu_name", 1).LastInsertId();
+
+ FillApplicationSubMenuArrayTable(temp_query, app_key, submenu_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectSubMenu, p1, p2, 1, 0);
+ CheckSelectQuery(kSelectSubMenu, p1, p2, "menu_name", 1);
+ CheckSelectQuery(kSelectSubMenu, p1, p2, 1, 2);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountCommands_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t command_key =
+ FillCommandTable(temp_query, 1, "menu_name", 1, 2, 5).LastInsertId();
+ FillApplicationCommandsArrayTable(temp_query, app_key, command_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectCountCommands, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCommandsFromCommand_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+
+ FillChoiceTable(temp_query, 1, "menu_name", "sec_text", "tert_text",
+ image_key).LastInsertId();
+ int64_t command_key = FillCommandTable(temp_query, 1, "menu_name", 1, 2,
+ image_key).LastInsertId();
+
+ FillApplicationCommandsArrayTable(temp_query, app_key, command_key);
+ FillVRCommandsArrayTable(temp_query, "best", kVRCommandFromCommand,
+ command_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectCommands, p1, p2, 1, 0);
+ CheckSelectQuery(kSelectCommands, p1, p2, 1, 1);
+ CheckSelectQuery(kSelectCommands, p1, p2, "menu_name", 2);
+ CheckSelectQuery(kSelectCommands, p1, p2, 1, 3);
+ CheckSelectQuery(kSelectCommands, p1, p2, 2, 4);
+ CheckSelectQuery(kSelectCommands, p1, p2, "tst_image", 5);
+ CheckSelectQuery(kSelectCommands, p1, p2, 2, 6);
+ CheckSelectQuery(kSelectCommands, p1, p2, "best", 7);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCommandsFromChoice_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+
+ int64_t choice_key = FillChoiceTable(temp_query, 1, "menu_name", "sec_text",
+ "tert_text", image_key).LastInsertId();
+ int64_t command_key = FillCommandTable(temp_query, 1, "menu_name", 1, 2,
+ image_key).LastInsertId();
+
+ FillApplicationCommandsArrayTable(temp_query, app_key, command_key);
+ FillVRCommandsArrayTable(temp_query, "best", kVRCommandFromChoice,
+ choice_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ const std::string kChecksVrCommandFromSelectCommand =
+ "SELECT COUNT(*) FROM (SELECT `command`.`idcommand`, `cmdID`, "
+ "`menuName`, `parentID`, `position`, `value`, `imageType`, `vrCommand` "
+ "FROM `command` LEFT OUTER JOIN `image` on `command`.`idimage` = "
+ "`image`.`idimage` "
+ "LEFT OUTER JOIN `vrcommandsarray` on `command`.`idcommand` = "
+ "`vrcommandsarray`.`idcommand` "
+ "WHERE `command`.`idcommand` IN (SELECT `idcommand` "
+ "FROM `applicationCommandsArray` "
+ "WHERE `idApplication` = (SELECT `idApplication` "
+ "FROM `application` WHERE `appID` = ? AND `deviceID` = ?))) "
+ "WHERE vrCommand IS NULL";
+ // Check
+ CheckSelectQuery(kSelectCommands, p1, p2, 1, 0);
+ CheckSelectQuery(kSelectCommands, p1, p2, 1, 1);
+ CheckSelectQuery(kSelectCommands, p1, p2, "menu_name", 2);
+ CheckSelectQuery(kSelectCommands, p1, p2, 1, 3);
+ CheckSelectQuery(kSelectCommands, p1, p2, 2, 4);
+ CheckSelectQuery(kSelectCommands, p1, p2, "tst_image", 5);
+ CheckSelectQuery(kSelectCommands, p1, p2, 2, 6);
+ CheckSelectQuery(kChecksVrCommandFromSelectCommand, p1, p2, true, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountSubscriptions_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ FillAppSubscriptionsArrayTable(temp_query, 2, 3, app_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectCountSubscriptions, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectSubscriptions_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ FillAppSubscriptionsArrayTable(temp_query, 2, 3, app_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectSubscriptions, p1, p2, 2, 0);
+ CheckSelectQuery(kSelectSubscriptions, p1, p2, 3, 1);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCountChoiceSet_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ FillApplicationChoiceSetArrayTable(temp_query, 2, app_key);
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectCountChoiceSet, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectChoiceSets_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t app_key =
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 9).LastInsertId();
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+ int64_t choice_key = FillChoiceTable(temp_query, 1, "menu_name", "sec_text",
+ "tert_text", image_key).LastInsertId();
+ int64_t app_choice_set_key =
+ FillApplicationChoiceSetTable(temp_query, 23, 2).LastInsertId();
+
+ FillChoiceArrayTable(temp_query, app_choice_set_key, choice_key);
+ FillApplicationChoiceSetArrayTable(temp_query, app_choice_set_key, app_key);
+ FillVRCommandsArrayTable(temp_query, "best", kVRCommandFromChoice,
+ choice_key);
+
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Check
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 1, 0);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 23, 1);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 2, 2);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 1, 3);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 1, 4);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, "menu_name", 5);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, "sec_text", 6);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, "tert_text", 7);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 1, 8);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, 1, 9);
+ CheckSelectQuery(kSelectChoiceSets, p1, p2, "best", 10);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectImage_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+ // Check
+ ValToPosPair p1(0, IntToString(image_key));
+ ValToPosPair p2(1, "");
+ CheckSelectQuery(kSelectImage, p1, p2, 2, 0);
+ CheckSelectQuery(kSelectImage, p1, p2, "tst_image", 1);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kSelectCountGlobalProperties_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "tst_vr_title", "tst_menu", 2, 3, 3,
+ "auto", 5).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, glob_prop_key).LastInsertId();
+
+ // Check
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckSelectQuery(kSelectCountGlobalProperties, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectGlobalProperties_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "tst_vr_title", "tst_menu", 2, 3, 3,
+ "auto", image_key).LastInsertId();
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, glob_prop_key).LastInsertId();
+ FillHelpTimeoutPromptArrayTable(temp_query, glob_prop_key, 3, 7);
+
+ // Check
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, glob_prop_key, 0);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, "tst_vr_title", 1);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, "tst_menu", 2);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, 1, 3);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, 2, 4);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, 3, 5);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, 3, 6);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, "auto", 7);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, 7, 8);
+ CheckSelectQuery(kSelectGlobalProperties, p1, p2, 3, 9);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kChecksVrHelpItem_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "tst_vr_title", "tst_menu", 2, 3, 3,
+ "auto", image_key).LastInsertId();
+ int64_t vr_help_item_key =
+ FillVRHelpItemTable(temp_query, "tst_text", 2, image_key).LastInsertId();
+ FillVRHelpItemArrayTable(temp_query, glob_prop_key, vr_help_item_key);
+ // Check
+ ValToPosPair p1(0, IntToString(glob_prop_key));
+ ValToPosPair p2(1, "");
+ CheckSelectQuery(kChecksVrHelpItem, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectVrHelpItem_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t image_key = FillImageTable(temp_query, 2, "tst_image").LastInsertId();
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "tst_vr_title", "tst_menu", 2, 3, 3,
+ "auto", image_key).LastInsertId();
+ int64_t vr_help_item_key =
+ FillVRHelpItemTable(temp_query, "tst_text", 2, image_key).LastInsertId();
+ FillVRHelpItemArrayTable(temp_query, glob_prop_key, vr_help_item_key);
+ // Check
+ ValToPosPair p1(0, IntToString(glob_prop_key));
+ ValToPosPair p2(1, "");
+ CheckSelectQuery(kSelectVrHelpItem, p1, p2, "tst_text", 0);
+ CheckSelectQuery(kSelectVrHelpItem, p1, p2, 2, 1);
+ CheckSelectQuery(kSelectVrHelpItem, p1, p2, 2, 2);
+ CheckSelectQuery(kSelectVrHelpItem, p1, p2, "tst_image", 3);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kChecksCharacter_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "tst_vr_title", "tst_menu", 2, 3, 3,
+ "auto", 2).LastInsertId();
+ string character_list = "abcdefghijkl";
+ int64_t lim_char_list_key = FillTableLimitedCharacterListTable(
+ temp_query, character_list).LastInsertId();
+ FillCharacterArrayTable(temp_query, glob_prop_key, lim_char_list_key);
+ // Check
+ ValToPosPair p1(0, IntToString(glob_prop_key));
+ ValToPosPair p2(1, "");
+ CheckSelectQuery(kChecksCharacter, p1, p2, 1, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectCharacter_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t glob_prop_key =
+ FillGlobalPropertiesTable(temp_query, "tst_vr_title", "tst_menu", 2, 3, 3,
+ "auto", 2).LastInsertId();
+ string character_list = "abcdefghijkl";
+ int64_t lim_char_list_key = FillTableLimitedCharacterListTable(
+ temp_query, character_list).LastInsertId();
+ FillCharacterArrayTable(temp_query, glob_prop_key, lim_char_list_key);
+ // Check
+ ValToPosPair p1(0, IntToString(glob_prop_key));
+ ValToPosPair p2(1, "");
+ CheckSelectQuery(kSelectCharacter, p1, p2, character_list, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectAllApps_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 1);
+
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id2, device_id2, 2);
+ // Checks
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Prepare(kSelectAllApps) && query.Exec());
+ EXPECT_EQ(app_id1, query.GetString(0));
+ EXPECT_EQ(device_id, query.GetString(1));
+ EXPECT_TRUE(query.Next());
+ EXPECT_EQ(app_id2, query.GetString(0));
+ EXPECT_EQ(device_id2, query.GetString(1));
+}
+
+TEST_F(ResumptionSqlQueriesTest, kUpdateApplicationData_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, false,
+ app_id1, device_id, 1);
+ string select_hmi_level_and_time_stamp =
+ "SELECT `hmiLevel`, `timeStamp`FROM `application` "
+ "WHERE `appID` = ? AND `deviceID` = ?;";
+
+ // Checks before action
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ CheckSelectQuery(select_hmi_level_and_time_stamp, p1, p2, hmiLevel, 0);
+ CheckSelectQuery(select_hmi_level_and_time_stamp, p1, p2, timeStamp, 1);
+ // Act
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Prepare(kUpdateApplicationData));
+ query.Bind(0, 2);
+ query.Bind(1, 2016);
+ query.Bind(2, app_id1);
+ query.Bind(3, device_id);
+ EXPECT_TRUE(query.Exec());
+ // Checks after action
+ CheckSelectQuery(select_hmi_level_and_time_stamp, p1, p2, 2, 0);
+ CheckSelectQuery(select_hmi_level_and_time_stamp, p1, p2, 2016, 1);
+}
+
+TEST_F(ResumptionSqlQueriesTest,
+ kUpdateDBVersion_kSelectDBVersion_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ EXPECT_TRUE(temp_query.Exec(kInsertInitData));
+ // Checks before action
+ CheckSelectQuery(kSelectDBVersion, 0, 0);
+ // Act
+ SQLQuery query(db());
+ EXPECT_TRUE(query.Prepare(kUpdateDBVersion));
+ query.Bind(0, 2);
+ EXPECT_TRUE(query.Exec());
+ // Checks after action
+ CheckSelectQuery(kSelectDBVersion, 2, 0);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectTTSChunk_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ int64_t tts_chunk_key =
+ FillTTSChunkTable(temp_query, 2, "tst_txt").LastInsertId();
+ ValToPosPair p1(0, IntToString(tts_chunk_key));
+ ValToPosPair p2(1, "");
+ // Checks
+ CheckSelectQuery(kSelectTTSChunk, p1, p2, "tst_txt", 0);
+ CheckSelectQuery(kSelectTTSChunk, p1, p2, 2, 1);
+}
+
+TEST_F(ResumptionSqlQueriesTest, kSelectAppTable_ExpectDataCorrect) {
+ // Arrange
+ SQLQuery temp_query(db());
+ FillApplicationTable(temp_query, connection_key, grammarID, test_hash,
+ hmiAppID, hmiLevel, ign_off_count, timeStamp, true,
+ app_id1, device_id, 1);
+
+ ValToPosPair p1(0, app_id1);
+ ValToPosPair p2(1, device_id);
+ // Checks
+ CheckSelectQuery(kSelectAppTable, p1, p2, app_id1, 0);
+ CheckSelectQuery(kSelectAppTable, p1, p2, connection_key, 1);
+ CheckSelectQuery(kSelectAppTable, p1, p2, grammarID, 2);
+ CheckSelectQuery(kSelectAppTable, p1, p2, test_hash, 3);
+ CheckSelectQuery(kSelectAppTable, p1, p2, hmiAppID, 4);
+ CheckSelectQuery(kSelectAppTable, p1, p2, hmiLevel, 5);
+ CheckSelectQuery(kSelectAppTable, p1, p2, ign_off_count, 6);
+ CheckSelectQuery(kSelectAppTable, p1, p2, timeStamp, 7);
+ CheckSelectQuery(kSelectAppTable, p1, p2, device_id, 8);
+ CheckSelectQuery(kSelectAppTable, p1, p2, true, 9);
+}
+
+} // namespace test
+} // namespace resumption
diff --git a/src/components/application_manager/test/sdl_preloaded_pt.json b/src/components/application_manager/test/sdl_preloaded_pt.json
new file mode 100644
index 0000000000..d6f34c12fc
--- /dev/null
+++ b/src/components/application_manager/test/sdl_preloaded_pt.json
@@ -0,0 +1,1944 @@
+ {
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-02-12",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 70,
+ "seconds_between_retries": [1,
+ 5,
+ 25,
+ 125,
+ 625],
+ "endpoints": {
+ "0x07": {
+ "default": ["http://policies.telematics.ford.com/api/policies"]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.019",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?"
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?"
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push"
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["Base-4"],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["DataConsent-2"]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"],
+ "RequestType": ["HTTP"]
+ }
+ }
+ }
+ }
diff --git a/src/components/application_manager/test/sdl_pt_update.json b/src/components/application_manager/test/sdl_pt_update.json
new file mode 100644
index 0000000000..a332f92382
--- /dev/null
+++ b/src/components/application_manager/test/sdl_pt_update.json
@@ -0,0 +1,1722 @@
+{
+ "policy_table" : {
+ "app_policies" : {
+ "1766825573" : {
+ "AppHMIType" : [ "MEDIA" ],
+ "certificate" : "akdjfhaliuygrglurng",
+ "default_hmi" : "BACKGROUND",
+ "groups" : [
+ "Notifications",
+ "Location-1",
+ "PropriataryData-1",
+ "Navigation-1",
+ "Base-4",
+ "VehicleInfo-3",
+ "DrivingCharacteristics-3",
+ "Emergency-1"
+ ],
+ "keep_context" : true,
+ "memory_kb" : 1000,
+ "nicknames" : [ "SyncProxyTester" ],
+ "priority" : "EMERGENCY",
+ "steal_focus" : true,
+ "watchdog_timer_ms" : 20000
+ },
+ "default" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false,
+ "watchdog_timer_ms" : 20000
+ },
+ "device" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "memory_kb" : 1000,
+ "watchdog_timer_ms" : 20000,
+ "keep_context" : false,
+ "priority" : "NONE",
+ "steal_focus" : false
+ },
+ "pre_DataConsent" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "pre_Base-1" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false,
+ "watchdog_timer_ms" : 20000
+ }
+ },
+ "consumer_friendly_messages" : {
+ "messages" : {
+ "AppPermissions" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Zugriffsanfrage(n)",
+ "line2" : "erlauben?",
+ "tts" : "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-gb" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-ie" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-us" : {
+ "line1" : "Grant Requested",
+ "line2" : "Permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny."
+ },
+ "es-en" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "es-es" : {
+ "line1" : "¿Conceder permisos",
+ "line2" : "solicitados?",
+ "tts" : "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar."
+ },
+ "es-mx" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "line1" : "Concedi autorizzaz.",
+ "line2" : "richiesta(e)?",
+ "tts" : "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare."
+ },
+ "nl-nl" : {
+ "line1" : "Aangevraagde",
+ "line2" : "permissie(s) verlenen?",
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "line1" : "Udzielić żądanych",
+ "line2" : "pozwoleń?",
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "line1" : "Conceder permissão",
+ "line2" : "solicitada?",
+ "tts" : "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar."
+ },
+ "pt-pt" : {
+ "line1" : "Conceder permiss.",
+ "line2" : "solicitada(s)?",
+ "tts" : "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar."
+ },
+ "ru-ru" : {
+ "line1" : "Предост. заправш.",
+ "line2" : "разрешения?",
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны."
+ },
+ "sv-se" : {
+ "line1" : "Vill du ge",
+ "line2" : "tillstånd?",
+ "tts" : "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "line1" : "İstenen izinler",
+ "line2" : "verilsin mi?",
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否允许请求的",
+ "line2" : "权限?",
+ "tts" : "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "line1" : "允許",
+ "line2" : "授權請求?",
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsHelp" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es" : {
+ "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "tts" : "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl" : {
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "tts" : "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt" : {
+ "tts" : "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru" : {
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se" : {
+ "tts" : "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "tts" : "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it" : {
+ "tts" : "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl" : {
+ "tts" : "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl" : {
+ "tts" : "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br" : {
+ "tts" : "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt" : {
+ "tts" : "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru" : {
+ "tts" : "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se" : {
+ "tts" : "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr" : {
+ "tts" : "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn" : {
+ "tts" : "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw" : {
+ "tts" : "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht autorisiert",
+ "tts" : "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren."
+ },
+ "en-au" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "es-en" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No autorizada",
+ "tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "it-it" : {
+ "line1" : "non autorizzata",
+ "tts" : "Questa versione di %appName% non è autorizzata e non funziona con il SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet geautoriseerd",
+ "tts" : "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "brak autoryzacji",
+ "tts" : "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não autorizado",
+ "tts" : "Esta versão do %appName% não tem autorização e não funcionará com o SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não autorizada",
+ "tts" : "Esta versão de %appName% não está autorizada e não funcionará com o SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не авторизировано",
+ "tts" : "Эта версия %appName% не авторизирована и не будет работать с SYNC."
+ },
+ "sv-se" : {
+ "line1" : "är ej godkänd",
+ "tts" : "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC."
+ },
+ "tr-tr" : {
+ "line1" : "için izin yok",
+ "tts" : "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz."
+ },
+ "zh-cn" : {
+ "line1" : "未得到授权",
+ "tts" : "此版本的%appName% 未得到授权,无法在SYNC上使用。"
+ },
+ "zh-tw" : {
+ "line1" : "無授權",
+ "tts" : "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。"
+ }
+ }
+ },
+ "AppUnsupported" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht unterstützt",
+ "tts" : "Diese Version von %appName% wird von SYNC nicht unterstützt."
+ },
+ "en-au" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "es-en" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "it-it" : {
+ "line1" : "non supportata",
+ "tts" : "Questa versione di %appName% non è supportata dal SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet ondersteund",
+ "tts" : "Deze versie van %appName% wordt niet ondersteund door SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "aplikacja nie obsług.",
+ "tts" : "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não suportado",
+ "tts" : "Esta versão do %appName% não é suportada pelo SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não suportada",
+ "tts" : "Esta versão de %appName% não é suportado pelo SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не поддерживается",
+ "tts" : "Эта версия %appName% не поддерживается SYNC."
+ },
+ "sv-se" : {
+ "line1" : "stöds ej",
+ "tts" : "SYNC har inte stöd för den här versionen av %appName%."
+ },
+ "tr-tr" : {
+ "line1" : "desteklenmiyor",
+ "tts" : "Bu %appName% sürümü SYNC tarafından desteklenmiyor."
+ },
+ "zh-cn" : {
+ "line1" : "不受支持",
+ "tts" : "SYNC不支持此版本的%appName%。"
+ },
+ "zh-tw" : {
+ "line1" : "不支援",
+ "tts" : "SYNC 不支援此版本的%appName% 。"
+ }
+ }
+ },
+ "DataConsent" : {
+ "languages" : {
+ "en-us" : {
+ "line1" : "Enable Mobile Apps",
+ "line2" : "on SYNC? (Uses Data)",
+ "tts" : "To use mobile apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device's data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Please press yes or no, or help for more information. "
+ }
+ }
+ },
+ "DataConsentHelp" : {
+ "languages" : {
+ "en-us" : {
+ "tts" : "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC mobile apps settings menu. See your Owner Guide for more information. "
+ }
+ }
+ },
+ "DisableApps" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Auto-Update",
+ "line2" : "und Mobile Apps deaktivieren",
+ "tts" : "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen."
+ },
+ "en-au" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-gb" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-us" : {
+ "line1" : "Disable Auto-Updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es" : {
+ "line1" : "¿Desact. actual. auto",
+ "line2" : "y apl. móviles?",
+ "tts" : "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar."
+ },
+ "es-mx" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "it-it" : {
+ "line1" : "Disabilitare agg. aut.",
+ "line2" : "e app mobili?",
+ "tts" : "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare."
+ },
+ "nl-nl" : {
+ "line1" : "Auto-updates en mob.",
+ "line2" : "apps uitschakelen?",
+ "tts" : "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren."
+ },
+ "pl-pl" : {
+ "line1" : "Wył. automat. aktual.",
+ "line2" : "i aplikacje mobilne?",
+ "tts" : "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować."
+ },
+ "pt-br" : {
+ "line1" : "Desativar atualizações",
+ "line2" : "autom. e aplicativos?",
+ "tts" : "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actual. autom.",
+ "line2" : "e aplicações móveis?",
+ "tts" : "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. автообновления",
+ "line2" : "и мобил. прилож.?",
+ "tts" : "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены."
+ },
+ "sv-se" : {
+ "line1" : "Avaktiverar autouppdat.",
+ "line2" : "och mobilappar?",
+ "tts" : "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta."
+ },
+ "tr-tr" : {
+ "line1" : "Oto. güncelleme ve",
+ "line2" : "mobil uygul. kapat?",
+ "tts" : "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否禁用自动更新和",
+ "line2" : "移动应用程序?",
+ "tts" : "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。"
+ },
+ "zh-tw" : {
+ "line1" : "停用自動更新",
+ "line2" : "和行動應用程式?",
+ "tts" : "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。"
+ }
+ }
+ },
+ "DrivingCharacteristics" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahreigenschaften",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus."
+ },
+ "en-au" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-gb" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-us" : {
+ "label" : "Driving Characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es" : {
+ "label" : "Características de conducción",
+ "tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad."
+ },
+ "es-mx" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "it-it" : {
+ "label" : "Caratteristiche di guida",
+ "tts" : "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza."
+ },
+ "nl-nl" : {
+ "label" : "Rijkenmerken",
+ "tts" : "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus."
+ },
+ "pl-pl" : {
+ "label" : "Informacje dotyczące stylu jazdy",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa."
+ },
+ "pt-br" : {
+ "label" : "Características de condução",
+ "tts" : "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança."
+ },
+ "pt-pt" : {
+ "label" : "Características de condução",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança."
+ },
+ "ru-ru" : {
+ "label" : "Характеристики движения",
+ "tts" : "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности."
+ },
+ "sv-se" : {
+ "label" : "Köregenskaper",
+ "tts" : "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus."
+ },
+ "tr-tr" : {
+ "label" : "Sürüş karakteristikleri",
+ "tts" : "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu."
+ },
+ "zh-cn" : {
+ "label" : "行驶特性",
+ "tts" : "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态"
+ },
+ "zh-tw" : {
+ "label" : "駕駛特性",
+ "tts" : "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態"
+ }
+ }
+ },
+ "Location" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "GPS und Geschwindigkeit",
+ "tts" : "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs."
+ },
+ "en-au" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-gb" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-ie" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-us" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "es-en" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo."
+ },
+ "es-mx" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "it-it" : {
+ "label" : "GPS e velocità",
+ "tts" : "Un'app può avere accesso a GPS e velocità del veicolo."
+ },
+ "nl-nl" : {
+ "label" : "Gps en snelheid",
+ "tts" : "Een app heeft toegang tot gps en de snelheid van het voertuig."
+ },
+ "pl-pl" : {
+ "label" : "GPS i prędkość",
+ "tts" : "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu."
+ },
+ "pt-br" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Um aplicativo pode acessar o GPS e a velocidade do veículo."
+ },
+ "pt-pt" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Uma aplicação consegue aceder ao GPS e à velocidade do veículo."
+ },
+ "ru-ru" : {
+ "label" : "GPS и скорость",
+ "tts" : "Приложение имеет доступ к GPS и скорости автомобиля."
+ },
+ "sv-se" : {
+ "label" : "GPS och hastighet",
+ "tts" : "Appen kan komma åt fordonets GPS och hastighetsmätare."
+ },
+ "tr-tr" : {
+ "label" : "GPS ve hız",
+ "tts" : "Bu uygulama aracın GPS ve hız bilgilerine erişebilir."
+ },
+ "zh-cn" : {
+ "label" : "GPS 和车速",
+ "tts" : "移动应用程序可以访问车辆 GPS 和车速信息。"
+ },
+ "zh-tw" : {
+ "label" : "GPS和車速",
+ "tts" : "應用程式可存取車輛的GPS和速度。"
+ }
+ }
+ },
+ "Notifications" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Push-Benachrichtigungen",
+ "tts" : "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden."
+ },
+ "en-au" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-gb" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-ie" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-us" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "es-en" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es" : {
+ "label" : "Notificaciones push",
+ "tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano."
+ },
+ "es-mx" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca" : {
+ "label" : "Notifications instantanées",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr" : {
+ "label" : "Notifications push",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "it-it" : {
+ "label" : "Notifiche push",
+ "tts" : "Un'app può inviare notifiche se eseguita in background."
+ },
+ "nl-nl" : {
+ "label" : "Push-meldingen",
+ "tts" : "Een app kan meldingen versturen als deze op de achtergrond actief is."
+ },
+ "pl-pl" : {
+ "label" : "Powiadomienia Push",
+ "tts" : "Aplikacja może wysyłać powiadomienia, działając w tle."
+ },
+ "pt-br" : {
+ "label" : "Notificações Push",
+ "tts" : "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano."
+ },
+ "pt-pt" : {
+ "label" : "Notificações push",
+ "tts" : "Uma aplicação consegue enviar notificações quando está activa em segundo plano."
+ },
+ "ru-ru" : {
+ "label" : "Оповещения о пересылке",
+ "tts" : "Если приложение работает в фоновом режиме, оно может отправлять оповещения."
+ },
+ "sv-se" : {
+ "label" : "Push-notiser",
+ "tts" : "Appen kan skicka meddelanden när den körs i bakgrunden."
+ },
+ "tr-tr" : {
+ "label" : "Anlık bildirimleri",
+ "tts" : "Bir uygulama arka planda çalışırken bildirim gönderebilir."
+ },
+ "zh-cn" : {
+ "label" : "推送通知",
+ "tts" : "移动应用程序在后台运行时可推送通知。"
+ },
+ "zh-tw" : {
+ "label" : "傳送通知",
+ "tts" : "車輛行進時,應用程式可在背景中傳送通知。"
+ }
+ }
+ },
+ "SettingDisableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Updates deakt."
+ },
+ "en-au" : {
+ "line1" : "Disable updates"
+ },
+ "en-gb" : {
+ "line1" : "Disable updates"
+ },
+ "en-ie" : {
+ "line1" : "Disable updates"
+ },
+ "en-us" : {
+ "line1" : "Disable Updates"
+ },
+ "es-en" : {
+ "line1" : "Deshab. actual."
+ },
+ "es-es" : {
+ "line1" : "Desact. actual."
+ },
+ "es-mx" : {
+ "line1" : "Deshab. actual."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj"
+ },
+ "it-it" : {
+ "line1" : "Disabilita agg."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. uitschak."
+ },
+ "pl-pl" : {
+ "line1" : "Wyłącz aktual."
+ },
+ "pt-br" : {
+ "line1" : "Desat. atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Inaktivera uppd."
+ },
+ "tr-tr" : {
+ "line1" : "Güncell. Kapat"
+ },
+ "zh-cn" : {
+ "line1" : "禁用更新"
+ },
+ "zh-tw" : {
+ "line1" : "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Apps aktivieren"
+ },
+ "en-au" : {
+ "line1" : "Enable Apps"
+ },
+ "en-gb" : {
+ "line1" : "Enable Apps"
+ },
+ "en-ie" : {
+ "line1" : "Enable Apps"
+ },
+ "en-us" : {
+ "line1" : "Enable Apps"
+ },
+ "es-en" : {
+ "line1" : "Hab. aplic."
+ },
+ "es-es" : {
+ "line1" : "Activar apl."
+ },
+ "es-mx" : {
+ "line1" : "Hab. aplic."
+ },
+ "fr-ca" : {
+ "line1" : "Activer app."
+ },
+ "fr-fr" : {
+ "line1" : "Activer app."
+ },
+ "it-it" : {
+ "line1" : "Abilita app"
+ },
+ "nl-nl" : {
+ "line1" : "Apps inschak."
+ },
+ "pl-pl" : {
+ "line1" : "Włącz aplikacje"
+ },
+ "pt-br" : {
+ "line1" : "Ativar aplic."
+ },
+ "pt-pt" : {
+ "line1" : "Activar actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Вкл. прилож."
+ },
+ "sv-se" : {
+ "line1" : "Aktivera appar"
+ },
+ "tr-tr" : {
+ "line1" : "Uygulamaları aç"
+ },
+ "zh-cn" : {
+ "line1" : "启用应用程序"
+ },
+ "zh-tw" : {
+ "line1" : "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update anford."
+ },
+ "en-au" : {
+ "line1" : "Request update"
+ },
+ "en-gb" : {
+ "line1" : "Request update"
+ },
+ "en-ie" : {
+ "line1" : "Request update"
+ },
+ "en-us" : {
+ "line1" : "Request Update"
+ },
+ "es-en" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "es-es" : {
+ "line1" : "Solicitar actual."
+ },
+ "es-mx" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "fr-ca" : {
+ "line1" : "Demander MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Demander màj"
+ },
+ "it-it" : {
+ "line1" : "Rich. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. aanvragen"
+ },
+ "pl-pl" : {
+ "line1" : "Zażądaj aktual."
+ },
+ "pt-br" : {
+ "line1" : "Solicitar atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Запрос на обн."
+ },
+ "sv-se" : {
+ "line1" : "Begär uppdat."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleme iste"
+ },
+ "zh-cn" : {
+ "line1" : "请求更新"
+ },
+ "zh-tw" : {
+ "line1" : "請求更新"
+ }
+ }
+ },
+ "StatusNeeded" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update benötigt"
+ },
+ "en-au" : {
+ "line1" : "Update needed"
+ },
+ "en-gb" : {
+ "line1" : "Update needed"
+ },
+ "en-ie" : {
+ "line1" : "Update needed"
+ },
+ "en-us" : {
+ "line1" : "Update Needed"
+ },
+ "es-en" : {
+ "line1" : "Actualiz. neces."
+ },
+ "es-es" : {
+ "line1" : "Actu. necesaria"
+ },
+ "es-mx" : {
+ "line1" : "Actualiz. neces."
+ },
+ "fr-ca" : {
+ "line1" : "Màj requise"
+ },
+ "fr-fr" : {
+ "line1" : "Mise à jour requise"
+ },
+ "it-it" : {
+ "line1" : "Necess. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Update nodig"
+ },
+ "pl-pl" : {
+ "line1" : "Potrzeba aktual."
+ },
+ "pt-br" : {
+ "line1" : "Atualiz. necess."
+ },
+ "pt-pt" : {
+ "line1" : "Actual. necess."
+ },
+ "ru-ru" : {
+ "line1" : "Необх. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs"
+ },
+ "tr-tr" : {
+ "line1" : "Güncellenmeli"
+ },
+ "zh-cn" : {
+ "line1" : "需要进行更新"
+ },
+ "zh-tw" : {
+ "line1" : "需更新"
+ }
+ }
+ },
+ "StatusPending" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktualisieren..."
+ },
+ "en-au" : {
+ "line1" : "Updating..."
+ },
+ "en-gb" : {
+ "line1" : "Updating..."
+ },
+ "en-ie" : {
+ "line1" : "Updating..."
+ },
+ "en-us" : {
+ "line1" : "Updating..."
+ },
+ "es-en" : {
+ "line1" : "Actualizando..."
+ },
+ "es-es" : {
+ "line1" : "Actualizando..."
+ },
+ "es-mx" : {
+ "line1" : "Actualizando..."
+ },
+ "fr-ca" : {
+ "line1" : "MAJ en cours..."
+ },
+ "fr-fr" : {
+ "line1" : "Màj en cours..."
+ },
+ "it-it" : {
+ "line1" : "Aggiornamento"
+ },
+ "nl-nl" : {
+ "line1" : "Updaten..."
+ },
+ "pl-pl" : {
+ "line1" : "Aktualizowanie"
+ },
+ "pt-br" : {
+ "line1" : "Atualizando..."
+ },
+ "pt-pt" : {
+ "line1" : "A actualizar..."
+ },
+ "ru-ru" : {
+ "line1" : "Обновление..."
+ },
+ "sv-se" : {
+ "line1" : "Uppdaterar..."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleniyor..."
+ },
+ "zh-cn" : {
+ "line1" : "正在更新......"
+ },
+ "zh-tw" : {
+ "line1" : "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktuelle Version"
+ },
+ "en-au" : {
+ "line1" : "Up-to-date"
+ },
+ "en-gb" : {
+ "line1" : "Up-to-date"
+ },
+ "en-ie" : {
+ "line1" : "Up-to-date"
+ },
+ "en-us" : {
+ "line1" : "Up-To-Date"
+ },
+ "es-en" : {
+ "line1" : "Actualizado"
+ },
+ "es-es" : {
+ "line1" : "Actualizada"
+ },
+ "es-mx" : {
+ "line1" : "Actualizado"
+ },
+ "fr-ca" : {
+ "line1" : "Déjà à jour"
+ },
+ "fr-fr" : {
+ "line1" : "Déjà à jour"
+ },
+ "it-it" : {
+ "line1" : "più recente"
+ },
+ "nl-nl" : {
+ "line1" : "Up-to-date"
+ },
+ "pl-pl" : {
+ "line1" : "Aktualne"
+ },
+ "pt-br" : {
+ "line1" : "Atualizado"
+ },
+ "pt-pt" : {
+ "line1" : "Actualizado"
+ },
+ "ru-ru" : {
+ "line1" : "Обновлено"
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs ej"
+ },
+ "tr-tr" : {
+ "line1" : "Güncel"
+ },
+ "zh-cn" : {
+ "line1" : "最新更新"
+ },
+ "zh-tw" : {
+ "line1" : "更新最新"
+ }
+ }
+ },
+ "VehicleInfo" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahrzeuginformationen",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck."
+ },
+ "en-au" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-gb" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-ie" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-us" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es" : {
+ "label" : "Información del vehículo",
+ "tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos."
+ },
+ "es-mx" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus."
+ },
+ "it-it" : {
+ "label" : "Informazioni sul veicolo",
+ "tts" : "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici."
+ },
+ "nl-nl" : {
+ "label" : "Voertuiginformatie",
+ "tts" : "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning."
+ },
+ "pl-pl" : {
+ "label" : "Informacje o pojeździe",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon."
+ },
+ "pt-br" : {
+ "label" : "Informações sobre o veículo",
+ "tts" : "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus."
+ },
+ "pt-pt" : {
+ "label" : "Informações do veículo",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus."
+ },
+ "ru-ru" : {
+ "label" : "Информация об автомобиле",
+ "tts" : "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин."
+ },
+ "sv-se" : {
+ "label" : "Fordonsinformation",
+ "tts" : "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck."
+ },
+ "tr-tr" : {
+ "label" : "Araç bilgisi",
+ "tts" : "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı."
+ },
+ "zh-cn" : {
+ "label" : "车辆信息",
+ "tts" : "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压."
+ },
+ "zh-tw" : {
+ "label" : "車輛資訊",
+ "tts" : "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓."
+ }
+ }
+ }
+ },
+ "version" : "001.001.015"
+ },
+ "functional_groupings" : {
+ "Base-4" : {
+ "rpcs" : {
+ "AddCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "AddSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Alert" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "CreateInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "EncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "EndAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnButtonEvent" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnButtonPress" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnCommand" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnDriverDistraction" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnEncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnHMIStatus" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnTBTClientState" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "PerformAudioPassThru" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PerformInteraction" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ScrollableMessage" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetMediaClockTimer" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "Show" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Slider" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "Speak" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "SubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnsubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ },
+ "user_consent_prompt" : "DrivingCharacteristics"
+ },
+ "Emergency-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Location-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ }
+ },
+ "user_consent_prompt" : "Location"
+ },
+ "Navigation-1" : {
+ "rpcs" : {
+ "AlertManeuver" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ShowConstantTBT" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UpdateTurnList" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "Notifications" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "BACKGROUND" ]
+ }
+ },
+ "user_consent_prompt" : "Notifications"
+ },
+ "PropriataryData-1" : {
+ "rpcs" : {
+ "DiagnosticMessage" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GetDTCs" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ReadDID" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "VehicleInfo-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ },
+ "user_consent_prompt" : "VehicleInfo"
+ },
+ "pre_Base-1" : {
+ "rpcs" : {
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ }
+ }
+ }
+ },
+ "module_config" : {
+ "device_certificates" : {
+ "HUU40DAS7F970UEI17A73JH32L41K32JH4L1K234H3K4" : "aldhfkahfgkafrblgjr"
+ },
+ "endpoints" : {
+ "0x07" : {
+ "default" : [ "http://policies.telematics.ford.com/api/policies" ]
+ }
+ },
+ "exchange_after_x_days" : 30,
+ "exchange_after_x_ignition_cycles" : 100,
+ "exchange_after_x_kilometers" : 1800,
+ "notifications_per_minute_by_priority" : {
+ "COMMUNICATION" : 6,
+ "EMERGENCY" : 60,
+ "NAVIGATION" : 15,
+ "NONE" : 0,
+ "NORMAL" : 4,
+ "VOICECOMM" : 10
+ },
+ "seconds_between_retries" : [ 1, 5, 25, 125, 625 ],
+ "timeout_after_x_seconds" : 60,
+ "vehicle_make" : "Stark Industries",
+ "vehicle_model" : "E-Tron",
+ "vehicle_year" : "1992"
+ }
+ }
+}
diff --git a/src/components/application_manager/test/smartDeviceLink_test.ini b/src/components/application_manager/test/smartDeviceLink_test.ini
new file mode 100644
index 0000000000..c544a6e02d
--- /dev/null
+++ b/src/components/application_manager/test/smartDeviceLink_test.ini
@@ -0,0 +1,39 @@
+[MAIN]
+
+; For resume_ctrl tests
+LogsEnabled = false
+; Contains .json/.ini files
+AppConfigFolder =
+; Contains output files, e.g. .wav. Changed for tests
+AppStorageFolder = test_storage
+; Limitation for a number of ReadDID requests (the 1st value) per (the 2nd value) seconds
+ReadDIDRequest = 5, 1
+
+[AppInfo]
+; The path for applications info storage. Changed for tests
+AppInfoStorage = test_app_info.dat
+
+[Resumption]
+
+# Timeout in milliseconds for resumption Application HMILevel
+# and resolving conflicts in case if multiple applications initiate resumption
+# Time changed for test onAppActivated
+ApplicationResumingTimeout = 30000000
+
+# Timeout in milliseconds for periodical saving resumption persistent data
+AppSavePersistentDataTimeout = 10000
+
+# Timeout in seconds to store hmi_level for media app before ign_off
+ResumptionDelayBeforeIgn = 30;
+
+# Timeout in seconds to restore hmi_level for media app after sdl run
+ResumptionDelayAfterIgn = 30;
+
+# Resumption ctrl uses JSON if UseDBForResumption=false for store data otherwise uses DB
+UseDBForResumption = false
+
+# Number of attempts to open resumption DB
+AttemptsToOpenResumptionDB = 5
+
+# Timeout between attempts during opening DB in milliseconds
+OpenAttemptTimeoutMsResumptionDB = 500
diff --git a/src/components/application_manager/test/smartDeviceLink_test2.ini b/src/components/application_manager/test/smartDeviceLink_test2.ini
new file mode 100644
index 0000000000..a5e09b9e6c
--- /dev/null
+++ b/src/components/application_manager/test/smartDeviceLink_test2.ini
@@ -0,0 +1,28 @@
+; The INI-file consists of different chapters.
+; Each chapter begins with the line containing
+; the name in square brackets. Syntax:
+; [chapter]
+; The chapters consists of a set of items with a
+; assigned value. The syntax is:
+; item=value
+; All white spaces an second encounters of chapters
+; or items will be ignored.
+; Remarks start with semicolon or star as first character.
+; It is allowed for names of chapters and items to
+; contain semicolon and star. Possible syntax is:
+; [ chapter ] ;Remark
+; item = value ;Remark
+
+[MAIN]
+; Contains output files, e.g. .wav
+AppStorageFolder = storage
+
+[Policy]
+EnablePolicy = true
+PreloadedPT = sdl_preloaded_pt.json
+PathToSnapshot = sdl_snapshot.json
+; Number of attempts to open policy DB
+AttemptsToOpenPolicyDB = 5
+; Timeout between attempts during opening DB in milliseconds
+OpenAttemptTimeoutMs = 500
+
diff --git a/src/components/application_manager/test/state_controller/CMakeLists.txt b/src/components/application_manager/test/state_controller/CMakeLists.txt
index 243e6218ed..19ab11561f 100644
--- a/src/components/application_manager/test/state_controller/CMakeLists.txt
+++ b/src/components/application_manager/test/state_controller/CMakeLists.txt
@@ -30,20 +30,21 @@
if(BUILD_TESTS)
-set(appMain_DIR ${CMAKE_SOURCE_DIR}/src/appMain)
-
include_directories(
${GMOCK_INCLUDE_DIRECTORY}
- ${COMPONENTS_DIR}/application_manager/test/state_controller/include
+ include
+ ${COMPONENTS_DIR}/application_manager/test/include
)
set(LIBRARIES
gmock
ApplicationManager
+ connectionHandler
)
set(SOURCES
state_controller_test.cc
+ ${COMPONENTS_DIR}/application_manager/test/mock_message_helper.cc
)
create_test("state_controller_test" "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/application_manager/test/state_controller/include/application_manager_mock.h b/src/components/application_manager/test/state_controller/include/application_manager_mock.h
index 22ff93687a..4adcb99b4d 100644
--- a/src/components/application_manager/test/state_controller/include/application_manager_mock.h
+++ b/src/components/application_manager/test/state_controller/include/application_manager_mock.h
@@ -38,6 +38,8 @@
#include "application_manager/application_manager.h"
#include "application_manager/usage_statistics.h"
+namespace test {
+namespace components {
namespace state_controller_test {
namespace am = application_manager;
@@ -52,10 +54,9 @@ class ApplicationManagerMock : public application_manager::ApplicationManager {
MOCK_METHOD1(set_connection_handler,
void(connection_handler::ConnectionHandler*));
MOCK_CONST_METHOD0(applications, DataAccessor<am::ApplicationSet>());
+ MOCK_CONST_METHOD1(application, am::ApplicationSharedPtr(uint32_t app_id));
MOCK_CONST_METHOD1(application_by_hmi_app,
am::ApplicationSharedPtr(uint32_t));
- MOCK_CONST_METHOD1(application, am::ApplicationSharedPtr(uint32_t));
-
MOCK_CONST_METHOD0(active_application, am::ApplicationSharedPtr());
MOCK_CONST_METHOD1(application_by_policy_id,
am::ApplicationSharedPtr(const std::string&));
@@ -65,16 +66,24 @@ class ApplicationManagerMock : public application_manager::ApplicationManager {
MOCK_CONST_METHOD0(get_limited_media_application, am::ApplicationSharedPtr());
MOCK_CONST_METHOD0(get_limited_navi_application, am::ApplicationSharedPtr());
MOCK_CONST_METHOD0(get_limited_voice_application, am::ApplicationSharedPtr());
+ MOCK_METHOD1(application_id, const uint32_t(const int32_t));
MOCK_METHOD2(set_application_id, void(const int32_t, const uint32_t));
- MOCK_METHOD1(application_id, uint32_t(const int32_t));
- MOCK_METHOD3(OnHMILevelChanged, void(uint32_t, mobile_apis::HMILevel::eType,
- mobile_apis::HMILevel::eType));
+ MOCK_METHOD3(OnHMILevelChanged,
+ void(uint32_t,
+ mobile_apis::HMILevel::eType,
+ mobile_apis::HMILevel::eType));
MOCK_METHOD1(SendHMIStatusNotification, void(const am::ApplicationSharedPtr));
- MOCK_CONST_METHOD1(GetDefaultHmiLevel, mobile_apis::HMILevel::eType(
- am::ApplicationConstSharedPtr));
+ MOCK_CONST_METHOD1(
+ GetDefaultHmiLevel,
+ mobile_apis::HMILevel::eType(am::ApplicationConstSharedPtr));
MOCK_METHOD0(hmi_capabilities, am::HMICapabilities&());
MOCK_METHOD0(is_attenuated_supported, bool());
- MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited, bool(am::ApplicationConstSharedPtr));
+ MOCK_CONST_METHOD1(IsAppTypeExistsInFullOrLimited,
+ bool(am::ApplicationConstSharedPtr));
+ MOCK_METHOD1(OnApplicationRegistered, void(am::ApplicationSharedPtr));
};
} // namespace state_controller_test
+} // namespace components
+} // namespace test
+
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_APPLICATION_MANAGER_MOCK_H_
diff --git a/src/components/application_manager/test/state_controller/include/application_mock.h b/src/components/application_manager/test/state_controller/include/application_mock.h
index 01dafd10f4..3f1e96bb24 100644
--- a/src/components/application_manager/test/state_controller/include/application_mock.h
+++ b/src/components/application_manager/test/state_controller/include/application_mock.h
@@ -37,216 +37,346 @@
#include "gmock/gmock.h"
#include "application_manager/application.h"
+
+namespace test {
+namespace components {
namespace state_controller_test {
+
namespace am = application_manager;
-class ApplicationMock : public am::Application {
+namespace custom_str = utils::custom_string;
+
+class MockApplication : public application_manager::Application {
public:
- MOCK_CONST_METHOD0(active_message, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(curHash, const std::string&());
- MOCK_METHOD0(UpdateHash, void());
- MOCK_CONST_METHOD0(flag_sending_hash_change_after_awake, bool());
- MOCK_METHOD1(set_flag_sending_hash_change_after_awake, void(bool flag));
- MOCK_CONST_METHOD0(is_application_data_changed, bool());
+ // InitialApplicationData
+ MOCK_CONST_METHOD0(app_types,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(vr_synonyms,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(mac_address,
+ const std::string&());
+ MOCK_CONST_METHOD0(mobile_app_id,
+ std::string());
+ MOCK_CONST_METHOD0(tts_name,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(ngn_media_screen_name,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(language,
+ const mobile_apis::Language::eType&());
+ MOCK_CONST_METHOD0(ui_language,
+ const mobile_apis::Language::eType&());
+ MOCK_METHOD1(set_app_types,
+ void(const smart_objects::SmartObject& app_types));
+ MOCK_METHOD1(set_vr_synonyms,
+ void(const smart_objects::SmartObject& vr_synonyms));
+ MOCK_METHOD1(set_mobile_app_id,
+ void(const std::string& mobile_app_id));
+ MOCK_METHOD1(set_tts_name,
+ void(const smart_objects::SmartObject& tts_name));
+ MOCK_METHOD1(set_ngn_media_screen_name,
+ void(const smart_objects::SmartObject& ngn_name));
+ MOCK_METHOD1(set_language,
+ void(const mobile_apis::Language::eType& language));
+ MOCK_METHOD1(set_ui_language,
+ void(const mobile_apis::Language::eType& ui_language));
+
+ // DynamicApplicationData
+ MOCK_CONST_METHOD0(help_prompt,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(timeout_prompt,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(vr_help_title,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(vr_help,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(tbt_state,
+ const mobile_apis::TBTState::eType&());
+ MOCK_CONST_METHOD0(show_command,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(tbt_show_command,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(SubscribedButtons,
+ DataAccessor<application_manager::ButtonSubscriptions>());
+ MOCK_CONST_METHOD0(SubscribedIVI,
+ DataAccessor<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*());
+ MOCK_METHOD1(load_global_properties,
+ void(const smart_objects::SmartObject& so));
+ MOCK_METHOD1(set_help_prompt,
+ void(const smart_objects::SmartObject& help_prompt));
+ MOCK_METHOD1(set_timeout_prompt,
+ void(const smart_objects::SmartObject& timeout_prompt));
+ MOCK_METHOD1(set_vr_help_title,
+ void(const smart_objects::SmartObject& vr_help_title));
+ MOCK_METHOD0(reset_vr_help_title,
+ void());
+ MOCK_METHOD1(set_vr_help,
+ void(const smart_objects::SmartObject& vr_help));
+ MOCK_METHOD0(reset_vr_help,
+ void());
+ MOCK_METHOD1(set_tbt_state,
+ void(const mobile_apis::TBTState::eType& tbt_state));
+ MOCK_METHOD1(set_show_command,
+ void(const smart_objects::SmartObject& show_command));
+ MOCK_METHOD1(set_tbt_show_command,
+ void(const smart_objects::SmartObject& tbt_show));
+ MOCK_METHOD1(set_keyboard_props,
+ void(const smart_objects::SmartObject& keyboard_props));
+ MOCK_METHOD1(set_menu_title,
+ void(const smart_objects::SmartObject& menu_title));
+ MOCK_METHOD1(set_menu_icon,
+ void(const smart_objects::SmartObject& menu_icon));
+ MOCK_CONST_METHOD0(audio_stream_retry_number,
+ uint32_t());
+ MOCK_METHOD1(set_audio_stream_retry_number,
+ void(const uint32_t& audio_stream_retry_number));
+ MOCK_CONST_METHOD0(video_stream_retry_number,
+ uint32_t());
+ MOCK_METHOD1(set_video_stream_retry_number,
+ void(const uint32_t& video_stream_retry_number));
+ MOCK_METHOD2(AddCommand,
+ void(uint32_t cmd_id, const smart_objects::SmartObject& command));
+ MOCK_METHOD1(RemoveCommand,
+ void(uint32_t cmd_id));
+ MOCK_METHOD1(FindCommand,
+ smart_objects::SmartObject*(uint32_t cmd_id));
+ MOCK_METHOD2(AddSubMenu,
+ void(uint32_t menu_id, const smart_objects::SmartObject& menu));
+ MOCK_METHOD1(RemoveSubMenu,
+ void(uint32_t menu_id));
+ MOCK_CONST_METHOD1(FindSubMenu,
+ smart_objects::SmartObject*(uint32_t menu_id));
+ MOCK_METHOD1(IsSubMenuNameAlreadyExist,
+ bool(const std::string& name));
+ MOCK_METHOD2(AddChoiceSet,
+ void(uint32_t choice_set_id, const smart_objects::SmartObject& choice_set));
+ MOCK_METHOD1(RemoveChoiceSet,
+ void(uint32_t choice_set_id));
+ MOCK_METHOD1(FindChoiceSet,
+ smart_objects::SmartObject*(uint32_t choice_set_id));
+ MOCK_METHOD3(AddPerformInteractionChoiceSet,
+ void(uint32_t correlation_id, uint32_t choice_set_id, const smart_objects::SmartObject& choice_set));
+ MOCK_METHOD1(DeletePerformInteractionChoiceSet,
+ void(uint32_t correlation_id));
+ MOCK_CONST_METHOD0(performinteraction_choice_set_map,
+ DataAccessor<application_manager::PerformChoiceSetMap>());
+ MOCK_CONST_METHOD0(commands_map,
+ DataAccessor<application_manager::CommandsMap>());
+ MOCK_CONST_METHOD0(sub_menu_map,
+ DataAccessor<application_manager::SubMenuMap>());
+ MOCK_CONST_METHOD0(choice_set_map,
+ DataAccessor<application_manager::ChoiceSetMap>());
+ MOCK_METHOD1(set_perform_interaction_active,
+ void(uint32_t active));
+ MOCK_CONST_METHOD0(is_perform_interaction_active,
+ uint32_t());
+ MOCK_METHOD1(set_perform_interaction_layout,
+ void(mobile_apis::LayoutMode::eType layout));
+ MOCK_CONST_METHOD0(perform_interaction_layout,
+ mobile_apis::LayoutMode::eType());
+ MOCK_METHOD1(set_perform_interaction_mode,
+ void(int32_t mode));
+ MOCK_CONST_METHOD0(perform_interaction_mode,
+ int32_t());
+ MOCK_METHOD1(set_reset_global_properties_active,
+ void(bool active));
+ MOCK_CONST_METHOD0(is_reset_global_properties_active,
+ bool());
+// Application
+
+ MOCK_CONST_METHOD0(active_message,
+ const smart_objects::SmartObject*());
+ MOCK_CONST_METHOD0(curHash,
+ const std::string&());
+ MOCK_METHOD0(UpdateHash,
+ void());
+ MOCK_CONST_METHOD0(is_application_data_changed,
+ bool());
MOCK_METHOD1(set_is_application_data_changed,
- void(bool state_application_data));
- MOCK_METHOD0(CloseActiveMessage, void());
- MOCK_CONST_METHOD0(IsFullscreen, bool());
- MOCK_METHOD0(ChangeSupportingAppHMIType, void());
- MOCK_CONST_METHOD0(is_navi, bool());
- MOCK_METHOD1(set_is_navi, void(bool allow));
- MOCK_CONST_METHOD0(video_streaming_approved, bool());
- MOCK_METHOD1(set_video_streaming_approved, void(bool state));
- MOCK_CONST_METHOD0(audio_streaming_approved, bool());
- MOCK_METHOD1(set_audio_streaming_approved, void(bool state));
- MOCK_CONST_METHOD0(video_streaming_allowed, bool());
- MOCK_METHOD1(set_video_streaming_allowed, void(bool state));
- MOCK_CONST_METHOD0(audio_streaming_allowed, bool());
- MOCK_METHOD1(set_audio_streaming_allowed, void(bool state));
+ void(bool state_application_data));
+ MOCK_METHOD0(CloseActiveMessage,
+ void());
+ MOCK_CONST_METHOD0(IsFullscreen,
+ bool());
+ MOCK_METHOD0(ChangeSupportingAppHMIType,
+ void());
+ MOCK_CONST_METHOD0(is_navi,
+ bool());
+ MOCK_METHOD1(set_is_navi,
+ void(bool allow));
+ MOCK_CONST_METHOD0(video_streaming_approved,
+ bool());
+ MOCK_METHOD1(set_video_streaming_approved,
+ void(bool state));
+ MOCK_CONST_METHOD0(audio_streaming_approved,
+ bool());
+ MOCK_METHOD1(set_audio_streaming_approved,
+ void(bool state));
+ MOCK_CONST_METHOD0(video_streaming_allowed,
+ bool());
+ MOCK_METHOD1(set_video_streaming_allowed,
+ void(bool state));
+ MOCK_CONST_METHOD0(audio_streaming_allowed,
+ bool());
+ MOCK_METHOD1(set_audio_streaming_allowed,
+ void(bool state));
MOCK_METHOD1(StartStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_METHOD1(StopStreaming, void(protocol_handler::ServiceType service_type));
+ void(protocol_handler::ServiceType service_type));
+ MOCK_METHOD1(StopStreamingForce,
+ void(protocol_handler::ServiceType service_type));
+ MOCK_METHOD1(StopStreaming,
+ void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(SuspendStreaming,
- void(protocol_handler::ServiceType service_type));
+ void(protocol_handler::ServiceType service_type));
MOCK_METHOD1(WakeUpStreaming,
- void(protocol_handler::ServiceType service_type));
- MOCK_CONST_METHOD0(is_voice_communication_supported, bool());
+ void(protocol_handler::ServiceType service_type));
+ MOCK_CONST_METHOD0(is_voice_communication_supported,
+ bool());
MOCK_METHOD1(set_voice_communication_supported,
- void(bool is_voice_communication_supported));
- MOCK_CONST_METHOD0(app_allowed, bool());
- MOCK_CONST_METHOD0(has_been_activated, bool());
- MOCK_METHOD1(set_activated, bool(bool is_active));
- MOCK_CONST_METHOD0(version, const am::Version&());
- MOCK_METHOD1(set_hmi_application_id, void(uint32_t hmi_app_id));
-
- MOCK_CONST_METHOD0(hmi_app_id, uint32_t());
- MOCK_CONST_METHOD0(name, const std::string&());
- MOCK_METHOD1(set_folder_name, void(const std::string& folder_name));
- MOCK_CONST_METHOD0(folder_name, const std::string());
- MOCK_CONST_METHOD0(is_media_application, bool());
- MOCK_CONST_METHOD0(hmi_level, const mobile_apis::HMILevel::eType());
- MOCK_CONST_METHOD0(put_file_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(delete_file_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(list_files_in_none_count, const uint32_t());
- MOCK_CONST_METHOD0(system_context, const mobile_apis::SystemContext::eType());
+ void(bool is_voice_communication_supported));
+ MOCK_CONST_METHOD0(app_allowed,
+ bool());
+ MOCK_CONST_METHOD0(has_been_activated,
+ bool());
+ MOCK_METHOD1(set_activated,
+ bool(bool is_active));
+ MOCK_CONST_METHOD0(version,
+ const application_manager::Version&());
+ MOCK_METHOD1(set_hmi_application_id,
+ void(uint32_t hmi_app_id));
+ MOCK_CONST_METHOD0(hmi_app_id,
+ uint32_t());
+ MOCK_CONST_METHOD0(app_id,
+ uint32_t());
+ MOCK_CONST_METHOD0(name,
+ const custom_str::CustomString&());
+ MOCK_METHOD1(set_folder_name,
+ void(const std::string& folder_name));
+ MOCK_CONST_METHOD0(folder_name,
+ const std::string());
+ MOCK_CONST_METHOD0(is_media_application,
+ bool());
+ MOCK_CONST_METHOD0(is_foreground,
+ bool());
+ MOCK_METHOD1(set_foreground,
+ void(bool is_foreground));
+ MOCK_CONST_METHOD0(hmi_level,
+ const mobile_apis::HMILevel::eType());
+ MOCK_CONST_METHOD0(put_file_in_none_count,
+ const uint32_t());
+ MOCK_CONST_METHOD0(delete_file_in_none_count,
+ const uint32_t());
+ MOCK_CONST_METHOD0(list_files_in_none_count,
+ const uint32_t());
+ MOCK_CONST_METHOD0(system_context,
+ const mobile_apis::SystemContext::eType());
MOCK_CONST_METHOD0(audio_streaming_state,
- const mobile_apis::AudioStreamingState::eType());
- MOCK_CONST_METHOD0(app_icon_path, const std::string&());
- MOCK_CONST_METHOD0(device, connection_handler::DeviceHandle());
- MOCK_METHOD0(tts_speak_state, bool());
- MOCK_CONST_METHOD0(CurrentHmiState, am::HmiStatePtr());
- MOCK_CONST_METHOD0(RegularHmiState, am::HmiStatePtr());
- MOCK_CONST_METHOD0(PostponedHmiState, am::HmiStatePtr());
- MOCK_METHOD1(set_tts_properties_in_none, void(bool active));
- MOCK_METHOD0(tts_properties_in_none, bool());
- MOCK_METHOD1(set_tts_properties_in_full, void(bool active));
- MOCK_METHOD0(tts_properties_in_full, bool());
- MOCK_METHOD1(set_version, void(const am::Version& version));
- MOCK_METHOD1(set_name, void(const std::string& name));
- MOCK_METHOD1(set_is_media_application, void(bool is_media));
- MOCK_METHOD0(increment_put_file_in_none_count, void());
- MOCK_METHOD0(increment_delete_file_in_none_count, void());
- MOCK_METHOD0(increment_list_files_in_none_count, void());
- MOCK_METHOD1(set_app_icon_path, bool(const std::string& file_name));
- MOCK_METHOD1(set_app_allowed, void(const bool& allowed));
- MOCK_METHOD1(set_device, void(connection_handler::DeviceHandle device));
- MOCK_CONST_METHOD0(get_grammar_id, uint32_t());
- MOCK_METHOD1(set_grammar_id, void(uint32_t value));
+ const mobile_apis::AudioStreamingState::eType());
+ MOCK_CONST_METHOD0(app_icon_path,
+ const std::string&());
+ MOCK_CONST_METHOD0(device,
+ connection_handler::DeviceHandle());
+ MOCK_METHOD1(set_tts_properties_in_none,
+ void(bool active));
+ MOCK_METHOD0(tts_properties_in_none,
+ bool());
+ MOCK_METHOD1(set_tts_properties_in_full,
+ void(bool active));
+ MOCK_METHOD0(tts_properties_in_full,
+ bool());
+ MOCK_METHOD1(set_version,
+ void(const application_manager::Version& version));
+ MOCK_METHOD1(set_name,
+ void(const custom_str::CustomString& name));
+ MOCK_METHOD1(set_is_media_application,
+ void(bool is_media));
+ MOCK_METHOD0(increment_put_file_in_none_count,
+ void());
+ MOCK_METHOD0(increment_delete_file_in_none_count,
+ void());
+ MOCK_METHOD0(increment_list_files_in_none_count,
+ void());
+ MOCK_METHOD1(set_app_icon_path,
+ bool(const std::string& file_name));
+ MOCK_METHOD1(set_app_allowed,
+ void(const bool& allowed));
+ MOCK_METHOD1(set_device,
+ void(connection_handler::DeviceHandle device));
+ MOCK_CONST_METHOD0(get_grammar_id,
+ uint32_t());
+ MOCK_METHOD1(set_grammar_id,
+ void(uint32_t value));
MOCK_METHOD1(set_protocol_version,
- void(const am::ProtocolVersion& protocol_version));
- MOCK_CONST_METHOD0(protocol_version, am::ProtocolVersion());
- MOCK_METHOD1(set_is_resuming, void(bool));
- MOCK_CONST_METHOD0(is_resuming, bool());
- MOCK_METHOD1(AddFile, bool(const am::AppFile& file));
- MOCK_CONST_METHOD0(getAppFiles, const am::AppFilesMap&());
- MOCK_METHOD1(UpdateFile, bool(const am::AppFile& file));
- MOCK_METHOD1(DeleteFile, bool(const std::string& file_name));
- MOCK_METHOD1(GetFile, const am::AppFile*(const std::string& file_name));
+ void(const application_manager::ProtocolVersion& protocol_version));
+ MOCK_CONST_METHOD0(protocol_version,
+ application_manager::ProtocolVersion());
+ MOCK_METHOD1(set_is_resuming,
+ void(bool is_resuming));
+ MOCK_CONST_METHOD0(is_resuming,
+ bool());
+ MOCK_METHOD1(AddFile,
+ bool(const application_manager::AppFile& file));
+ MOCK_CONST_METHOD0(getAppFiles,
+ const application_manager::AppFilesMap&());
+ MOCK_METHOD1(UpdateFile,
+ bool(const application_manager::AppFile& file));
+ MOCK_METHOD1(DeleteFile,
+ bool(const std::string& file_name));
+ MOCK_METHOD1(GetFile,
+ const application_manager::AppFile*(const std::string& file_name));
MOCK_METHOD1(SubscribeToButton,
- bool(mobile_apis::ButtonName::eType btn_name));
+ bool(mobile_apis::ButtonName::eType btn_name));
MOCK_METHOD1(IsSubscribedToButton,
- bool(mobile_apis::ButtonName::eType btn_name));
+ bool(mobile_apis::ButtonName::eType btn_name));
MOCK_METHOD1(UnsubscribeFromButton,
- bool(mobile_apis::ButtonName::eType btn_name));
- MOCK_METHOD1(SubscribeToIVI, bool(uint32_t vehicle_info_type));
- MOCK_CONST_METHOD1(IsSubscribedToIVI, bool(uint32_t vehicle_info_type));
- MOCK_METHOD1(UnsubscribeFromIVI, bool(uint32_t vehicle_info_type));
- MOCK_METHOD0(ResetDataInNone, void());
+ bool(mobile_apis::ButtonName::eType btn_name));
+ MOCK_METHOD1(SubscribeToIVI,
+ bool(uint32_t vehicle_info_type));
+ MOCK_CONST_METHOD1(IsSubscribedToIVI,
+ bool(uint32_t vehicle_info_type));
+ MOCK_METHOD1(UnsubscribeFromIVI,
+ bool(uint32_t vehicle_info_type));
+ MOCK_METHOD0(ResetDataInNone,
+ void());
MOCK_METHOD2(IsCommandLimitsExceeded,
- bool(mobile_apis::FunctionID::eType cmd_id,
- am::TLimitSource source));
- MOCK_METHOD0(usage_report, am::UsageStatistics&());
- MOCK_METHOD1(SetRegularState, void(am::HmiStatePtr state));
- MOCK_METHOD1(SetPostponedState, void(am::HmiStatePtr state));
- MOCK_METHOD1(AddHMIState, void(am::HmiStatePtr state));
- MOCK_METHOD1(RemoveHMIState, void(am::HmiState::StateID state_id));
+ bool(mobile_apis::FunctionID::eType cmd_id, application_manager::TLimitSource source));
+ MOCK_METHOD0(usage_report,
+ application_manager::UsageStatistics&());
+ MOCK_METHOD1(SetRegularState,
+ void(application_manager::HmiStatePtr state));
+ MOCK_METHOD1(SetPostponedState,
+ void(application_manager::HmiStatePtr state));
+ MOCK_METHOD0(RemovePostponedState,
+ void());
+ MOCK_METHOD1(AddHMIState,
+ void(application_manager::HmiStatePtr state));
+ MOCK_METHOD1(RemoveHMIState,
+ void(application_manager::HmiState::StateID state_id));
+ MOCK_CONST_METHOD0(CurrentHmiState,
+ const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD0(RegularHmiState,
+ const application_manager::HmiStatePtr());
+ MOCK_CONST_METHOD0(PostponedHmiState,
+ const application_manager::HmiStatePtr());
MOCK_METHOD2(SubscribeToSoftButtons,
- void(int32_t cmd_id, const am::SoftButtonID& softbuttons_id));
- MOCK_METHOD1(IsSubscribedToSoftButton, bool(const uint32_t softbutton_id));
- MOCK_METHOD1(UnsubscribeFromSoftButtons, void(int32_t cmd_id));
- MOCK_CONST_METHOD0(IsAudioApplication, bool());
- MOCK_METHOD0(LoadPersistentFiles, void());
-
- // InitialApplicationData methods
- MOCK_CONST_METHOD0(app_types, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_synonyms, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(policy_app_id, std::string());
- MOCK_CONST_METHOD0(tts_name, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(ngn_media_screen_name,
- const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(language, const mobile_apis::Language::eType&());
- MOCK_CONST_METHOD0(ui_language, const mobile_apis::Language::eType&());
- MOCK_METHOD1(set_app_types,
- void(const smart_objects::SmartObject& app_types));
- MOCK_METHOD1(set_vr_synonyms,
- void(const smart_objects::SmartObject& vr_synonyms));
- MOCK_METHOD1(set_policy_app_id, void(const std::string& policy_app_id));
- MOCK_METHOD1(set_tts_name, void(const smart_objects::SmartObject& tts_name));
- MOCK_METHOD1(set_ngn_media_screen_name,
- void(const smart_objects::SmartObject& ngn_name));
- MOCK_METHOD1(set_language,
- void(const mobile_apis::Language::eType& language));
- MOCK_METHOD1(set_ui_language,
- void(const mobile_apis::Language::eType& ui_language));
-
- // DynamicApplicationData methods
- MOCK_CONST_METHOD0(help_prompt, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(timeout_prompt, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_help_title, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(vr_help, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(tbt_state, const mobile_apis::TBTState::eType&());
- MOCK_CONST_METHOD0(show_command, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(tbt_show_command, const smart_objects::SmartObject*());
- MOCK_CONST_METHOD0(SubscribedButtons,
- DataAccessor<am::ButtonSubscriptions>());
- MOCK_CONST_METHOD0(SubscribedIVI,
- DataAccessor<am::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*());
- MOCK_METHOD1(load_global_properties,
- void(const smart_objects::SmartObject& so));
- MOCK_METHOD1(set_help_prompt,
- void(const smart_objects::SmartObject& help_prompt));
- MOCK_METHOD1(set_timeout_prompt,
- void(const smart_objects::SmartObject& timeout_prompt));
- MOCK_METHOD1(set_vr_help_title,
- void(const smart_objects::SmartObject& vr_help_title));
- MOCK_METHOD0(reset_vr_help_title, void());
- MOCK_METHOD1(set_vr_help, void(const smart_objects::SmartObject& vr_help));
- MOCK_METHOD0(reset_vr_help, void());
- MOCK_METHOD1(set_tbt_state,
- void(const mobile_apis::TBTState::eType& tbt_state));
- MOCK_METHOD1(set_show_command,
- void(const smart_objects::SmartObject& show_command));
- MOCK_METHOD1(set_tbt_show_command,
- void(const smart_objects::SmartObject& tbt_show));
- MOCK_METHOD1(set_keyboard_props,
- void(const smart_objects::SmartObject& keyboard_props));
- MOCK_METHOD1(set_menu_title,
- void(const smart_objects::SmartObject& menu_title));
- MOCK_METHOD1(set_menu_icon,
- void(const smart_objects::SmartObject& menu_icon));
- MOCK_CONST_METHOD0(audio_stream_retry_number, uint32_t());
- MOCK_METHOD1(set_audio_stream_retry_number,
- void(const uint32_t& audio_stream_retry_number));
- MOCK_CONST_METHOD0(video_stream_retry_number, uint32_t());
- MOCK_METHOD1(set_video_stream_retry_number,
- void(const uint32_t& video_stream_retry_number));
- MOCK_METHOD2(AddCommand, void(uint32_t cmd_id,
- const smart_objects::SmartObject& command));
- MOCK_METHOD1(RemoveCommand, void(uint32_t cmd_id));
- MOCK_METHOD1(FindCommand, smart_objects::SmartObject*(uint32_t cmd_id));
- MOCK_METHOD2(AddSubMenu,
- void(uint32_t menu_id, const smart_objects::SmartObject& menu));
- MOCK_METHOD1(RemoveSubMenu, void(uint32_t menu_id));
- MOCK_CONST_METHOD1(FindSubMenu,
- smart_objects::SmartObject*(uint32_t menu_id));
- MOCK_METHOD1(IsSubMenuNameAlreadyExist, bool(const std::string& name));
- MOCK_METHOD2(AddChoiceSet,
- void(uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set));
- MOCK_METHOD1(RemoveChoiceSet, void(uint32_t choice_set_id));
- MOCK_METHOD1(FindChoiceSet,
- smart_objects::SmartObject*(uint32_t choice_set_id));
- MOCK_METHOD3(AddPerformInteractionChoiceSet,
- void(uint32_t correlation_id, uint32_t choice_set_id,
- const smart_objects::SmartObject& choice_set));
- MOCK_METHOD1(DeletePerformInteractionChoiceSet,
- void(uint32_t correlation_id));
- MOCK_CONST_METHOD0(performinteraction_choice_set_map,
- DataAccessor<am::PerformChoiceSetMap>());
- MOCK_CONST_METHOD0(commands_map, DataAccessor<am::CommandsMap>());
- MOCK_CONST_METHOD0(sub_menu_map, DataAccessor<am::SubMenuMap>());
- MOCK_CONST_METHOD0(choice_set_map, DataAccessor<am::ChoiceSetMap>());
- MOCK_METHOD1(set_perform_interaction_active, void(uint32_t active));
- MOCK_CONST_METHOD0(is_perform_interaction_active, uint32_t());
- MOCK_METHOD1(set_perform_interaction_mode, void(int32_t mode));
- MOCK_CONST_METHOD0(perform_interaction_mode, int32_t());
- MOCK_METHOD1(set_reset_global_properties_active, void(bool active));
- MOCK_CONST_METHOD0(is_reset_global_properties_active, bool());
- MOCK_CONST_METHOD0(app_id, uint32_t());
+ void(int32_t cmd_id, const application_manager::SoftButtonID& softbuttons_id));
+ MOCK_METHOD1(IsSubscribedToSoftButton,
+ bool(const uint32_t softbutton_id));
+ MOCK_METHOD1(UnsubscribeFromSoftButtons,
+ void(int32_t cmd_id));
+ MOCK_CONST_METHOD0(IsAudioApplication,
+ bool());
+ MOCK_METHOD0(LoadPersistentFiles,
+ void());
};
} // namespace state_controller_test
+} // namespace components
+} // namespace test
+
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_APPLICATION_MOCK_H_
diff --git a/src/components/application_manager/test/state_controller/include/state_controller_mock.h b/src/components/application_manager/test/state_controller/include/state_controller_mock.h
index b9f7dd30dd..d3e2c8b4ce 100644
--- a/src/components/application_manager/test/state_controller/include/state_controller_mock.h
+++ b/src/components/application_manager/test/state_controller/include/state_controller_mock.h
@@ -43,18 +43,20 @@
namespace state_controller_test {
namespace am = application_manager;
-class StateControllerMock :public am::StateController {
+class StateControllerMock : public am::StateController {
public:
- MOCK_METHOD2(SetRegularState, void (
- am::ApplicationSharedPtr, const mobile_apis::AudioStreamingState::eType));
- MOCK_METHOD2(SetRegularState, void (
- am::ApplicationSharedPtr, const mobile_apis::SystemContext::eType));
- MOCK_METHOD3(OnStateChanged, void (
- am::ApplicationSharedPtr, am::HmiStatePtr, am::HmiStatePtr));
- MOCK_METHOD1(ApplyStatesForApp, void (am::ApplicationSharedPtr));
- MOCK_METHOD0(OnNaviStreamingStarted, void ());
- MOCK_METHOD0(OnNaviStreamingStopped, void ());
+ MOCK_METHOD2(SetRegularState,
+ void(am::ApplicationSharedPtr,
+ const mobile_apis::AudioStreamingState::eType));
+ MOCK_METHOD2(SetRegularState,
+ void(am::ApplicationSharedPtr,
+ const mobile_apis::SystemContext::eType));
+ MOCK_METHOD3(OnStateChanged,
+ void(am::ApplicationSharedPtr,
+ am::HmiStatePtr,
+ am::HmiStatePtr));
+ MOCK_METHOD0(OnNaviStreamingStarted, void());
+ MOCK_METHOD0(OnNaviStreamingStopped, void());
};
-
}
-#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_STATE_CONTROLLER_MOCK
+#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_STATE_CONTROLLER_MOCK
diff --git a/src/components/application_manager/test/state_controller/include/statistics_manager_mock.h b/src/components/application_manager/test/state_controller/include/statistics_manager_mock.h
index 4e2dae78d1..aabe583fa9 100644
--- a/src/components/application_manager/test/state_controller/include/statistics_manager_mock.h
+++ b/src/components/application_manager/test/state_controller/include/statistics_manager_mock.h
@@ -37,7 +37,10 @@
#include "gmock/gmock.h"
#include "usage_statistics/statistics_manager.h"
+namespace test {
+namespace components {
namespace state_controller_test {
+
namespace us = usage_statistics;
class StatisticsManagerMock : public us::StatisticsManager {
@@ -49,4 +52,7 @@ class StatisticsManagerMock : public us::StatisticsManager {
};
} // namespace state_controller_test
+}
+}
+
#endif // SRC_COMPONENTS_APPLICATION_MANAGER_TEST_STATE_CONTROLLER_INCLUDE_STATISTICS_MANAGER_MOCK_H_
diff --git a/src/components/application_manager/test/state_controller/state_controller_test.cc b/src/components/application_manager/test/state_controller/state_controller_test.cc
index 488d12b502..a7eee581ad 100644
--- a/src/components/application_manager/test/state_controller/state_controller_test.cc
+++ b/src/components/application_manager/test/state_controller/state_controller_test.cc
@@ -30,12 +30,16 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
#include "application_manager/hmi_state.h"
#include "application_manager/state_controller.h"
#include "application_manager/usage_statistics.h"
-#include "application_manager_mock.h"
+#include "application_manager/application_manager_impl.h"
#include "application_mock.h"
+#include "application_manager/test/mock_message_helper.h"
+#include "connection_handler/mock_connection_handler_settings.h"
+#include "connection_handler/connection_handler_impl.h"
+#include "transport_manager/transport_manager_mock.h"
#include "statistics_manager_mock.h"
#include "utils/lock.h"
#include "utils/data_accessor.h"
@@ -45,6 +49,9 @@
#include "application_manager/smart_object_keys.h"
namespace am = application_manager;
+using am::HmiState;
+using am::HmiStatePtr;
+using am::UsageStatistics;
using ::testing::_;
using ::testing::Return;
using ::testing::ReturnRef;
@@ -53,30 +60,12 @@ using ::testing::Mock;
using ::testing::NiceMock;
using ::testing::InSequence;
using ::testing::Truly;
+using ::testing::AtLeast;
-class MessageHelperMock {
- public:
- MOCK_METHOD3(SendActivateAppToHMI,
- uint32_t(uint32_t const app_id,
- hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority));
- MOCK_METHOD1(SendOnResumeAudioSourceToHMI, void(const uint32_t app_id));
-};
-
-static MessageHelperMock* message_helper_mock_;
-
-uint32_t application_manager::MessageHelper::SendActivateAppToHMI(
- uint32_t const app_id, hmi_apis::Common_HMILevel::eType level,
- bool send_policy_priority) {
- return message_helper_mock_->SendActivateAppToHMI(app_id, level,
- send_policy_priority);
-}
-
-void application_manager::MessageHelper::SendOnResumeAudioSourceToHMI(
- const uint32_t app_id) {
- message_helper_mock_->SendOnResumeAudioSourceToHMI(app_id);
-}
+static application_manager::MockMessageHelper* message_helper_mock_;
+namespace test {
+namespace components {
namespace state_controller_test {
struct HmiStatesComparator {
@@ -88,14 +77,14 @@ struct HmiStatesComparator {
mobile_apis::HMILevel::eType hmi_level,
mobile_apis::AudioStreamingState::eType audio_streaming_state,
mobile_apis::SystemContext::eType system_context)
- : hmi_level_(hmi_level),
- audio_streaming_state_(audio_streaming_state),
- system_context_(system_context) {}
+ : hmi_level_(hmi_level)
+ , audio_streaming_state_(audio_streaming_state)
+ , system_context_(system_context) {}
HmiStatesComparator(am::HmiStatePtr state_ptr)
- : hmi_level_(state_ptr->hmi_level()),
- audio_streaming_state_(state_ptr->audio_streaming_state()),
- system_context_(state_ptr->system_context()) {}
+ : hmi_level_(state_ptr->hmi_level())
+ , audio_streaming_state_(state_ptr->audio_streaming_state())
+ , system_context_(state_ptr->system_context()) {}
bool operator()(am::HmiStatePtr state_ptr) const {
return state_ptr->hmi_level() == hmi_level_ &&
@@ -107,8 +96,7 @@ struct HmiStatesComparator {
struct HmiStatesIDComparator {
am::HmiState::StateID state_id_;
- HmiStatesIDComparator(am::HmiState::StateID state_id)
- : state_id_(state_id) {}
+ HmiStatesIDComparator(am::HmiState::StateID state_id) : state_id_(state_id) {}
bool operator()(am::HmiStatePtr state_ptr) const {
return state_ptr->state_id() == state_id_;
@@ -122,15 +110,23 @@ struct HmiStatesIDComparator {
#define NAVI true
#define NOT_NAVI false
+enum ApplicationType {
+ APP_TYPE_NON_MEDIA,
+ APP_TYPE_NAVI,
+ APP_TYPE_MEDIA,
+ APP_TYPE_ATTENUATED
+};
+
class StateControllerTest : public ::testing::Test {
public:
StateControllerTest()
- : ::testing::Test(),
- usage_stat("0", utils::SharedPtr<us::StatisticsManager>(
- new StatisticsManagerMock)),
- applications_(application_set_, applications_lock_),
- state_ctrl_(&app_manager_mock_) {}
- NiceMock<ApplicationManagerMock> app_manager_mock_;
+ : ::testing::Test()
+ , usage_stat("0",
+ utils::SharedPtr<usage_statistics::StatisticsManager>(
+ new state_controller_test::StatisticsManagerMock))
+ , applications_(application_set_, applications_lock_)
+ , state_ctrl_(&app_manager_mock_) {}
+ NiceMock<application_manager::ApplicationManagerImpl> app_manager_mock_;
am::UsageStatistics usage_stat;
@@ -140,35 +136,35 @@ class StateControllerTest : public ::testing::Test {
am::StateController state_ctrl_;
am::ApplicationSharedPtr simple_app_;
- NiceMock<ApplicationMock>* simple_app_ptr_;
+ NiceMock<MockApplication>* simple_app_ptr_;
uint32_t simple_app_id_ = 1721;
am::ApplicationSharedPtr navi_app_;
- NiceMock<ApplicationMock>* navi_app_ptr_;
+ NiceMock<MockApplication>* navi_app_ptr_;
uint32_t navi_app_id_ = 1762;
am::ApplicationSharedPtr media_app_;
- NiceMock<ApplicationMock>* media_app_ptr_;
+ NiceMock<MockApplication>* media_app_ptr_;
uint32_t media_app_id_ = 1801;
am::ApplicationSharedPtr vc_app_;
- NiceMock<ApplicationMock>* vc_app_ptr_;
+ NiceMock<MockApplication>* vc_app_ptr_;
uint32_t vc_app_id_ = 1825;
am::ApplicationSharedPtr media_navi_app_;
- NiceMock<ApplicationMock>* media_navi_app_ptr_;
+ NiceMock<MockApplication>* media_navi_app_ptr_;
uint32_t media_navi_app_id_ = 1855;
am::ApplicationSharedPtr media_vc_app_;
- NiceMock<ApplicationMock>* media_vc_app_ptr_;
+ NiceMock<MockApplication>* media_vc_app_ptr_;
uint32_t media_vc_app_id_ = 1881;
am::ApplicationSharedPtr navi_vc_app_;
- NiceMock<ApplicationMock>* navi_vc_app_ptr_;
+ NiceMock<MockApplication>* navi_vc_app_ptr_;
uint32_t navi_vc_app_id_ = 1894;
am::ApplicationSharedPtr media_navi_vc_app_;
- NiceMock<ApplicationMock>* media_navi_vc_app_ptr_;
+ NiceMock<MockApplication>* media_navi_vc_app_ptr_;
uint32_t media_navi_vc_app_id_ = 1922;
std::vector<am::HmiStatePtr> valid_states_for_audio_app_;
@@ -177,6 +173,12 @@ class StateControllerTest : public ::testing::Test {
std::vector<am::HmiStatePtr> invalid_states_for_not_audio_app;
std::vector<am::HmiStatePtr> invalid_states_for_audio_app;
std::vector<am::HmiState::StateID> valid_state_ids_;
+ std::vector<am::ApplicationSharedPtr> applications_list_;
+
+ connection_handler_test::MockConnectionHandlerSettings
+ mock_connection_handler_settings;
+ transport_manager_test::MockTransportManager mock_transport_manager;
+ connection_handler::ConnectionHandlerImpl* conn_handler;
am::HmiStatePtr createHmiState(
mobile_apis::HMILevel::eType hmi_level,
@@ -194,11 +196,373 @@ class StateControllerTest : public ::testing::Test {
return state;
}
+ /**
+ * @brief Prepare list of resultant HMI states for testing HMIState
+ * @param result_hmi state will contain resultant HMI states.
+ */
+ void PrepareCommonStateResults(
+ std::vector<am::HmiStatePtr>& result_hmi_state) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_VRSESSION));
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MENU));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_HMI_OBSCURED));
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_ALERT));
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ }
+
+ /**
+ * @brief Prepare list of resultant HMI states for testing HMIState, for
+ * case when SDL supports attenuated mode
+ * @param result_hmi state will contain resultant HMI states.
+ */
+ void PrepareStateResultsForAttenuated(
+ std::vector<am::HmiStatePtr>& result_hmi_state) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::ATTENUATED,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::ATTENUATED,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::ATTENUATED,
+ SystemContext::SYSCTXT_MAIN));
+ }
+
+ /**
+ * @brief Prepare list of resultant HMI states for testing HMIState, for
+ * case if phone call mode is active
+ * @param result_hmi state will contain resultant HMI states.
+ */
+ void PreparePhoneCallHMIStateResults(
+ std::vector<am::HmiStatePtr>& result_hmi_state, ApplicationType app_t) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+
+ switch (app_t) {
+ case APP_TYPE_NON_MEDIA: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(createHmiState(
+ HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_MEDIA: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_NAVI: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ default: { break; }
+ }
+ }
+
+ /**
+ * @brief Prepare list of resultant HMI states for testing HMIState, for
+ * case if VR or TTS mode is active
+ * @param result_hmi state will contain resultant HMI states.
+ */
+ void PrepareVRTTSHMIStateResults(
+ std::vector<am::HmiStatePtr>& result_hmi_state, ApplicationType app_t) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+ switch (app_t) {
+ case APP_TYPE_NON_MEDIA: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_MEDIA:
+ case APP_TYPE_NAVI: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_ATTENUATED: {
+ PrepareStateResultsForAttenuated(result_hmi_state);
+ break;
+ }
+ default: { break; }
+ }
+ }
+
+ /**
+ * @brief Prepare list of resultant HMI states for testing HMIState, for
+ * case if navi streaming mode is active
+ * @param result_hmi state will contain resultant HMI states.
+ */
+ void PrepareNaviStreamingHMIStateResults(
+ std::vector<am::HmiStatePtr>& result_hmi_state, ApplicationType app_t) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+ switch (app_t) {
+ case APP_TYPE_NON_MEDIA: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_MEDIA: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::ATTENUATED,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_NAVI: {
+ result_hmi_state = valid_states_for_audio_app_;
+ break;
+ }
+ default: { break; }
+ }
+ }
+
+ /**
+ * @brief Prepare list of resultant HMI states for testing HMIState, for
+ * case if navi streaming mode and TTS mode are active and SDL supports
+ * attenuated mode
+ * @param result_hmi state will contain resultant HMI states.
+ */
+ void PrepareNaviStreamTTSStateResult(
+ std::vector<am::HmiStatePtr>& result_hmi_state, ApplicationType app_t) {
+ namespace HMILevel = mobile_apis::HMILevel;
+ namespace AudioStreamingState = mobile_apis::AudioStreamingState;
+ namespace SystemContext = mobile_apis::SystemContext;
+ switch (app_t) {
+ case APP_TYPE_NON_MEDIA: {
+ PrepareCommonStateResults(result_hmi_state);
+ result_hmi_state.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ break;
+ }
+ case APP_TYPE_MEDIA:
+ case APP_TYPE_NAVI: {
+ PrepareStateResultsForAttenuated(result_hmi_state);
+ break;
+ }
+ default: { break; }
+ }
+ }
+
+ ApplicationType AppType(uint32_t app_id) {
+ // TODO(AOleynik): Currently there is ongoing discussion regarding mixed
+ // application properties, i.e. is_media_application flag from RAI and
+ // AppHMITypes (NAVIGATION, etc.). Most likely logic should be changed
+ // after conclusion on APPLINK-20231
+ std::vector<am::ApplicationSharedPtr>::iterator app =
+ std::find_if(
+ applications_list_.begin(),
+ applications_list_.end(),
+ [app_id](am::ApplicationSharedPtr a){return app_id == a->app_id();});
+
+ if (app == applications_list_.end()) {
+ return APP_TYPE_NON_MEDIA;
+ }
+
+ if ((*app)->is_navi()) {
+ return APP_TYPE_NAVI;
+ }
+ if ((*app)->is_media_application()) {
+ return APP_TYPE_MEDIA;
+ }
+ return APP_TYPE_NON_MEDIA;
+ }
+
+ void TestSetState(am::ApplicationSharedPtr app,
+ am::HmiStatePtr hmi_state,
+ ApplicationType app_t,
+ void (StateControllerTest::*call_back)(
+ std::vector<am::HmiStatePtr>&, ApplicationType)) {
+ InsertApplication(app);
+ std::vector<am::HmiStatePtr> result_hmi_state;
+ (this->*call_back)(result_hmi_state, app_t);
+ std::vector<am::HmiStatePtr>::iterator it_begin;
+ std::vector<am::HmiStatePtr>::iterator it_end;
+ if (APP_TYPE_NON_MEDIA == app_t) {
+ it_begin = valid_states_for_not_audio_app_.begin();
+ it_end = valid_states_for_not_audio_app_.end();
+ ASSERT_TRUE(result_hmi_state.size() ==
+ valid_states_for_not_audio_app_.size());
+ } else {
+ it_begin = valid_states_for_audio_app_.begin();
+ it_end = valid_states_for_audio_app_.end();
+ ASSERT_TRUE(result_hmi_state.size() ==
+ valid_states_for_audio_app_.size());
+ }
+ std::vector<am::HmiStatePtr>::iterator it_result_begin =
+ result_hmi_state.begin();
+ for (; it_begin != it_end; ++it_begin, ++it_result_begin) {
+ hmi_state->set_parent(*it_begin);
+ HmiStatesComparator st_comp(hmi_state);
+ ASSERT_TRUE(st_comp(*it_result_begin));
+ }
+ }
+
+ void TestSetSeveralState(
+ am::ApplicationSharedPtr app,
+ am::HmiStatePtr first_hmi_state,
+ am::HmiStatePtr second_hmi_state,
+ ApplicationType app_t,
+ void (StateControllerTest::*call_back)(std::vector<am::HmiStatePtr>&,
+ ApplicationType)) {
+ InsertApplication(app);
+ std::vector<am::HmiStatePtr> result_hmi_state;
+ (this->*call_back)(result_hmi_state, app_t);
+ std::vector<am::HmiStatePtr>::iterator it_begin;
+ std::vector<am::HmiStatePtr>::iterator it_end;
+ if (APP_TYPE_NON_MEDIA == app_t) {
+ it_begin = valid_states_for_not_audio_app_.begin();
+ it_end = valid_states_for_not_audio_app_.end();
+ ASSERT_TRUE(result_hmi_state.size() ==
+ valid_states_for_not_audio_app_.size());
+ } else {
+ it_begin = valid_states_for_audio_app_.begin();
+ it_end = valid_states_for_audio_app_.end();
+ ASSERT_TRUE(result_hmi_state.size() ==
+ valid_states_for_audio_app_.size());
+ }
+ std::vector<am::HmiStatePtr>::iterator it_result_begin =
+ result_hmi_state.begin();
+ for (; it_begin != it_end; ++it_begin, ++it_result_begin) {
+ first_hmi_state->set_parent(*it_begin);
+ second_hmi_state->set_parent(first_hmi_state);
+ HmiStatesComparator st_comp(second_hmi_state);
+ ASSERT_TRUE(st_comp(*it_result_begin)) << second_hmi_state->audio_streaming_state() << "."
+ << second_hmi_state->hmi_level() << "."
+ << second_hmi_state->system_context() << "_"
+ << (*it_result_begin)->audio_streaming_state() << "."
+ << (*it_result_begin)->hmi_level() << "."
+ << (*it_result_begin)->system_context() << "_";
+ }
+ }
+
+ template <typename T, typename Q>
+ void TestMixState(void (StateControllerTest::*call_back_result)(
+ std::vector<am::HmiStatePtr>&, ApplicationType)) {
+ std::vector<am::ApplicationSharedPtr>::iterator it_begin =
+ applications_list_.begin();
+ std::vector<am::ApplicationSharedPtr>::iterator it_end =
+ applications_list_.end();
+ ApplicationType app_type;
+ uint32_t app_id;
+ am::ApplicationSharedPtr app;
+ for (; it_begin != it_end; ++it_begin) {
+ app_id = (*it_begin)->app_id();
+ app_type = AppType(app_id);
+ app = (*it_begin);
+ am::HmiStatePtr state_first =
+ utils::MakeShared<T>(app_id, &app_manager_mock_);
+ am::HmiStatePtr state_second =
+ utils::MakeShared<Q>(app_id, &app_manager_mock_);
+ TestSetSeveralState(
+ app, state_first, state_second, app_type, call_back_result);
+ TestSetSeveralState(
+ app, state_second, state_first, app_type, call_back_result);
+ }
+ }
+
protected:
- am::ApplicationSharedPtr ConfigureApp(NiceMock<ApplicationMock>** app_mock,
- uint32_t app_id, bool media, bool navi,
+ am::ApplicationSharedPtr ConfigureApp(NiceMock<MockApplication>** app_mock,
+ uint32_t app_id,
+ bool media,
+ bool navi,
bool vc) {
- *app_mock = new NiceMock<ApplicationMock>;
+ *app_mock = new NiceMock<MockApplication>;
Mock::AllowLeak(*app_mock); // WorkAround for gogletest bug
am::ApplicationSharedPtr app(*app_mock);
@@ -222,114 +586,146 @@ class StateControllerTest : public ::testing::Test {
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
// Valid states for not audio app
- message_helper_mock_ = new MessageHelperMock;
+ message_helper_mock_ =
+ application_manager::MockMessageHelper::message_helper_mock();
valid_states_for_not_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MAIN));
valid_states_for_not_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_VRSESSION));
valid_states_for_not_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MENU));
valid_states_for_not_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_HMI_OBSCURED));
valid_states_for_not_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_ALERT));
- valid_states_for_not_audio_app_.push_back(createHmiState(
- HMILevel::HMI_BACKGROUND, AudioStreamingState::NOT_AUDIBLE,
- SystemContext::SYSCTXT_MAIN));
valid_states_for_not_audio_app_.push_back(
- createHmiState(HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ valid_states_for_not_audio_app_.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MAIN));
// Valid states audio app
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MAIN));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_VRSESSION));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MENU));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_HMI_OBSCURED));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_ALERT));
- valid_states_for_audio_app_.push_back(createHmiState(
- HMILevel::HMI_BACKGROUND, AudioStreamingState::NOT_AUDIBLE,
- SystemContext::SYSCTXT_MAIN));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::AUDIBLE,
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MAIN));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::ATTENUATED,
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::AUDIBLE,
SystemContext::SYSCTXT_MAIN));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_FULL, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::ATTENUATED,
SystemContext::SYSCTXT_MAIN));
valid_states_for_audio_app_.push_back(
- createHmiState(HMILevel::HMI_FULL, AudioStreamingState::AUDIBLE,
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ valid_states_for_audio_app_.push_back(
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::AUDIBLE,
SystemContext::SYSCTXT_MAIN));
// Common Invalid States
common_invalid_states_.push_back(
- createHmiState(HMILevel::INVALID_ENUM, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::INVALID_ENUM,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::SYSCTXT_MAIN));
common_invalid_states_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::INVALID_ENUM,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::INVALID_ENUM,
SystemContext::SYSCTXT_MAIN));
common_invalid_states_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
SystemContext::INVALID_ENUM));
- common_invalid_states_.push_back(createHmiState(
- HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::SYSCTXT_MAIN));
common_invalid_states_.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::INVALID_ENUM,
+ createHmiState(HMILevel::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::SYSCTXT_MAIN));
+ common_invalid_states_.push_back(
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::INVALID_ENUM));
+ common_invalid_states_.push_back(
+ createHmiState(HMILevel::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
SystemContext::INVALID_ENUM));
- common_invalid_states_.push_back(createHmiState(
- HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::INVALID_ENUM));
- common_invalid_states_.push_back(createHmiState(
- HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::INVALID_ENUM));
+
// Invalid States for audio apps
invalid_states_for_audio_app.push_back(
- createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::NOT_AUDIBLE,
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN));
+ invalid_states_for_audio_app.push_back(
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::AUDIBLE,
SystemContext::SYSCTXT_MAIN));
invalid_states_for_audio_app.push_back(
- createHmiState(HMILevel::HMI_BACKGROUND, AudioStreamingState::AUDIBLE,
+ createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::ATTENUATED,
SystemContext::SYSCTXT_MAIN));
- invalid_states_for_audio_app.push_back(createHmiState(
- HMILevel::HMI_BACKGROUND, AudioStreamingState::ATTENUATED,
- SystemContext::SYSCTXT_MAIN));
invalid_states_for_audio_app.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::AUDIBLE,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::AUDIBLE,
SystemContext::SYSCTXT_MAIN));
invalid_states_for_audio_app.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::ATTENUATED,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::ATTENUATED,
SystemContext::SYSCTXT_MAIN));
invalid_states_for_audio_app.push_back(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::ATTENUATED,
+ createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::ATTENUATED,
SystemContext::SYSCTXT_MAIN));
// Invalid States for not audio apps
invalid_states_for_not_audio_app.push_back(
- createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::ATTENUATED,
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::ATTENUATED,
SystemContext::SYSCTXT_MAIN));
invalid_states_for_not_audio_app.push_back(
- createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::AUDIBLE,
+ createHmiState(HMILevel::HMI_LIMITED,
+ AudioStreamingState::AUDIBLE,
SystemContext::SYSCTXT_MAIN));
invalid_states_for_not_audio_app.push_back(
- createHmiState(HMILevel::HMI_FULL, AudioStreamingState::ATTENUATED,
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::ATTENUATED,
SystemContext::SYSCTXT_MAIN));
invalid_states_for_not_audio_app.push_back(
- createHmiState(HMILevel::HMI_FULL, AudioStreamingState::AUDIBLE,
+ createHmiState(HMILevel::HMI_FULL,
+ AudioStreamingState::AUDIBLE,
SystemContext::SYSCTXT_MAIN));
// Valid state ids
@@ -341,21 +737,29 @@ class StateControllerTest : public ::testing::Test {
}
void ConfigureApps() {
- simple_app_ = ConfigureApp(&simple_app_ptr_, simple_app_id_, NOT_MEDIA,
- NOT_NAVI, NOT_VC);
+ simple_app_ = ConfigureApp(
+ &simple_app_ptr_, simple_app_id_, NOT_MEDIA, NOT_NAVI, NOT_VC);
media_app_ =
ConfigureApp(&media_app_ptr_, media_app_id_, MEDIA, NOT_NAVI, NOT_VC);
navi_app_ =
ConfigureApp(&navi_app_ptr_, navi_app_id_, NOT_MEDIA, NAVI, NOT_VC);
vc_app_ = ConfigureApp(&vc_app_ptr_, vc_app_id_, NOT_MEDIA, NOT_NAVI, VC);
- media_navi_app_ = ConfigureApp(&media_navi_app_ptr_, media_navi_app_id_,
- MEDIA, NAVI, NOT_VC);
+ media_navi_app_ = ConfigureApp(
+ &media_navi_app_ptr_, media_navi_app_id_, MEDIA, NAVI, NOT_VC);
media_vc_app_ =
ConfigureApp(&media_vc_app_ptr_, media_vc_app_id_, MEDIA, NOT_NAVI, VC);
navi_vc_app_ =
ConfigureApp(&navi_vc_app_ptr_, navi_vc_app_id_, NOT_MEDIA, NAVI, VC);
- media_navi_vc_app_ = ConfigureApp(&media_navi_vc_app_ptr_,
- media_navi_vc_app_id_, MEDIA, NAVI, VC);
+ media_navi_vc_app_ = ConfigureApp(
+ &media_navi_vc_app_ptr_, media_navi_vc_app_id_, MEDIA, NAVI, VC);
+ applications_list_.push_back(simple_app_);
+ applications_list_.push_back(media_app_);
+ applications_list_.push_back(navi_app_);
+ applications_list_.push_back(vc_app_);
+ applications_list_.push_back(media_navi_app_);
+ applications_list_.push_back(media_vc_app_);
+ applications_list_.push_back(navi_vc_app_);
+ applications_list_.push_back(media_navi_vc_app_);
}
void CheckAppConfiguration() {
ASSERT_EQ(simple_app_.get(), simple_app_ptr_);
@@ -413,18 +817,41 @@ class StateControllerTest : public ::testing::Test {
ASSERT_TRUE(media_navi_vc_app_->is_voice_communication_supported());
}
- void SetUp() {
+ virtual void SetUp() OVERRIDE {
ON_CALL(app_manager_mock_, applications())
.WillByDefault(Return(applications_));
ConfigureApps();
CheckAppConfiguration();
FillStatesLists();
+ SetConnection();
}
- void TearDown() { delete message_helper_mock_; }
+ virtual void TearDown() OVERRIDE {
+ delete conn_handler;
+ }
+
+ void SetConnection() {
+ conn_handler = new connection_handler::ConnectionHandlerImpl(
+ mock_connection_handler_settings, mock_transport_manager);
+ ON_CALL(app_manager_mock_, connection_handler())
+ .WillByDefault(Return(conn_handler));
+ }
+
+ void SetBCActivateAppRequestToHMI(mobile_apis::HMILevel::eType set_lvl,
+ uint32_t corr_id) {
+ smart_objects::SmartObjectSPtr bc_activate_app_request =
+ new smart_objects::SmartObject();
+ const hmi_apis::Common_HMILevel::eType hmi_lvl =
+ static_cast<hmi_apis::Common_HMILevel::eType>(set_lvl);
+ (*bc_activate_app_request)[am::strings::params]
+ [am::strings::correlation_id] = corr_id;
+ EXPECT_CALL(*message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, hmi_lvl, _))
+ .WillOnce(Return(bc_activate_app_request));
+ }
void ExpectSuccesfullSetHmiState(am::ApplicationSharedPtr app,
- NiceMock<ApplicationMock>* app_mock,
+ NiceMock<MockApplication>* app_mock,
am::HmiStatePtr old_state,
am::HmiStatePtr new_state) {
EXPECT_CALL(*app_mock, CurrentHmiState())
@@ -434,15 +861,18 @@ class StateControllerTest : public ::testing::Test {
SetRegularState(Truly(HmiStatesComparator(new_state))));
if (!HmiStatesComparator(old_state)(new_state)) {
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app));
- EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(app->app_id(), old_state->hmi_level(),
- new_state->hmi_level()));
+ EXPECT_CALL(
+ app_manager_mock_,
+ OnHMILevelChanged(
+ app->app_id(), old_state->hmi_level(), new_state->hmi_level()));
}
}
void ExpectAppChangeHmiStateDueToConflictResolving(
- am::ApplicationSharedPtr app, NiceMock<ApplicationMock>* app_mock,
- am::HmiStatePtr old_state, am::HmiStatePtr new_state) {
+ am::ApplicationSharedPtr app,
+ NiceMock<MockApplication>* app_mock,
+ am::HmiStatePtr old_state,
+ am::HmiStatePtr new_state) {
EXPECT_CALL(*app_mock, RegularHmiState())
.WillOnce(Return(old_state))
.WillOnce(Return(old_state));
@@ -450,7 +880,8 @@ class StateControllerTest : public ::testing::Test {
}
void ExpectAppWontChangeHmiStateDueToConflictResolving(
- am::ApplicationSharedPtr app, NiceMock<ApplicationMock>* app_mock,
+ am::ApplicationSharedPtr app,
+ NiceMock<MockApplication>* app_mock,
am::HmiStatePtr state) {
EXPECT_CALL(*app_mock, RegularHmiState()).WillOnce(Return(state));
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(app)).Times(0);
@@ -495,7 +926,7 @@ class StateControllerTest : public ::testing::Test {
}
void CheckStateApplyingForApplication(
- NiceMock<ApplicationMock>& application,
+ NiceMock<MockApplication>& application,
std::vector<am::HmiState::StateID>& state_ids) {
using smart_objects::SmartObject;
using am::event_engine::Event;
@@ -507,7 +938,7 @@ class StateControllerTest : public ::testing::Test {
for (uint32_t i = 0; i < state_ids.size(); ++i) {
am::HmiState::StateID state_id = state_ids[i];
EXPECT_CALL(application,
- AddHMIState(Truly(HmiStatesIDComparator(state_id)))).Times(1);
+ AddHMIState(Truly(HmiStatesIDComparator(state_id)))).Times(1);
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
@@ -521,19 +952,23 @@ class StateControllerTest : public ::testing::Test {
break;
}
case am::HmiState::StateID::STATE_ID_PHONE_CALL: {
- Event phone_call_event(
- FunctionID::BasicCommunication_OnPhoneCall);
+ Event phone_call_event(FunctionID::BasicCommunication_OnEventChanged);
SmartObject message;
- message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::is_active] =
+ true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::PHONE_CALL;
phone_call_event.set_smart_object(message);
state_ctrl_.on_event(phone_call_event);
break;
}
case am::HmiState::StateID::STATE_ID_SAFETY_MODE: {
- Event emergency_event(
- FunctionID::BasicCommunication_OnEmergencyEvent);
+ Event emergency_event(FunctionID::BasicCommunication_OnEventChanged);
SmartObject message;
- message[am::strings::msg_params][am::hmi_response::enabled] = true;
+ message[am::strings::msg_params][am::hmi_notification::is_active] =
+ true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::EMERGENCY_EVENT;
emergency_event.set_smart_object(message);
state_ctrl_.on_event(emergency_event);
break;
@@ -553,6 +988,10 @@ class StateControllerTest : public ::testing::Test {
am::HmiState::StateID state_id = state_ids[i];
EXPECT_CALL(application, RemoveHMIState(state_id)).Times(1);
+ EXPECT_CALL(application, PostponedHmiState())
+ .WillOnce(Return(NoneNotAudibleState()));
+ EXPECT_CALL(application, RemovePostponedState());
+
switch (state_id) {
case am::HmiState::StateID::STATE_ID_VR_SESSION: {
Event vr_stop_event(FunctionID::VR_Stopped);
@@ -565,19 +1004,23 @@ class StateControllerTest : public ::testing::Test {
break;
}
case am::HmiState::StateID::STATE_ID_PHONE_CALL: {
- Event phone_call_event(
- FunctionID::BasicCommunication_OnPhoneCall);
+ Event phone_call_event(FunctionID::BasicCommunication_OnEventChanged);
SmartObject message;
- message[am::strings::msg_params][am::hmi_notification::is_active] = false;
+ message[am::strings::msg_params][am::hmi_notification::is_active] =
+ false;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::PHONE_CALL;
phone_call_event.set_smart_object(message);
state_ctrl_.on_event(phone_call_event);
break;
}
case am::HmiState::StateID::STATE_ID_SAFETY_MODE: {
- Event emergency_event(
- FunctionID::BasicCommunication_OnEmergencyEvent);
+ Event emergency_event(FunctionID::BasicCommunication_OnEventChanged);
SmartObject message;
- message[am::strings::msg_params][am::hmi_response::enabled] = false;
+ message[am::strings::msg_params][am::hmi_notification::is_active] =
+ false;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::EMERGENCY_EVENT;
emergency_event.set_smart_object(message);
state_ctrl_.on_event(emergency_event);
break;
@@ -612,13 +1055,14 @@ TEST_F(StateControllerTest, OnStateChangedWithDifferentStates) {
for (uint32_t j = 0; j < valid_states_for_not_audio_app_.size(); ++j) {
HmiStatesComparator comp(valid_states_for_not_audio_app_[i]);
if (!comp(valid_states_for_not_audio_app_[j])) {
- EXPECT_CALL(app_manager_mock_,
- SendHMIStatusNotification(simple_app_)).Times(1);
- EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(
- simple_app_id_,
- valid_states_for_not_audio_app_[i]->hmi_level(),
- valid_states_for_not_audio_app_[j]->hmi_level())).Times(1);
+ EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
+ .Times(1);
+ EXPECT_CALL(
+ app_manager_mock_,
+ OnHMILevelChanged(simple_app_id_,
+ valid_states_for_not_audio_app_[i]->hmi_level(),
+ valid_states_for_not_audio_app_[j]->hmi_level()))
+ .Times(1);
if (mobile_apis::HMILevel::HMI_NONE ==
valid_states_for_not_audio_app_[j]->hmi_level()) {
EXPECT_CALL(*simple_app_ptr_, ResetDataInNone()).Times(1);
@@ -654,26 +1098,25 @@ TEST_F(StateControllerTest, OnStateChangedToNone) {
}
TEST_F(StateControllerTest, MoveSimpleAppToValidStates) {
- using am::HmiState;
- using am::HmiStatePtr;
- using am::UsageStatistics;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- HmiStatePtr initial_state =
- createHmiState(HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::INVALID_ENUM);
+ HmiStatePtr initial_state = createHmiState(HMILevel::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::INVALID_ENUM);
for (std::vector<HmiStatePtr>::iterator it =
valid_states_for_not_audio_app_.begin();
- it != valid_states_for_not_audio_app_.end(); ++it) {
+ it != valid_states_for_not_audio_app_.end();
+ ++it) {
HmiStatePtr state_to_setup = *it;
EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_));
EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(simple_app_id_, initial_state->hmi_level(),
+ OnHMILevelChanged(simple_app_id_,
+ initial_state->hmi_level(),
state_to_setup->hmi_level()));
EXPECT_CALL(*simple_app_ptr_,
@@ -683,33 +1126,31 @@ TEST_F(StateControllerTest, MoveSimpleAppToValidStates) {
}
}
-TEST_F(StateControllerTest, MoveAudioAppAppToValidStates) {
- using am::HmiState;
- using am::HmiStatePtr;
- using am::UsageStatistics;
+TEST_F(StateControllerTest, MoveAudioNotResumeAppToValidStates) {
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr audio_app = media_navi_vc_app_;
- NiceMock<ApplicationMock>* audio_app_mock = media_navi_vc_app_ptr_;
+ NiceMock<MockApplication>* audio_app_mock = media_navi_vc_app_ptr_;
- HmiStatePtr initial_state =
- createHmiState(HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::INVALID_ENUM);
+ HmiStatePtr initial_state = createHmiState(HMILevel::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::INVALID_ENUM);
for (std::vector<HmiStatePtr>::iterator it =
valid_states_for_audio_app_.begin();
- it != valid_states_for_audio_app_.end(); ++it) {
+ it != valid_states_for_audio_app_.end();
+ ++it) {
HmiStatePtr state_to_setup = *it;
EXPECT_CALL(*audio_app_mock, CurrentHmiState())
.WillOnce(Return(initial_state))
.WillOnce(Return(state_to_setup));
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app));
- EXPECT_CALL(
- app_manager_mock_,
- OnHMILevelChanged(audio_app->app_id(), initial_state->hmi_level(),
- state_to_setup->hmi_level()));
+ EXPECT_CALL(app_manager_mock_,
+ OnHMILevelChanged(audio_app->app_id(),
+ initial_state->hmi_level(),
+ state_to_setup->hmi_level()));
EXPECT_CALL(*audio_app_mock,
SetRegularState(Truly(HmiStatesComparator(state_to_setup))));
@@ -717,179 +1158,98 @@ TEST_F(StateControllerTest, MoveAudioAppAppToValidStates) {
initial_state = state_to_setup;
}
}
-/*
-TEST_F(StateControllerTest, MoveAppFromValidStateToInvalid) {
- using am::HmiState;
- using am::HmiStatePtr;
- using am::UsageStatistics;
- namespace HMILevel = mobile_apis::HMILevel;
- namespace AudioStreamingState = mobile_apis::AudioStreamingState;
- namespace SystemContext = mobile_apis::SystemContext;
-
- for (std::vector<HmiStatePtr>::iterator valid_state_it =
- valid_states_for_not_audio_app_.begin();
- valid_state_it != valid_states_for_not_audio_app_.end();
- ++valid_state_it) {
- for (std::vector<HmiStatePtr>::iterator invalid_state_it =
- common_invalid_states_.begin();
- invalid_state_it != common_invalid_states_.end(); ++invalid_state_it) {
- HmiStatePtr initial_state = *valid_state_it;
- HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
- .WillOnce(Return(initial_state));
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_.SetRegularState<false>(simple_app_, invalid_state);
- }
- }
-
- NiceMock<ApplicationMock>* audio_app_mock = media_navi_vc_app_ptr_;
- am::ApplicationSharedPtr audio_app = media_navi_vc_app_;
- for (std::vector<HmiStatePtr>::iterator valid_state_it =
- valid_states_for_audio_app_.begin();
- valid_state_it != valid_states_for_audio_app_.end(); ++valid_state_it) {
- for (std::vector<HmiStatePtr>::iterator invalid_state_it =
- invalid_states_for_audio_app.begin();
- invalid_state_it != invalid_states_for_audio_app.end();
- ++invalid_state_it) {
- HmiStatePtr initial_state = *valid_state_it;
- HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
- .WillOnce(Return(initial_state));
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*audio_app_mock, SetRegularState(_)).Times(0);
- state_ctrl_.SetRegularState<false>(audio_app, invalid_state);
- }
- }
-
- for (std::vector<HmiStatePtr>::iterator valid_state_it =
- valid_states_for_not_audio_app_.begin();
- valid_state_it != valid_states_for_not_audio_app_.end();
- ++valid_state_it) {
- for (std::vector<HmiStatePtr>::iterator invalid_state_it =
- invalid_states_for_not_audio_app.begin();
- invalid_state_it != invalid_states_for_not_audio_app.end();
- ++invalid_state_it) {
- HmiStatePtr initial_state = *valid_state_it;
- HmiStatePtr invalid_state = *invalid_state_it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
- .WillOnce(Return(initial_state));
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_.SetRegularState<false>(simple_app_, invalid_state);
- }
- }
-}
-TEST_F(StateControllerTest, MoveAppFromInValidStateToValid) {
- using am::HmiState;
- using am::HmiStatePtr;
- using am::UsageStatistics;
+TEST_F(StateControllerTest, MoveAudioResumeAppToValidStates) {
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* audio_app_mock = media_navi_vc_app_ptr_;
am::ApplicationSharedPtr audio_app = media_navi_vc_app_;
- HmiStatePtr invalid_state =
- createHmiState(HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::INVALID_ENUM);
+ NiceMock<MockApplication>* audio_app_mock = media_navi_vc_app_ptr_;
+
+ HmiStatePtr initial_state = createHmiState(HMILevel::INVALID_ENUM,
+ AudioStreamingState::INVALID_ENUM,
+ SystemContext::INVALID_ENUM);
+ // Set all valid states for audio app
for (std::vector<HmiStatePtr>::iterator it =
valid_states_for_audio_app_.begin();
- it != valid_states_for_audio_app_.end(); ++it) {
- HmiStatePtr initial_state = *it;
+ it != valid_states_for_audio_app_.end();
+ ++it) {
+ HmiStatePtr state_to_setup = *it;
+ HmiStatePtr state_to_check = state_to_setup;
+ // First time current state is initial, then it changes to setup state
EXPECT_CALL(*audio_app_mock, CurrentHmiState())
- .WillOnce(Return(initial_state));
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*audio_app_mock, SetRegularState(_)).Times(0);
- state_ctrl_.SetRegularState<false>(audio_app, invalid_state);
- }
+ .WillOnce(Return(initial_state))
+ .WillOnce(Return(state_to_setup));
+ // Audio resume app when HMI level is LIMITED or FULL gets audible state
+ if (state_to_setup->hmi_level() == HMILevel::HMI_LIMITED) {
+ EXPECT_CALL(*audio_app_mock, is_resuming()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*message_helper_mock_,
+ SendOnResumeAudioSourceToHMI(media_navi_vc_app_id_));
+ state_to_check->set_audio_streaming_state(AudioStreamingState::AUDIBLE);
- for (std::vector<HmiStatePtr>::iterator it =
- valid_states_for_not_audio_app_.begin();
- it != valid_states_for_not_audio_app_.end(); ++it) {
- HmiStatePtr initial_state = *it;
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
- .WillOnce(Return(initial_state));
- EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
- EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
- state_ctrl_.SetRegularState<false>(simple_app_, invalid_state);
+ } else {
+ if (state_to_setup->hmi_level() == HMILevel::HMI_FULL) {
+ state_to_check->set_audio_streaming_state(AudioStreamingState::AUDIBLE);
+ }
+ EXPECT_CALL(*audio_app_mock, is_resuming()).WillRepeatedly(Return(true));
+ }
+ EXPECT_CALL(app_manager_mock_, active_application())
+ .WillRepeatedly(Return(am::ApplicationSharedPtr()));
+ EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(audio_app))
+ .Times(AtLeast(0));
+ EXPECT_CALL(app_manager_mock_,
+ OnHMILevelChanged(audio_app->app_id(),
+ initial_state->hmi_level(),
+ state_to_setup->hmi_level()))
+ .Times(AtLeast(0));
+
+ // Check that we set correct state
+ EXPECT_CALL(*audio_app_mock,
+ SetRegularState(Truly(HmiStatesComparator(state_to_check))));
+ state_ctrl_.SetRegularState<false>(media_navi_vc_app_, state_to_setup);
+ initial_state = state_to_setup;
}
}
-TEST_F(StateControllerTest, MoveAppFromInValidStateToInvalid) {
+TEST_F(StateControllerTest, MoveAppFromValidStateToInvalid) {
using am::HmiState;
using am::HmiStatePtr;
- using am::UsageStatistics;
- namespace HMILevel = mobile_apis::HMILevel;
- namespace AudioStreamingState = mobile_apis::AudioStreamingState;
- namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* audio_app_mock = media_navi_vc_app_ptr_;
- am::ApplicationSharedPtr audio_app = media_navi_vc_app_;
- HmiStatePtr initial_invalid_state =
- createHmiState(HMILevel::INVALID_ENUM, AudioStreamingState::INVALID_ENUM,
- SystemContext::INVALID_ENUM);
-
- am::ApplicationConstSharedPtr const_audio_app(audio_app);
-
- for (std::vector<HmiStatePtr>::iterator it =
- invalid_states_for_audio_app.begin();
- it != invalid_states_for_audio_app.end(); ++it) {
- HmiStatePtr state_to_setup = *it;
- HmiStatePtr default_state =
- createHmiState(HMILevel::HMI_LIMITED, AudioStreamingState::AUDIBLE,
- SystemContext::SYSCTXT_MAIN);
- EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(const_audio_app))
- .WillOnce(Return(HMILevel::HMI_LIMITED));
- EXPECT_CALL(*audio_app_mock, CurrentHmiState())
- .WillOnce(Return(initial_invalid_state))
- .WillOnce(Return(initial_invalid_state))
- .WillOnce(Return(default_state));
- EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(audio_app->app_id(),
- initial_invalid_state->hmi_level(),
- default_state->hmi_level()));
- EXPECT_CALL(*audio_app_mock,
- SetRegularState(Truly(HmiStatesComparator(default_state))));
- state_ctrl_.SetRegularState<false>(audio_app, state_to_setup);
+ for (std::vector<HmiStatePtr>::iterator invalid_state_it =
+ common_invalid_states_.begin();
+ invalid_state_it != common_invalid_states_.end();
+ ++invalid_state_it) {
+ HmiStatePtr invalid_state = *invalid_state_it;
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, is_resuming()).Times(0);
+ EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ state_ctrl_.SetRegularState<false>(simple_app_, invalid_state);
}
- for (std::vector<HmiStatePtr>::iterator it =
- invalid_states_for_not_audio_app.begin();
- it != invalid_states_for_not_audio_app.end(); ++it) {
- HmiStatePtr state_to_setup = *it;
- HmiStatePtr default_state = createHmiState(HMILevel::HMI_BACKGROUND,
- AudioStreamingState::NOT_AUDIBLE,
- SystemContext::SYSCTXT_MAIN);
- am::ApplicationConstSharedPtr const_simple_app(simple_app_);
- EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(const_simple_app))
- .WillOnce(Return(HMILevel::HMI_BACKGROUND));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
- .WillOnce(Return(initial_invalid_state))
- .WillOnce(Return(initial_invalid_state))
- .WillOnce(Return(default_state));
- EXPECT_CALL(app_manager_mock_,
- OnHMILevelChanged(simple_app_ptr_->app_id(),
- initial_invalid_state->hmi_level(),
- default_state->hmi_level()));
- EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(default_state))));
- state_ctrl_.SetRegularState<false>(simple_app_, state_to_setup);
+ for (std::vector<HmiStatePtr>::iterator invalid_state_it =
+ common_invalid_states_.begin();
+ invalid_state_it != common_invalid_states_.end();
+ ++invalid_state_it) {
+ HmiStatePtr invalid_state = *invalid_state_it;
+ EXPECT_CALL(*media_navi_vc_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, is_resuming()).Times(0);
+ EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(_, _, _)).Times(0);
+ EXPECT_CALL(*media_navi_vc_app_ptr_, SetRegularState(_)).Times(0);
+ state_ctrl_.SetRegularState<false>(media_navi_vc_app_, invalid_state);
}
}
-*/
+
TEST_F(StateControllerTest, SetFullToSimpleAppWhileAnotherSimpleAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_in_full;
- NiceMock<ApplicationMock>* app_in_full_mock;
+ NiceMock<MockApplication>* app_in_full_mock;
am::ApplicationSharedPtr app_moved_to_full;
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<MockApplication>* app_moved_to_full_mock;
app_in_full =
ConfigureApp(&app_in_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -899,8 +1259,10 @@ TEST_F(StateControllerTest, SetFullToSimpleAppWhileAnotherSimpleAppIsInFull) {
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullNotAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullNotAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullNotAudibleState(), BackgroundState());
@@ -909,22 +1271,22 @@ TEST_F(StateControllerTest, SetFullToSimpleAppWhileAnotherSimpleAppIsInFull) {
}
TEST_F(StateControllerTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_in_full = media_navi_vc_app_;
- NiceMock<ApplicationMock>* app_in_full_mock = media_navi_vc_app_ptr_;
+ NiceMock<MockApplication>* app_in_full_mock = media_navi_vc_app_ptr_;
am::ApplicationSharedPtr app_moved_to_full = simple_app_;
- NiceMock<ApplicationMock>* app_moved_to_full_mock = simple_app_ptr_;
+ NiceMock<MockApplication>* app_moved_to_full_mock = simple_app_ptr_;
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullNotAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullNotAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
@@ -933,23 +1295,23 @@ TEST_F(StateControllerTest, SetFullToSimpleAppWhileAudioAppAppIsInFull) {
TEST_F(StateControllerTest,
SetFullToAudioAppAppWhileAnotherTypeAudioAppAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_in_full = media_app_;
- NiceMock<ApplicationMock>* app_in_full_mock = media_app_ptr_;
+ NiceMock<MockApplication>* app_in_full_mock = media_app_ptr_;
am::ApplicationSharedPtr app_moved_to_full = navi_app_;
- NiceMock<ApplicationMock>* app_moved_to_full_mock = navi_app_ptr_;
+ NiceMock<MockApplication>* app_moved_to_full_mock = navi_app_ptr_;
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), LimitedState());
@@ -958,23 +1320,23 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetFullToAudioAppAppWhileSameTypeAudioAppAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* app_in_full_mock;
+ NiceMock<MockApplication>* app_in_full_mock;
am::ApplicationSharedPtr app_in_full =
ConfigureApp(&app_in_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1796, MEDIA, NOT_NAVI, NOT_VC);
InsertApplication(app_in_full);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState(), BackgroundState());
@@ -984,24 +1346,24 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetFullToAudioAppAppWhileSameTypeAudioAppAppIsInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* app_in_limited_mock;
+ NiceMock<MockApplication>* app_in_limited_mock;
am::ApplicationSharedPtr app_in_limited =
ConfigureApp(&app_in_limited_mock, 1761, NOT_MEDIA, NAVI, NOT_VC);
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1796, NOT_MEDIA, NAVI, VC);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_full);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
@@ -1011,24 +1373,24 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetLimitedToAudioAppAppWhileSameTypeAudioAppAppIsInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* app_in_limited_mock;
+ NiceMock<MockApplication>* app_in_limited_mock;
am::ApplicationSharedPtr app_in_limited =
ConfigureApp(&app_in_limited_mock, 1761, NOT_MEDIA, NOT_NAVI, VC);
- NiceMock<ApplicationMock>* app_moved_to_limited_mock;
+ NiceMock<MockApplication>* app_moved_to_limited_mock;
am::ApplicationSharedPtr app_moved_to_limited =
ConfigureApp(&app_moved_to_limited_mock, 1796, NOT_MEDIA, NOT_NAVI, VC);
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited, app_moved_to_limited_mock,
- BackgroundState(), LimitedState());
+ ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ app_moved_to_limited_mock,
+ BackgroundState(),
+ LimitedState());
ExpectAppChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState(), BackgroundState());
@@ -1038,22 +1400,22 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetLimitedToAudioAppAppWhileOtherTypeAudioAppAppIsInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_in_limited = navi_app_;
- NiceMock<ApplicationMock>* app_in_limited_mock = navi_app_ptr_;
+ NiceMock<MockApplication>* app_in_limited_mock = navi_app_ptr_;
am::ApplicationSharedPtr app_moved_to_limited = vc_app_;
- NiceMock<ApplicationMock>* app_moved_to_limited_mock = vc_app_ptr_;
+ NiceMock<MockApplication>* app_moved_to_limited_mock = vc_app_ptr_;
InsertApplication(app_in_limited);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited, app_moved_to_limited_mock,
- BackgroundState(), LimitedState());
+ ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ app_moved_to_limited_mock,
+ BackgroundState(),
+ LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_limited, app_in_limited_mock, LimitedState());
state_ctrl_.SetRegularState<false>(app_moved_to_limited, LimitedState());
@@ -1061,22 +1423,22 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetLimitedToAudioAppAppWhileOtherTypeAudioAppAppIsInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_in_full = navi_app_;
- NiceMock<ApplicationMock>* app_in_full_mock = navi_app_ptr_;
+ NiceMock<MockApplication>* app_in_full_mock = navi_app_ptr_;
am::ApplicationSharedPtr app_moved_to_limited = vc_app_;
- NiceMock<ApplicationMock>* app_moved_to_limited_mock = vc_app_ptr_;
+ NiceMock<MockApplication>* app_moved_to_limited_mock = vc_app_ptr_;
InsertApplication(app_in_full);
InsertApplication(app_moved_to_limited);
- ExpectSuccesfullSetHmiState(app_moved_to_limited, app_moved_to_limited_mock,
- BackgroundState(), LimitedState());
+ ExpectSuccesfullSetHmiState(app_moved_to_limited,
+ app_moved_to_limited_mock,
+ BackgroundState(),
+ LimitedState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
app_in_full, app_in_full_mock, FullAudibleState());
@@ -1084,27 +1446,27 @@ TEST_F(StateControllerTest,
}
TEST_F(StateControllerTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_moved_to_full = simple_app_;
- NiceMock<ApplicationMock>* app_moved_to_full_mock = simple_app_ptr_;
+ NiceMock<MockApplication>* app_moved_to_full_mock = simple_app_ptr_;
am::ApplicationSharedPtr limited_app1 = media_app_;
- NiceMock<ApplicationMock>* limited_app1_mock = media_app_ptr_;
+ NiceMock<MockApplication>* limited_app1_mock = media_app_ptr_;
am::ApplicationSharedPtr limited_app2 = navi_vc_app_;
- NiceMock<ApplicationMock>* limited_app2_mock = navi_vc_app_ptr_;
+ NiceMock<MockApplication>* limited_app2_mock = navi_vc_app_ptr_;
InsertApplication(app_moved_to_full);
InsertApplication(limited_app1);
InsertApplication(limited_app2);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullNotAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullNotAudibleState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app1, limited_app1_mock, LimitedState());
@@ -1116,27 +1478,27 @@ TEST_F(StateControllerTest, SetFullToSimpleAppWhile2AudioAppsInLimited) {
TEST_F(StateControllerTest,
SetFullToSimpleAppWhile1AudioAppInLimitedAnd1AudioAppInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
am::ApplicationSharedPtr app_moved_to_full = simple_app_;
- NiceMock<ApplicationMock>* app_moved_to_full_mock = simple_app_ptr_;
+ NiceMock<MockApplication>* app_moved_to_full_mock = simple_app_ptr_;
am::ApplicationSharedPtr limited_app = media_app_;
- NiceMock<ApplicationMock>* limited_app_mock = media_app_ptr_;
+ NiceMock<MockApplication>* limited_app_mock = media_app_ptr_;
am::ApplicationSharedPtr full_app = navi_vc_app_;
- NiceMock<ApplicationMock>* full_app_mock = navi_vc_app_ptr_;
+ NiceMock<MockApplication>* full_app_mock = navi_vc_app_ptr_;
InsertApplication(app_moved_to_full);
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullNotAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullNotAudibleState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app, limited_app_mock, LimitedState());
@@ -1149,20 +1511,18 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetFullToSimpleAppWhile1AudioAppInLimitedAnd1SimpleAppInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1761, NOT_MEDIA, NOT_NAVI, NOT_VC);
am::ApplicationSharedPtr limited_app = media_app_;
- NiceMock<ApplicationMock>* limited_app_mock = media_app_ptr_;
+ NiceMock<MockApplication>* limited_app_mock = media_app_ptr_;
- NiceMock<ApplicationMock>* full_app_mock;
+ NiceMock<MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -1170,8 +1530,10 @@ TEST_F(StateControllerTest,
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullNotAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullNotAudibleState());
ExpectAppWontChangeHmiStateDueToConflictResolving(
limited_app, limited_app_mock, LimitedState());
@@ -1185,21 +1547,19 @@ TEST_F(StateControllerTest,
TEST_F(
StateControllerTest,
SetFullToAudioAppWhile1AudioAppWithSameTypeInLimitedAnd1SimpleAppInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* limited_app_mock;
+ NiceMock<MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* full_app_mock;
+ NiceMock<MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NOT_NAVI, NOT_VC);
@@ -1207,8 +1567,10 @@ TEST_F(
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
limited_app, limited_app_mock, LimitedState(), BackgroundState());
@@ -1222,21 +1584,19 @@ TEST_F(
TEST_F(
StateControllerTest,
SetFullToAudioAppWhileAudioAppWithSameTypeInLimitedAndAudioAppWithOtherTypeInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
- NiceMock<ApplicationMock>* app_moved_to_full_mock;
+ NiceMock<MockApplication>* app_moved_to_full_mock;
am::ApplicationSharedPtr app_moved_to_full =
ConfigureApp(&app_moved_to_full_mock, 1761, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* limited_app_mock;
+ NiceMock<MockApplication>* limited_app_mock;
am::ApplicationSharedPtr limited_app =
ConfigureApp(&limited_app_mock, 1762, MEDIA, NOT_NAVI, NOT_VC);
- NiceMock<ApplicationMock>* full_app_mock;
+ NiceMock<MockApplication>* full_app_mock;
am::ApplicationSharedPtr full_app =
ConfigureApp(&full_app_mock, 1796, NOT_MEDIA, NAVI, NOT_VC);
@@ -1244,8 +1604,10 @@ TEST_F(
InsertApplication(limited_app);
InsertApplication(full_app);
- ExpectSuccesfullSetHmiState(app_moved_to_full, app_moved_to_full_mock,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(app_moved_to_full,
+ app_moved_to_full_mock,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
limited_app, limited_app_mock, LimitedState(), BackgroundState());
@@ -1258,8 +1620,6 @@ TEST_F(
TEST_F(StateControllerTest,
SetFullToAudioAppWhile3AudioAppsWithSameTypeInLimited) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -1268,8 +1628,10 @@ TEST_F(StateControllerTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_, media_navi_vc_app_ptr_,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ media_navi_vc_app_ptr_,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
media_app_, media_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
@@ -1281,8 +1643,6 @@ TEST_F(StateControllerTest,
TEST_F(StateControllerTest,
SetFullToAudioAppWhile2AudioAppsWithSameTypeInLimitedAndOneInFull) {
- using am::HmiState;
- using am::HmiStatePtr;
namespace HMILevel = mobile_apis::HMILevel;
namespace AudioStreamingState = mobile_apis::AudioStreamingState;
namespace SystemContext = mobile_apis::SystemContext;
@@ -1291,8 +1651,10 @@ TEST_F(StateControllerTest,
InsertApplication(media_app_);
InsertApplication(navi_app_);
InsertApplication(vc_app_);
- ExpectSuccesfullSetHmiState(media_navi_vc_app_, media_navi_vc_app_ptr_,
- BackgroundState(), FullAudibleState());
+ ExpectSuccesfullSetHmiState(media_navi_vc_app_,
+ media_navi_vc_app_ptr_,
+ BackgroundState(),
+ FullAudibleState());
ExpectAppChangeHmiStateDueToConflictResolving(
media_app_, media_app_ptr_, LimitedState(), BackgroundState());
ExpectAppChangeHmiStateDueToConflictResolving(
@@ -1302,7 +1664,9 @@ TEST_F(StateControllerTest,
state_ctrl_.SetRegularState<false>(media_navi_vc_app_, FullAudibleState());
}
-TEST_F(StateControllerTest, ActivateAppSuccessReceivedFromHMI) {
+
+// TODO {AKozoriz} Changed logic in state_controller
+TEST_F(StateControllerTest, DISABLED_ActivateAppSuccessReceivedFromHMI) {
using namespace hmi_apis;
using namespace mobile_apis;
@@ -1318,45 +1682,48 @@ TEST_F(StateControllerTest, ActivateAppSuccessReceivedFromHMI) {
StateLevelPair(LimitedState(), Common_HMILevel::LIMITED));
hmi_states.push_back(
StateLevelPair(BackgroundState(), Common_HMILevel::BACKGROUND));
- hmi_states.push_back(StateLevelPair(
- createHmiState(HMILevel::HMI_NONE, AudioStreamingState::NOT_AUDIBLE,
- SystemContext::SYSCTXT_MAIN),
- Common_HMILevel::NONE));
+ hmi_states.push_back(
+ StateLevelPair(createHmiState(HMILevel::HMI_NONE,
+ AudioStreamingState::NOT_AUDIBLE,
+ SystemContext::SYSCTXT_MAIN),
+ Common_HMILevel::NONE));
std::vector<StateLevelPair> initial_hmi_states = hmi_states;
std::vector<StateLevelPair>::iterator it = hmi_states.begin();
std::vector<StateLevelPair>::iterator it2 = initial_hmi_states.begin();
+ smart_objects::SmartObjectSPtr bc_activate_app_request =
+ new smart_objects::SmartObject();
+ (*bc_activate_app_request)[am::strings::params][am::strings::correlation_id] =
+ corr_id;
+
for (; it != hmi_states.end(); ++it) {
- for (; it2 != initial_hmi_states.end(); ++it2) {
- am::HmiStatePtr hmi_state = it->first;
- am::HmiStatePtr initial_hmi_state = it->first;
- Common_HMILevel::eType hmi_level = it->second;
+ am::HmiStatePtr hmi_state = it->first;
+ am::HmiStatePtr initial_hmi_state = it->first;
+ Common_HMILevel::eType hmi_level = it->second;
- EXPECT_CALL(*message_helper_mock_,
- SendActivateAppToHMI(media_app_->app_id(), hmi_level, _))
- .WillOnce(Return(corr_id));
- EXPECT_CALL(app_manager_mock_, application_id(corr_id))
- .WillOnce(Return(hmi_app_id));
- EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
- .WillOnce(Return(media_app_));
- ExpectSuccesfullSetHmiState(media_app_, media_app_ptr_, initial_hmi_state,
- hmi_state);
- state_ctrl_.SetRegularState<true>(media_app_, hmi_state);
- smart_objects::SmartObject message;
- message[am::strings::params][am::hmi_response::code] =
- Common_Result::SUCCESS;
- message[am::strings::params][am::strings::correlation_id] = corr_id;
- am::event_engine::Event event(
- hmi_apis::FunctionID::BasicCommunication_ActivateApp);
- event.set_smart_object(message);
- state_ctrl_.on_event(event);
- }
+ EXPECT_CALL(*message_helper_mock_,
+ GetBCActivateAppRequestToHMI(_, hmi_level, _))
+ .WillOnce(Return(bc_activate_app_request));
+
+ EXPECT_CALL(app_manager_mock_, application_id(corr_id))
+ .WillOnce(Return(hmi_app_id));
+ EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
+ .WillOnce(Return(media_app_));
+ ExpectSuccesfullSetHmiState(
+ media_app_, media_app_ptr_, initial_hmi_state, hmi_state);
+ state_ctrl_.SetRegularState<true>(media_app_, hmi_state);
+ smart_objects::SmartObject message;
+ message[am::strings::params][am::hmi_response::code] =
+ Common_Result::SUCCESS;
+ message[am::strings::params][am::strings::correlation_id] = corr_id;
+ am::event_engine::Event event(
+ hmi_apis::FunctionID::BasicCommunication_ActivateApp);
+ event.set_smart_object(message);
+ state_ctrl_.on_event(event);
}
}
-/*
-TEST_F(StateControllerTest, ActivateAppErrorReceivedFromHMI) {
+
+std::vector<hmi_apis::Common_Result::eType> hmi_result() {
using namespace hmi_apis;
- const uint32_t corr_id = 314;
- const uint32_t hmi_app_id = 2718;
std::vector<Common_Result::eType> hmi_results;
hmi_results.push_back(Common_Result::ABORTED);
hmi_results.push_back(Common_Result::APPLICATION_NOT_REGISTERED);
@@ -1383,29 +1750,31 @@ TEST_F(StateControllerTest, ActivateAppErrorReceivedFromHMI) {
hmi_results.push_back(Common_Result::USER_DISALLOWED);
hmi_results.push_back(Common_Result::WARNINGS);
hmi_results.push_back(Common_Result::WRONG_LANGUAGE);
+ return hmi_results;
+}
+
+TEST_F(StateControllerTest, SendEventBCActivateApp_HMIReceivesError) {
+ using namespace hmi_apis;
+ const uint32_t corr_id = 314;
+ const uint32_t hmi_app_id = 2718;
+ std::vector<Common_Result::eType> hmi_results = hmi_result();
std::vector<Common_Result::eType>::iterator it = hmi_results.begin();
for (; it != hmi_results.end(); ++it) {
- EXPECT_CALL(
- *message_helper_mock_,
- SendActivateAppToHMI(simple_app_->app_id(), Common_HMILevel::FULL, _))
- .WillOnce(Return(corr_id));
EXPECT_CALL(app_manager_mock_, application_id(corr_id))
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
.WillOnce(Return(simple_app_));
- EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
- .WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
- .WillOnce(Return(BackgroundState()))
- .WillOnce(Return(BackgroundState()));
- EXPECT_CALL(*simple_app_ptr_,
- SetRegularState(Truly(HmiStatesComparator(BackgroundState()))));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+
EXPECT_CALL(app_manager_mock_, SendHMIStatusNotification(simple_app_))
.Times(0);
EXPECT_CALL(app_manager_mock_,
OnHMILevelChanged(simple_app_->app_id(), _, _)).Times(0);
- state_ctrl_.SetRegularState<true>(simple_app_, FullNotAudibleState());
+
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] = *it;
message[am::strings::params][am::strings::correlation_id] = corr_id;
@@ -1414,14 +1783,12 @@ TEST_F(StateControllerTest, ActivateAppErrorReceivedFromHMI) {
state_ctrl_.on_event(event);
}
}
-*/
+
TEST_F(StateControllerTest, ActivateAppInvalidCorrelationId) {
using namespace hmi_apis;
const uint32_t corr_id = 314;
const uint32_t hmi_app_id = 2718;
- EXPECT_CALL(*message_helper_mock_,
- SendActivateAppToHMI(simple_app_->app_id(), Common_HMILevel::FULL,
- _)).WillOnce(Return(hmi_app_id));
+
EXPECT_CALL(app_manager_mock_, application_id(corr_id))
.WillOnce(Return(hmi_app_id));
EXPECT_CALL(app_manager_mock_, application_by_hmi_app(hmi_app_id))
@@ -1431,6 +1798,7 @@ TEST_F(StateControllerTest, ActivateAppInvalidCorrelationId) {
.Times(0);
EXPECT_CALL(app_manager_mock_, OnHMILevelChanged(simple_app_->app_id(), _, _))
.Times(0);
+ SetBCActivateAppRequestToHMI(mobile_apis::HMILevel::HMI_FULL, corr_id);
state_ctrl_.SetRegularState<true>(simple_app_, FullNotAudibleState());
smart_objects::SmartObject message;
message[am::strings::params][am::hmi_response::code] = Common_Result::SUCCESS;
@@ -1439,7 +1807,7 @@ TEST_F(StateControllerTest, ActivateAppInvalidCorrelationId) {
event.set_smart_object(message);
state_ctrl_.on_event(event);
}
-/*
+
TEST_F(StateControllerTest, ApplyTempStatesForSimpleApp) {
InsertApplication(simple_app_);
CheckStateApplyingForApplication(*simple_app_ptr_, valid_state_ids_);
@@ -1479,5 +1847,588 @@ TEST_F(StateControllerTest, ApplyTempStatesForMediaNaviVCApp) {
InsertApplication(media_navi_vc_app_);
CheckStateApplyingForApplication(*media_navi_vc_app_ptr_, valid_state_ids_);
}
-*/
+
+TEST_F(StateControllerTest, SetStatePhoneCallForNonMediaApplication) {
+ am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>(
+ simple_app_id_, &app_manager_mock_);
+ TestSetState(simple_app_,
+ state_phone_call,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetStatePhoneCallForMediaApplication) {
+ am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>(
+ media_app_id_, &app_manager_mock_);
+ TestSetState(media_app_,
+ state_phone_call,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetStatePhoneCallForMediaNaviApplication) {
+ am::HmiStatePtr state_phone_call = utils::MakeShared<am::PhoneCallHmiState>(
+ media_navi_app_id_, &app_manager_mock_);
+ TestSetState(media_navi_app_,
+ state_phone_call,
+ APP_TYPE_NAVI,
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetVRStateForNonMediaApplication) {
+ am::HmiStatePtr state_vr =
+ utils::MakeShared<am::VRHmiState>(simple_app_id_, &app_manager_mock_);
+ TestSetState(simple_app_,
+ state_vr,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetVRStateForMediaApplication) {
+ am::HmiStatePtr state_vr =
+ utils::MakeShared<am::VRHmiState>(media_app_id_, &app_manager_mock_);
+ TestSetState(media_app_,
+ state_vr,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetVRStateForMediaNaviVoiceApplication) {
+ am::HmiStatePtr state_vr = utils::MakeShared<am::VRHmiState>(
+ media_navi_vc_app_id_, &app_manager_mock_);
+ TestSetState(media_navi_vc_app_,
+ state_vr,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetTTSStateForNonMediaApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_tts =
+ utils::MakeShared<am::TTSHmiState>(simple_app_id_, &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+ TestSetState(simple_app_,
+ state_tts,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetTTSStateForNonMediaApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_tts =
+ utils::MakeShared<am::TTSHmiState>(simple_app_id_, &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+ TestSetState(simple_app_,
+ state_tts,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetTTSStateForMediaApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_tts =
+ utils::MakeShared<am::TTSHmiState>(media_app_id_, &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+ TestSetState(media_app_,
+ state_tts,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetTTSStateForMediaApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_tts =
+ utils::MakeShared<am::TTSHmiState>(media_app_id_, &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+ TestSetState(media_app_,
+ state_tts,
+ APP_TYPE_ATTENUATED,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetTTSStateForMediaNaviVCApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_tts = utils::MakeShared<am::TTSHmiState>(
+ media_navi_vc_app_id_, &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+ TestSetState(media_navi_vc_app_,
+ state_tts,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetTTSStateForMediaNaviVCApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_tts = utils::MakeShared<am::TTSHmiState>(
+ media_navi_vc_app_id_, &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+ TestSetState(media_navi_vc_app_,
+ state_tts,
+ APP_TYPE_ATTENUATED,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetNaviStreamingStateForNonMediaApplication) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(simple_app_id_,
+ &app_manager_mock_);
+ TestSetState(simple_app_,
+ state_navi_streming,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetNaviStreamingStateMediaApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(media_app_id_,
+ &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+ TestSetState(media_app_,
+ state_navi_streming,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetNaviStreamingStateMediaApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(media_app_id_,
+ &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+ TestSetState(media_app_,
+ state_navi_streming,
+ APP_TYPE_ATTENUATED,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetNaviStreamingStateVCApplicationAttenuatedNotSupported) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(vc_app_id_,
+ &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+ TestSetState(vc_app_,
+ state_navi_streming,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ SetNaviStreamingStateVCApplicationAttenuatedSupported) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(vc_app_id_,
+ &app_manager_mock_);
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+ TestSetState(vc_app_,
+ state_navi_streming,
+ APP_TYPE_ATTENUATED,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetNaviStreamingStateNaviApplication) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(navi_app_id_,
+ &app_manager_mock_);
+ TestSetState(navi_app_,
+ state_navi_streming,
+ APP_TYPE_NAVI,
+ &StateControllerTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetNaviStreamingStateMediaNaviApplication) {
+ am::HmiStatePtr state_navi_streming =
+ utils::MakeShared<am::NaviStreamingHmiState>(media_navi_app_id_,
+ &app_manager_mock_);
+ TestSetState(media_navi_app_,
+ state_navi_streming,
+ APP_TYPE_NAVI,
+ &StateControllerTest::PrepareNaviStreamingHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetSafetyModeStateForNonMediaApplication) {
+ am::HmiStatePtr state_safety_mode = utils::MakeShared<am::SafetyModeHmiState>(
+ simple_app_id_, &app_manager_mock_);
+ TestSetState(simple_app_,
+ state_safety_mode,
+ APP_TYPE_NON_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetSafetyModeStateForMediaApplication) {
+ am::HmiStatePtr state_safety_mode =
+ utils::MakeShared<am::VRHmiState>(media_app_id_, &app_manager_mock_);
+ TestSetState(media_app_,
+ state_safety_mode,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetSafetyModeStateForMediaNaviVoiceApplication) {
+ am::HmiStatePtr state_safety_mode = utils::MakeShared<am::VRHmiState>(
+ media_navi_vc_app_id_, &app_manager_mock_);
+ TestSetState(media_navi_vc_app_,
+ state_safety_mode,
+ APP_TYPE_MEDIA,
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixVRWithPhoneCall) {
+ TestMixState<am::PhoneCallHmiState, am::VRHmiState>(
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixTTSWithPhoneCallAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::PhoneCallHmiState, am::TTSHmiState>(
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixTTSWithPhoneCallAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::PhoneCallHmiState, am::TTSHmiState>(
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ MixNaviStreamingWithPhoneCallAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::PhoneCallHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixNaviStreamingWithPhoneCallAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::PhoneCallHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixSafetyModeWithPhoneCall) {
+ TestMixState<am::PhoneCallHmiState, am::SafetyModeHmiState>(
+ &StateControllerTest::PreparePhoneCallHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixTTSWithVRAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::VRHmiState, am::TTSHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixTTSWithVRAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::VRHmiState, am::TTSHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixNaviStreamingWithVRAttenuatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::VRHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixNaviStreamingWithVRAttenuatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::VRHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixSafetyModeStreamingWithVR) {
+ TestMixState<am::VRHmiState, am::SafetyModeHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixNaviStreamingWithTTSAttenueatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::TTSHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixNaviStreamingWithTTSAttenueatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::TTSHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PrepareNaviStreamTTSStateResult);
+}
+
+TEST_F(StateControllerTest, MixSafetyModeWithTTSAttenueatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::TTSHmiState, am::SafetyModeHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, MixSafetyModeWithTTSAttenueatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::TTSHmiState, am::SafetyModeHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ MixSafetyModeWithNaviStreamingAttenueatedNotSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(false));
+
+ TestMixState<am::SafetyModeHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest,
+ MixSafetyModeWithNaviStreamingAttenueatedSupported) {
+ EXPECT_CALL(app_manager_mock_, is_attenuated_supported())
+ .WillRepeatedly(Return(true));
+
+ TestMixState<am::SafetyModeHmiState, am::NaviStreamingHmiState>(
+ &StateControllerTest::PrepareVRTTSHMIStateResults);
+}
+
+TEST_F(StateControllerTest, SetRegularStateWithNewHmiLvl) {
+ using namespace mobile_apis;
+
+ HMILevel::eType set_lvl = HMILevel::HMI_NONE;
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ .WillOnce(Return(BackgroundState()));
+
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ .WillOnce(Return(BackgroundState()))
+ .WillOnce(Return(BackgroundState()));
+
+ state_ctrl_.SetRegularState(simple_app_, set_lvl);
+
+ set_lvl = HMILevel::HMI_LIMITED;
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ .WillOnce(Return(BackgroundState()));
+
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ .WillOnce(Return(BackgroundState()))
+ .WillOnce(Return(BackgroundState()));
+ state_ctrl_.SetRegularState(simple_app_, set_lvl);
+
+ set_lvl = HMILevel::HMI_FULL;
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ .WillOnce(Return(BackgroundState()));
+
+ const uint32_t corr_id = 314;
+ SetBCActivateAppRequestToHMI(set_lvl, corr_id);
+
+ state_ctrl_.SetRegularState(simple_app_, set_lvl);
+
+ set_lvl = HMILevel::HMI_BACKGROUND;
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ .WillOnce(Return(BackgroundState()));
+
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ .WillOnce(Return(BackgroundState()))
+ .WillOnce(Return(BackgroundState()));
+
+ state_ctrl_.SetRegularState(simple_app_, set_lvl);
+}
+
+TEST_F(StateControllerTest, SetRegularStateWithAudioStateAudible) {
+ using namespace mobile_apis;
+
+ HmiStatePtr check_state = createHmiState(HMILevel::HMI_BACKGROUND,
+ AudioStreamingState::AUDIBLE,
+ SystemContext::SYSCTXT_MAIN);
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState())
+ .WillRepeatedly(Return(BackgroundState()));
+
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ .WillOnce(Return(check_state))
+ .WillOnce(Return(check_state));
+ EXPECT_CALL(*simple_app_ptr_,
+ SetRegularState(Truly(HmiStatesComparator(check_state))));
+
+ state_ctrl_.SetRegularState(simple_app_, AudioStreamingState::AUDIBLE);
+}
+
+TEST_F(StateControllerTest,
+ SetRegularStateToMediaAndNonMediaApps_VRStarted_SetPostponedState) {
+ using namespace mobile_apis;
+
+ // Precondition
+ am::event_engine::Event event(hmi_apis::FunctionID::VR_Started);
+ state_ctrl_.on_event(event);
+
+ HmiStatePtr check_state = FullNotAudibleState();
+
+ // Non-media app can't have LIMITED-AUDIO state
+ EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
+ EXPECT_CALL(app_manager_mock_, active_application())
+ .WillRepeatedly(Return(am::ApplicationSharedPtr()));
+ EXPECT_CALL(*simple_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(simple_app_, check_state);
+
+ check_state = LimitedState();
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(*media_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(media_app_, check_state);
+}
+
+TEST_F(StateControllerTest, SetRegularStateMediaToNonMediaApp_VR_Stopped) {
+ using namespace mobile_apis;
+
+ // Precondition
+ am::event_engine::Event prev_event(hmi_apis::FunctionID::VR_Started);
+ state_ctrl_.on_event(prev_event);
+
+ am::event_engine::Event next_event(hmi_apis::FunctionID::VR_Stopped);
+ state_ctrl_.on_event(next_event);
+
+ // Set state of non-media app after vr has stopped
+ HmiStatePtr check_state = FullNotAudibleState();
+
+ // Non-media app can't have LIMITED-AUDIO state
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState())
+ .WillOnce(Return(check_state))
+ .WillOnce(Return(check_state));
+
+ EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(false));
+
+ EXPECT_CALL(*message_helper_mock_,
+ SendOnResumeAudioSourceToHMI(simple_app_id_)).Times(0);
+ EXPECT_CALL(*simple_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ .Times(0);
+ EXPECT_CALL(*simple_app_ptr_,
+ SetRegularState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(simple_app_, check_state);
+
+ // Set state of media app after vr has stopped
+ check_state = LimitedState();
+
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState())
+ .WillOnce(Return(check_state))
+ .WillOnce(Return(check_state));
+
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+
+ EXPECT_CALL(*message_helper_mock_,
+ SendOnResumeAudioSourceToHMI(media_app_id_));
+ EXPECT_CALL(*media_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))))
+ .Times(0);
+ EXPECT_CALL(*media_app_ptr_,
+ SetRegularState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(media_app_, check_state);
+}
+
+TEST_F(StateControllerTest,
+ SetRegStateForMediaAndNonMediaApps_OnEmergencyEvent_SetPostponedState) {
+ using namespace hmi_apis;
+ using namespace smart_objects;
+ using namespace am::event_engine;
+
+ // Precondition
+ Event event(FunctionID::BasicCommunication_OnEventChanged);
+ SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ Common_EventTypes::EMERGENCY_EVENT;
+
+ event.set_smart_object(message);
+ state_ctrl_.on_event(event);
+
+ // Non-media app can't have LIMITED-AUDIO state
+ HmiStatePtr check_state = FullNotAudibleState();
+ EXPECT_CALL(*simple_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+
+ EXPECT_CALL(*simple_app_ptr_, RegularHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*simple_app_ptr_, SetRegularState(_)).Times(0);
+ EXPECT_CALL(app_manager_mock_, GetDefaultHmiLevel(_))
+ .WillRepeatedly(Return(mobile_apis::HMILevel::HMI_NONE));
+ EXPECT_CALL(app_manager_mock_, active_application())
+ .WillRepeatedly(Return(am::ApplicationSharedPtr()));
+ EXPECT_CALL(*simple_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(simple_app_, check_state);
+
+ // Set media app
+ check_state = LimitedState();
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+
+ EXPECT_CALL(*media_app_ptr_, RegularHmiState()).Times(0);
+ EXPECT_CALL(*media_app_ptr_, CurrentHmiState()).Times(0);
+ EXPECT_CALL(*media_app_ptr_, SetRegularState(_)).Times(0);
+
+ EXPECT_CALL(*media_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(media_app_, check_state);
+}
+
+TEST_F(StateControllerTest,
+ SetStateForMediaApp_BCOnPhoneCall_SetPostponedState) {
+ using namespace hmi_apis;
+ using namespace smart_objects;
+ using namespace am::event_engine;
+
+ // Precondition
+ Event event(FunctionID::BasicCommunication_OnEventChanged);
+ SmartObject message;
+ message[am::strings::msg_params][am::hmi_notification::is_active] = true;
+ message[am::strings::msg_params][am::hmi_notification::event_name] =
+ hmi_apis::Common_EventTypes::PHONE_CALL;
+
+ event.set_smart_object(message);
+ state_ctrl_.on_event(event);
+
+ am::HmiStatePtr check_state = FullAudibleState();
+
+ EXPECT_CALL(*media_app_ptr_, is_resuming()).WillRepeatedly(Return(true));
+
+ EXPECT_CALL(*media_app_ptr_, is_media_application())
+ .WillRepeatedly(Return(true));
+
+ EXPECT_CALL(app_manager_mock_, IsAppTypeExistsInFullOrLimited(_))
+ .WillRepeatedly(Return(false));
+
+ EXPECT_CALL(app_manager_mock_, active_application())
+ .WillRepeatedly(Return(am::ApplicationSharedPtr()));
+
+ EXPECT_CALL(*media_app_ptr_,
+ SetPostponedState(Truly(HmiStatesComparator(check_state))));
+ state_ctrl_.SetRegularState<false>(media_app_, check_state);
+}
+
} // namespace state_controller_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/usage_statistics_test.cc b/src/components/application_manager/test/usage_statistics_test.cc
new file mode 100644
index 0000000000..dc72890769
--- /dev/null
+++ b/src/components/application_manager/test/usage_statistics_test.cc
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "application_manager/usage_statistics.h"
+#include <memory>
+#include "gmock/gmock.h"
+#include "smart_objects/enum_schema_item.h"
+#include "mock_statistics_manager.h"
+#include "mock_app_stopwatch.h"
+#include "utils/make_shared.h"
+#include "utils/shared_ptr.h"
+
+namespace test {
+namespace components {
+namespace usage_statistics_test {
+
+using namespace mobile_apis; // For Language enums
+using namespace NsSmartDeviceLink::NsSmartObjects; // For EnumToCString &
+ // EnumConversionHelper
+using namespace usage_statistics;
+using testing::_;
+
+namespace {
+
+std::string LanguageIdToString(Language::eType lang_id) {
+ const char* str;
+ const bool ok =
+ EnumConversionHelper<Language::eType>::EnumToCString(lang_id, &str);
+ return ok ? str : "unknown";
+}
+
+// Constant values used in tests
+const Language::eType kTestLanguageId = Language::eType::DE_DE;
+const usage_statistics::AppStopwatchId kTestAppStopwatchId =
+ usage_statistics::AppStopwatchId::SECONDS_HMI_NONE;
+const std::string kAppId = "SPT";
+
+} // namespace
+
+class UsageStatisticsTest : public testing::Test {
+ public:
+ UsageStatisticsTest()
+ : mock_statistics_manager_sptr_(
+ utils::MakeShared<MockStatisticsManager>())
+ , usage_statistics_test_object1_sptr_(
+ new application_manager::UsageStatistics(
+ kAppId, mock_statistics_manager_sptr_))
+ , language_(LanguageIdToString(kTestLanguageId)) {}
+
+ protected:
+ utils::SharedPtr<MockStatisticsManager>
+ mock_statistics_manager_sptr_;
+ std::auto_ptr<application_manager::UsageStatistics>
+ usage_statistics_test_object1_sptr_;
+ const std::string language_;
+};
+
+TEST_F(UsageStatisticsTest, RecordHmiStateChanged_CallMethod_ExpectMethodCall) {
+ // Arrange
+ std::auto_ptr<MockAppStopwatch> mock_app_stopwatch_object(new MockAppStopwatch);
+
+ // Checks
+ EXPECT_CALL(*mock_app_stopwatch_object, Start(kTestAppStopwatchId));
+ EXPECT_CALL(*mock_app_stopwatch_object, Switch(kTestAppStopwatchId));
+
+ // Act
+ std::auto_ptr<application_manager::UsageStatistics>
+ usage_statistics_test_object2_sptr_(
+ new application_manager::UsageStatistics(
+ kAppId,
+ mock_statistics_manager_sptr_,
+ mock_app_stopwatch_object.release()));
+ usage_statistics_test_object2_sptr_->RecordHmiStateChanged(
+ HMILevel::eType::HMI_NONE);
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordAppRegistrationGuiLanguage_CallMethod_ExpectSetMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Set(kAppId, _, language_));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordAppRegistrationGuiLanguage(
+ kTestLanguageId);
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordAppRegistrationVuiLanguage_CallMethod_ExpectSetMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Set(kAppId, _, language_));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordAppRegistrationVuiLanguage(
+ kTestLanguageId);
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordRpcSentInHMINone_CallMethod_ExpectIncrementMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Increment(kAppId, _));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordRpcSentInHMINone();
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordPolicyRejectedRpcCall_CallMethod_ExpectIncrementMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Increment(kAppId, _));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordPolicyRejectedRpcCall();
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordAppUserSelection_CallMethod_ExpectIncrementMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Increment(kAppId, _));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordAppUserSelection();
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordRunAttemptsWhileRevoked_CallMethod_ExpectIncrementMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Increment(kAppId, _));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordRunAttemptsWhileRevoked();
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordRemovalsForBadBehavior_CallMethod_ExpectIncrementMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Increment(kAppId, _));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordRemovalsForBadBehavior();
+}
+
+TEST_F(UsageStatisticsTest,
+ RecordTLSError_CallMethod_ExpectIncrementMethodCall) {
+ // Expectation
+ EXPECT_CALL(*mock_statistics_manager_sptr_, Increment(kAppId, _));
+ // Act
+ usage_statistics_test_object1_sptr_->RecordTLSError();
+}
+
+} // namespace usage_statistics_test
+} // namespace components
+} // namespace test
diff --git a/src/components/application_manager/test/zero_request_amount_test.cc b/src/components/application_manager/test/zero_request_amount_test.cc
new file mode 100644
index 0000000000..11c9abc03c
--- /dev/null
+++ b/src/components/application_manager/test/zero_request_amount_test.cc
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <string>
+#include <algorithm>
+#include "gtest/gtest.h"
+#include "config_profile/profile.h"
+#include "application_manager/request_controller.h"
+#include "application_manager/commands/command_request_impl.h"
+#include "application_manager/application_manager_impl.h"
+#include "application_manager/message_helper.h"
+#include "application_manager/commands/mobile/put_file_request.h"
+#include "application_manager/commands/mobile/register_app_interface_request.h"
+#include "application_manager/commands/mobile/unregister_app_interface_request.h"
+#include "smart_objects/smart_object.h"
+#include "interfaces/MOBILE_API.h"
+
+namespace test {
+namespace components {
+namespace application {
+using namespace ::profile;
+
+using namespace application_manager::request_controller;
+using namespace application_manager;
+using namespace NsSmartDeviceLink::NsSmartObjects;
+
+commands::Command* RegisterApplication() {
+
+ SmartObjectSPtr resultsmart = application_manager::MessageHelper::CreateModuleInfoSO(1);
+ SmartObject& test_message = *resultsmart;
+ uint32_t connection_key = 0;
+ test_message[strings::params][strings::connection_key] = connection_key;
+ test_message[strings::msg_params][strings::language_desired] = 0;
+ test_message[strings::msg_params][strings::hmi_display_language_desired] = 0;
+ commands::Command* testregCommand = new commands::RegisterAppInterfaceRequest(resultsmart);
+ return testregCommand;
+}
+
+commands::Command* UnregisterApplication() {
+ SmartObjectSPtr resultsmart = application_manager::MessageHelper::CreateModuleInfoSO(2);
+ commands::Command *testregCommand =
+ new commands::UnregisterAppInterfaceRequest(resultsmart);
+ return testregCommand;
+}
+
+commands::Command* PutFileCommand(uint32_t &correlation_id,
+ uint32_t &connection_key) {
+
+ SmartObjectSPtr resultsmart = application_manager::MessageHelper::CreateModuleInfoSO(32);
+ SmartObject& test_message = *resultsmart;
+ test_message[strings::params][strings::correlation_id] = correlation_id;
+ test_message[strings::params][strings::connection_key] = connection_key;
+ test_message[strings::msg_params][strings::sync_file_name] = "file.png";
+ test_message[strings::msg_params][strings::file_type] =
+ mobile_apis::FileType::GRAPHIC_PNG;
+
+ commands::Command* testCommand = new commands::PutFileRequest(resultsmart);
+ return testCommand;
+}
+
+TEST(RequestControlTest, ZeroValuePendingRequestsAmount) {
+ // Default value
+ uint32_t pending_requests_amount = 0;
+ EXPECT_EQ(pending_requests_amount,
+ Profile::instance()->pending_requests_amount());
+
+ const uint32_t big_count_of_requests_for_test_ = 10; //bigger than pending_requests_amount
+ uint32_t correlation_id = 0;
+ uint32_t connection_key = 0;
+ RequestController::TResult result;
+ RequestController request_ctrl_;
+
+ commands::Command * reg = RegisterApplication();
+ request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
+
+ for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
+ correlation_id = i;
+ commands::Command* testCommand = PutFileCommand(correlation_id,
+ connection_key);
+ result = request_ctrl_.addMobileRequest(testCommand,
+ mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_EQ(RequestController::SUCCESS, result);
+ }
+
+ commands::Command * unreg = UnregisterApplication();
+ request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
+}
+
+TEST(RequestControlTest, ZeroValueAppRequestsTimeScale) {
+ // Default value
+ uint32_t app_requests_time_scale = 0;
+ EXPECT_EQ(app_requests_time_scale, Profile::instance()->app_time_scale());
+
+ const uint32_t big_count_of_requests_for_test_ = 10; //bigger than pending_requests_amount
+ uint32_t correlation_id = 0;
+ uint32_t connection_key = 0;
+ RequestController::TResult result;
+ RequestController request_ctrl_;
+
+ commands::Command * reg = RegisterApplication();
+ request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
+
+ for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
+ correlation_id = i;
+ commands::Command * testCommand = PutFileCommand(correlation_id,
+ connection_key);
+ result = request_ctrl_.addMobileRequest(testCommand,
+ mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_EQ(RequestController::SUCCESS, result);
+ }
+
+
+ commands::Command* unreg = UnregisterApplication();
+ request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
+}
+
+TEST(RequestControlTest, ZeroValueAppTimeScaleMaxRequests) {
+ // Default value
+ uint32_t app_time_scale_max_requests = 0;
+ EXPECT_EQ(app_time_scale_max_requests,
+ Profile::instance()->app_time_scale_max_requests());
+
+ const uint32_t big_count_of_requests_for_test_ = 10; //bigger than pending_requests_amount
+ uint32_t correlation_id = 0;
+ uint32_t connection_key = 0;
+ RequestController::TResult result;
+ RequestController request_ctrl_;
+
+ commands::Command * reg = RegisterApplication();
+ request_ctrl_.addMobileRequest(reg, mobile_apis::HMILevel::HMI_FULL);
+
+ for (uint32_t i = 0; i < big_count_of_requests_for_test_; ++i) {
+ correlation_id = i;
+ commands::Command* testCommand = PutFileCommand(correlation_id,
+ connection_key);
+ result = request_ctrl_.addMobileRequest(testCommand,
+ mobile_apis::HMILevel::HMI_FULL);
+ EXPECT_EQ(RequestController::SUCCESS, result);
+ }
+
+ commands::Command* unreg = UnregisterApplication();
+ request_ctrl_.addMobileRequest(unreg, mobile_apis::HMILevel::HMI_FULL);
+}
+
+} // namespace application
+} // namespace components
+} // namespace test
diff --git a/src/components/config_profile/CMakeLists.txt b/src/components/config_profile/CMakeLists.txt
index fe6f373b3a..107fd58127 100644
--- a/src/components/config_profile/CMakeLists.txt
+++ b/src/components/config_profile/CMakeLists.txt
@@ -45,4 +45,4 @@ target_link_libraries("ConfigProfile" Utils)
if(BUILD_TESTS)
add_subdirectory(test)
-endif() \ No newline at end of file
+endif()
diff --git a/src/components/config_profile/include/config_profile/profile.h b/src/components/config_profile/include/config_profile/profile.h
index 6a43cafdd3..0d7727ebda 100644
--- a/src/components/config_profile/include/config_profile/profile.h
+++ b/src/components/config_profile/include/config_profile/profile.h
@@ -36,16 +36,22 @@
#include <stdint.h>
#include <string>
#include <vector>
-#include <list>
#include "utils/macro.h"
#include "utils/singleton.h"
+#include "protocol_handler/protocol_handler_settings.h"
+#include "connection_handler/connection_handler_settings.h"
+#include "hmi_message_handler/hmi_message_handler_settings.h"
+
namespace profile {
/**
* The Profile class
*/
-class Profile : public utils::Singleton<Profile> {
+class Profile :public protocol_handler::ProtocolHandlerSettings,
+ public connection_handler::ConnectionHandlerSettings,
+ public hmi_message_handler::HMIMessageHandlerSettings,
+ public utils::Singleton<Profile> {
public:
// Methods section
@@ -91,7 +97,7 @@ class Profile : public utils::Singleton<Profile> {
/**
* @brief Returns true, if SDL 4.0 is enabled
*/
- bool enable_protocol_4() const;
+ bool enable_protocol_4() const OVERRIDE;
/**
* @brief Returns application icons folder path
@@ -300,15 +306,15 @@ class Profile : public utils::Singleton<Profile> {
*/
const uint32_t& list_files_in_none() const;
- /*
- * @brief Returns file name for storing applications data
+ /**
+ * @brief Return List Files request array size
*/
- const std::string& app_info_storage() const;
+ const uint32_t& list_files_response_size() const;
/*
- * @brief Heartbeat timeout before closing connection
+ * @brief Returns file name for storing applications data
*/
- int32_t heart_beat_timeout() const;
+ const std::string& app_info_storage() const;
/*
* @brief Path to preloaded policy file
@@ -358,6 +364,48 @@ class Profile : public utils::Singleton<Profile> {
*/
uint16_t tts_global_properties_timeout() const;
+#ifdef ENABLE_SECURITY
+ /**
+ * @brief Returns name of Security Manager protocol
+ */
+ const std::string& security_manager_protocol_name() const;
+
+ /**
+ * @brief Returns SSL mode
+ */
+ const std::string& ssl_mode() const;
+
+ /**
+ * @brief Returns key path to pem file
+ */
+ const std::string& key_path() const;
+
+ /**
+ * @brief Returns certificate path to pem file
+ */
+ const std::string& cert_path() const;
+
+ /**
+ * @brief Returns ca certificate path to pem file
+ */
+ const std::string& ca_cert_path() const;
+
+ /**
+ * @brief Returns ciphers
+ */
+ const std::string& ciphers_list() const;
+
+ /**
+ * @brief Returns true if Mobile app certificate is verified
+ */
+ bool verify_peer() const;
+
+ /**
+ * @brief Return hours amount when PTU should be triggered
+ */
+ size_t update_before_hours() const;
+
+#endif //ENABLE_SECURITY
/**
* @brief Reads a string value from the profile
*
@@ -416,7 +464,7 @@ class Profile : public utils::Singleton<Profile> {
* @return container of values or empty continer
* if could not read the value out of the profile
*/
- std::list<std::string> ReadStringContainer(
+ std::vector<std::string> ReadStringContainer(
const char * const pSection,
const char * const pKey,
bool* out_result) const;
@@ -432,7 +480,7 @@ class Profile : public utils::Singleton<Profile> {
* @return container of values or empty continer
* if could not read the value out of the profile
*/
- std::list<int> ReadIntContainer(const char * const pSection,
+ std::vector<int> ReadIntContainer(const char * const pSection,
const char * const pKey,
bool* out_result) const;
@@ -452,8 +500,6 @@ class Profile : public utils::Singleton<Profile> {
*/
const std::string& recording_file_name() const;
- const std::string& mme_db_name() const;
-
const std::string& event_mq_name() const;
const std::string& ack_mq_name() const;
@@ -493,17 +539,30 @@ class Profile : public utils::Singleton<Profile> {
/*
* ProtocolHandler section
*/
- size_t maximum_payload_size() const;
+ size_t maximum_payload_size() const OVERRIDE;
+
+ size_t message_frequency_count() const OVERRIDE;
+
+ size_t message_frequency_time() const OVERRIDE;
+
+ bool malformed_message_filtering() const OVERRIDE;
+
+ size_t malformed_frequency_count() const OVERRIDE;
+
+ size_t malformed_frequency_time() const OVERRIDE;
- size_t message_frequency_count() const;
+ uint32_t multiframe_waiting_timeout() const OVERRIDE;
- size_t message_frequency_time() const;
+ uint32_t heart_beat_timeout() const OVERRIDE;
- bool malformed_message_filtering() const;
+ uint16_t max_supported_protocol_version() const OVERRIDE;
- size_t malformed_frequency_count() const;
+ #ifdef ENABLE_SECURITY
+ const std::vector<int>& force_protected_service() const OVERRIDE;
- size_t malformed_frequency_time() const;
+ const std::vector<int>& force_unprotected_service() const OVERRIDE;
+ #endif // ENABLE_SECURITY
+ // ProtocolHandler section end
uint16_t attempts_to_open_policy_db() const;
@@ -515,12 +574,29 @@ class Profile : public utils::Singleton<Profile> {
uint32_t hash_string_size() const;
+ bool logs_enabled() const;
+
+ /**
+ * @brief Returns true if resumption ctrl uses db, returns false if
+ * resumption ctrl uses JSON.
+ */
+ bool use_db_for_resumption() const;
+
+ /**
+ * @brief Returns amount of attempts for opening resumption db
+ */
+ uint16_t attempts_to_open_resumption_db() const;
+
+ /**
+ * @brief Returns timeout between attempts
+ */
+ uint16_t open_attempt_timeout_ms_resumption_db() const;
+
/*
* @brief Updates all related values from ini file
*/
void UpdateValues();
-
private:
/**
* Default constructor
@@ -670,8 +746,10 @@ private:
uint32_t put_file_in_none_;
uint32_t delete_file_in_none_;
uint32_t list_files_in_none_;
+ uint32_t list_files_response_size_;
std::string app_info_storage_;
uint32_t heart_beat_timeout_;
+ uint16_t max_supported_protocol_version_;
std::string preloaded_pt_file_;
std::string policy_snapshot_file_name_;
bool enable_policy_;
@@ -691,6 +769,19 @@ private:
uint32_t application_list_update_timeout_;
uint32_t max_thread_pool_size_;
uint32_t default_hub_protocol_index_;
+#ifdef ENABLE_SECURITY
+ std::string cert_path_;
+ std::string ca_cert_path_;
+ std::string ssl_mode_;
+ std::string key_path_;
+ std::string ciphers_list_;
+ bool verify_peer_;
+ uint32_t update_before_hours_;
+ std::string security_manager_protocol_name_;
+ std::vector<int> force_protected_service_;
+ std::vector<int> force_unprotected_service_;
+#endif
+
/*
* first value is count of request
* second is time scale
@@ -722,6 +813,10 @@ private:
uint32_t resumption_delay_before_ign_;
uint32_t resumption_delay_after_ign_;
uint32_t hash_string_size_;
+ bool logs_enabled_;
+ bool use_db_for_resumption_;
+ uint16_t attempts_to_open_resumption_db_;
+ uint16_t open_attempt_timeout_ms_resumption_db_;
FRIEND_BASE_SINGLETON_CLASS(Profile);
DISALLOW_COPY_AND_ASSIGN(Profile);
diff --git a/src/components/config_profile/src/ini_file.cc b/src/components/config_profile/src/ini_file.cc
index 236dd1ae2b..fcdf24db31 100644
--- a/src/components/config_profile/src/ini_file.cc
+++ b/src/components/config_profile/src/ini_file.cc
@@ -177,9 +177,8 @@ char ini_write_value(const char *fname,
#if USE_MKSTEMP
{
- char *temp_str;
+ const char *temp_str = "./";
int32_t fd = -1;
- temp_str = static_cast<char*>(getenv("TMPDIR"));
if (temp_str) {
snprintf(temp_fname, PATH_MAX,
"%s/ini.XXXXXX", temp_str);
diff --git a/src/components/config_profile/src/profile.cc b/src/components/config_profile/src/profile.cc
index 700c52fff8..27e35a7d5c 100644
--- a/src/components/config_profile/src/profile.cc
+++ b/src/components/config_profile/src/profile.cc
@@ -43,6 +43,11 @@
#include "utils/threads/thread.h"
#include "utils/file_system.h"
+#ifdef ENABLE_SECURITY
+#include <openssl/ssl.h>
+#endif // ENABLE_SECURITY
+
+
namespace {
#define LOG_UPDATED_VALUE(value, key, section) {\
LOG4CXX_INFO(logger_, "Setting value '" << value\
@@ -59,6 +64,11 @@ namespace {
const char* kDefaultConfigFileName = "smartDeviceLink.ini";
const char* kMainSection = "MAIN";
+#ifdef ENABLE_SECURITY
+const char* kSecuritySection = "Security Manager";
+const char* kForceProtectedService = "ForceProtectedService";
+const char* kForceUnprotectedService = "ForceUnprotectedService";
+#endif
const char* kPolicySection = "Policy";
const char* kHmiSection = "HMI";
const char* kAppInfoSection = "AppInfo";
@@ -83,12 +93,15 @@ const char* kServerAddressKey = "ServerAddress";
const char* kAppInfoStorageKey = "AppInfoStorage";
const char* kAppStorageFolderKey = "AppStorageFolder";
const char* kAppResourseFolderKey = "AppResourceFolder";
+const char* kLogsEnabledKey = "LogsEnabled";
const char* kAppConfigFolderKey = "AppConfigFolder";
const char* kEnableProtocol4Key = "EnableProtocol4";
const char* kAppIconsFolderKey = "AppIconsFolder";
const char* kAppIconsFolderMaxSizeKey = "AppIconsFolderMaxSize";
const char* kAppIconsAmountToRemoveKey = "AppIconsAmountToRemove";
const char* kLaunchHMIKey = "LaunchHMI";
+
+const char* kDefaultSDLVersion = "";
#ifdef WEB_HMI
const char* kLinkToWebHMI = "LinkToWebHMI";
#endif // WEB_HMI
@@ -100,6 +113,31 @@ const char* kNamedVideoPipePathKey = "NamedVideoPipePath";
const char* kNamedAudioPipePathKey = "NamedAudioPipePath";
const char* kVideoStreamFileKey = "VideoStreamFile";
const char* kAudioStreamFileKey = "AudioStreamFile";
+
+#ifdef ENABLE_SECURITY
+const char* kSecurityProtocolKey = "Protocol";
+const char* kSecurityCertificatePathKey = "CertificatePath";
+const char* kSecurityCACertificatePathKey = "CACertificatePath";
+const char* kSecuritySSLModeKey = "SSLMode";
+const char* kSecurityKeyPathKey = "KeyPath";
+const char* kSecurityCipherListKey = "CipherList";
+const char* kSecurityVerifyPeerKey = "VerifyPeer";
+const char* kBeforeUpdateHours = "UpdateBeforeHours";
+#endif
+
+#ifdef CUSTOMER_PASA
+const char* kHMIHeartBeatTimeoutKey = "HMIHeartBeatTimeout";
+const char* kLoggerSection = "LOGGING";
+const char* kAudioMQPath = "MQAudioPath";
+const char* kLoggerConfigFileKey = "LoggerConfigFile";
+const char* kRemoteLoggingFlagFileKey = "RemoteLoggingFlagFile";
+const char* kRemoteLoggingFlagFilePathKey = "RemoteLoggingFlagFilePath";
+const char* kTargetLogFileHomeDirKey = "TargetLogFileHomeDir";
+const char* kTargetLogFileNamePatternKey = "TargetLogFileNamePattern";
+const char* kTargetBootCountFileKey = "TargetBootCountFile";
+const char* kTargetTmpDirKey = "TargetTmpDir";
+const char* kLogFileMaxSizeKey = "LogFileMaxSize";
+#endif
const char* kAudioDataStoppedTimeoutKey = "AudioDataStoppedTimeout";
const char* kVideoDataStoppedTimeoutKey = "VideoDataStoppedTimeout";
const char* kMixingAudioSupportedKey = "MixingAudioSupported";
@@ -109,6 +147,7 @@ const char* kHelpTitleKey = "HelpTitle";
const char* kHelpCommandKey = "HelpCommand";
const char* kSystemFilesPathKey = "SystemFilesPath";
const char* kHeartBeatTimeoutKey = "HeartBeatTimeout";
+const char* kMaxSupportedProtocolVersionKey = "MaxSupportedProtocolVersion";
const char* kUseLastStateKey = "UseLastState";
const char* kTCPAdapterPortKey = "TCPAdapterPort";
const char* kServerPortKey = "ServerPort";
@@ -121,6 +160,7 @@ const char* kMaxCmdIdKey = "MaxCmdID";
const char* kPutFileRequestKey = "PutFileRequest";
const char* kDeleteFileRequestKey = "DeleteFileRequest";
const char* kListFilesRequestKey = "ListFilesRequest";
+const char* kListFilesResponseSizeKey = "ListFilesResponseSize";
const char* kDefaultTimeoutKey = "DefaultTimeout";
const char* kAppResumingTimeoutKey = "ApplicationResumingTimeout";
const char* kAppSavePersistentDataTimeoutKey = "AppSavePersistentDataTimeout";
@@ -140,7 +180,6 @@ const char* kTTSDelimiterKey = "TTSDelimiter";
const char* kRecordingFileNameKey = "RecordingFileName";
const char* kRecordingFileSourceKey = "RecordingFileSource";
const char* kEnablePolicy = "EnablePolicy";
-const char* kMmeDatabaseNameKey = "MMEDatabase";
const char* kEventMQKey = "EventMQ";
const char* kAckMQKey = "AckMQ";
const char* kApplicationListUpdateTimeoutKey = "ApplicationListUpdateTimeout";
@@ -161,12 +200,15 @@ const char* kFrequencyTime = "FrequencyTime";
const char* kMalformedMessageFiltering = "MalformedMessageFiltering";
const char* kMalformedFrequencyCount = "MalformedFrequencyCount";
const char* kMalformedFrequencyTime = "MalformedFrequencyTime";
+const char* kExpectedConsecutiveFramesTimeout = "ExpectedConsecutiveFramesTimeout";
const char* kHashStringSizeKey = "HashStringSize";
+const char* kUseDBForResumptionKey = "UseDBForResumption";
+const char* kAttemptsToOpenResumptionDBKey = "AttemptsToOpenResumptionDB";
+const char* kOpenAttemptTimeoutMsResumptionDBKey = "OpenAttemptTimeoutMsResumptionDB";
#ifdef WEB_HMI
const char* kDefaultLinkToWebHMI = "HMI/index.html";
#endif // WEB_HMI
-const char* kDefaultSDLVersion = "";
const char* kDefaultPoliciesSnapshotFileName = "sdl_snapshot.json";
const char* kDefaultHmiCapabilitiesFileName = "hmi_capabilities.json";
const char* kDefaultPreloadedPTFileName = "sdl_preloaded_pt.json";
@@ -176,7 +218,6 @@ const char* kDefaultSystemFilesPath = "/tmp/fs/mp/images/ivsu_cache";
const char* kDefaultTtsDelimiter = ",";
const uint32_t kDefaultAudioDataStoppedTimeout = 1000;
const uint32_t kDefaultVideoDataStoppedTimeout = 1000;
-const char* kDefaultMmeDatabaseName = "/dev/qdb/mediaservice_db";
const char* kDefaultEventMQ = "/dev/mqueue/ToSDLCoreUSBAdapter";
const char* kDefaultAckMQ = "/dev/mqueue/FromSDLCoreUSBAdapter";
const char* kDefaultRecordingFileSourceName = "audio.8bit.wav";
@@ -188,8 +229,16 @@ const char* kDefaultPoolProtocolMask = "com.smartdevicelink.prot";
const char* kDefaultIAPSystemConfig = "/fs/mp/etc/mm/ipod.cfg";
const char* kDefaultIAP2SystemConfig = "/fs/mp/etc/mm/iap2.cfg";
+#ifdef ENABLE_SECURITY
+const char* kDefaultSecurityProtocol = "TLSv1.2";
+const char* kDefaultSSLMode = "CLIENT";
+const bool kDefaultVerifyPeer = false;
+const uint32_t kDefaultBeforeUpdateHours = 24;
+#endif // ENABLE_SECURITY
+
const uint32_t kDefaultHubProtocolIndex = 0;
const uint32_t kDefaultHeartBeatTimeout = 0;
+const uint16_t kDefaultMaxSupportedProtocolVersion = 3;
const uint16_t kDefautTransportManagerTCPPort = 12345;
const uint16_t kDefaultServerPort = 8087;
const uint16_t kDefaultVideoStreamingPort = 5050;
@@ -201,11 +250,12 @@ const uint32_t kDefaultPutFileRequestInNone = 5;
const uint32_t kDefaultDeleteFileRequestInNone = 5;
const uint32_t kDefaultListFilesRequestInNone = 5;
const uint32_t kDefaultTimeout = 10000;
-const uint32_t kDefaultAppResumingTimeout = 3;
-const uint32_t kDefaultAppSavePersistentDataTimeout = 10;
+const uint32_t kDefaultAppResumingTimeout = 3000;
+const uint32_t kDefaultAppSavePersistentDataTimeout = 10000;
const uint32_t kDefaultResumptionDelayBeforeIgn = 30;
const uint32_t kDefaultResumptionDelayAfterIgn = 30;
const uint32_t kDefaultHashStringSize = 32;
+const uint32_t kDefaultListFilesResponseSize = 1000;
const uint32_t kDefaultDirQuota = 104857600;
const uint32_t kDefaultAppTimeScaleMaxRequests = 0;
@@ -220,7 +270,8 @@ const std::pair<uint32_t, uint32_t> kGetVehicleDataFrequency = { 5, 1 };
const std::pair<uint32_t, uint32_t> kStartStreamRetryAmount = { 3, 1 };
const uint32_t kDefaultMaxThreadPoolSize = 2;
const int kDefaultIAP2HubConnectAttempts = 0;
-const int kDefaultIAPHubConnectionWaitTimeout = 10;
+const int kDefaultIAPHubConnectionWaitTimeout = 10000;
+const int kDefaultIAPArmEventTimeout = 500;
const uint16_t kDefaultTTSGlobalPropertiesTimeout = 20;
// TCP MTU - header size = 1500 - 12
const size_t kDefaultMaximumPayloadSize = 1500 - 12;
@@ -229,11 +280,13 @@ const size_t kDefaultFrequencyTime = 1000;
const bool kDefaulMalformedMessageFiltering = true;
const size_t kDefaultMalformedFrequencyCount = 10;
const size_t kDefaultMalformedFrequencyTime = 1000;
+const uint32_t kDefaultExpectedConsecutiveFramesTimeout = 10000;
const uint16_t kDefaultAttemptsToOpenPolicyDB = 5;
-const uint16_t kDefaultOpenAttemptTimeoutMsKey = 500;
-const uint32_t kDefaultAppIconsFolderMaxSize = 1048576;
+const uint16_t kDefaultOpenAttemptTimeoutMs = 500;
+const uint32_t kDefaultAppIconsFolderMaxSize = 104857600;
const uint32_t kDefaultAppIconsAmountToRemove = 1;
-
+const uint16_t kDefaultAttemptsToOpenResumptionDB = 5;
+const uint16_t kDefaultOpenAttemptTimeoutMsResumptionDB = 500;
} // namespace
namespace profile {
@@ -279,8 +332,10 @@ Profile::Profile()
put_file_in_none_(kDefaultPutFileRequestInNone),
delete_file_in_none_(kDefaultDeleteFileRequestInNone),
list_files_in_none_(kDefaultListFilesRequestInNone),
+ list_files_response_size_(kDefaultListFilesResponseSize),
app_info_storage_(kDefaultAppInfoFileName),
heart_beat_timeout_(kDefaultHeartBeatTimeout),
+ max_supported_protocol_version_(kDefaultMaxSupportedProtocolVersion),
policy_snapshot_file_name_(kDefaultPoliciesSnapshotFileName),
enable_policy_(false),
transport_manager_disconnect_timeout_(
@@ -292,7 +347,6 @@ Profile::Profile()
tts_delimiter_(kDefaultTtsDelimiter),
audio_data_stopped_timeout_(kDefaultAudioDataStoppedTimeout),
video_data_stopped_timeout_(kDefaultVideoDataStoppedTimeout),
- mme_db_name_(kDefaultMmeDatabaseName),
event_mq_name_(kDefaultEventMQ),
ack_mq_name_(kDefaultAckMQ),
recording_file_source_(kDefaultRecordingFileSourceName),
@@ -308,9 +362,10 @@ Profile::Profile()
tts_global_properties_timeout_(kDefaultTTSGlobalPropertiesTimeout),
attempts_to_open_policy_db_(kDefaultAttemptsToOpenPolicyDB),
open_attempt_timeout_ms_(kDefaultAttemptsToOpenPolicyDB),
- hash_string_size_(kDefaultHashStringSize) {
- ReadStringValue(&sdl_version_, kDefaultSDLVersion,
- kMainSection, kSDLVersionKey);
+ hash_string_size_(kDefaultHashStringSize),
+ use_db_for_resumption_(false),
+ attempts_to_open_resumption_db_(kDefaultAttemptsToOpenResumptionDB),
+ open_attempt_timeout_ms_resumption_db_(kDefaultOpenAttemptTimeoutMsResumptionDB){
}
@@ -511,14 +566,22 @@ const uint32_t& Profile::list_files_in_none() const {
return list_files_in_none_;
}
+const uint32_t& Profile::list_files_response_size() const {
+ return list_files_response_size_;
+}
+
const std::string& Profile::app_info_storage() const {
return app_info_storage_;
}
-int32_t Profile::heart_beat_timeout() const {
+uint32_t Profile::heart_beat_timeout() const {
return heart_beat_timeout_;
}
+uint16_t Profile::max_supported_protocol_version() const{
+ return max_supported_protocol_version_;
+}
+
const std::string& Profile::preloaded_pt_file() const {
return preloaded_pt_file_;
}
@@ -563,10 +626,6 @@ const std::string&Profile::recording_file_name() const {
return recording_file_name_;
}
-const std::string& Profile::mme_db_name() const {
- return mme_db_name_;
-}
-
const std::string& Profile::event_mq_name() const {
return event_mq_name_;
}
@@ -668,6 +727,12 @@ size_t Profile::malformed_frequency_time() const {
kProtocolHandlerSection, kMalformedFrequencyTime);
return malformed_frequency_time;
}
+uint32_t Profile::multiframe_waiting_timeout() const {
+ uint32_t multiframe_waiting_timeout = 0;
+ ReadUIntValue(&multiframe_waiting_timeout, kDefaultExpectedConsecutiveFramesTimeout,
+ kProtocolHandlerSection, kExpectedConsecutiveFramesTimeout);
+ return multiframe_waiting_timeout;
+}
uint16_t Profile::attempts_to_open_policy_db() const {
return attempts_to_open_policy_db_;
@@ -693,6 +758,65 @@ uint16_t Profile::tts_global_properties_timeout() const {
return tts_global_properties_timeout_;
}
+#ifdef ENABLE_SECURITY
+
+const std::string& Profile::cert_path() const {
+ return cert_path_;
+}
+
+const std::string& Profile::ca_cert_path() const {
+ return ca_cert_path_;
+}
+
+const std::string& Profile::ssl_mode() const {
+ return ssl_mode_;
+}
+
+const std::string& Profile::key_path() const {
+ return key_path_;
+}
+
+const std::string& Profile::ciphers_list() const {
+ return ciphers_list_;
+}
+
+bool Profile::verify_peer() const {
+ return verify_peer_;
+}
+
+size_t Profile::update_before_hours() const {
+ return update_before_hours_;
+}
+
+const std::string& Profile::security_manager_protocol_name() const {
+ return security_manager_protocol_name_;
+}
+
+const std::vector<int>& Profile::force_protected_service() const {
+ return force_protected_service_;
+}
+
+const std::vector<int>& Profile::force_unprotected_service() const {
+ return force_unprotected_service_;
+}
+#endif // ENABLE_SECURITY
+
+bool Profile::logs_enabled() const {
+ return logs_enabled_;
+}
+
+bool Profile::use_db_for_resumption() const {
+ return use_db_for_resumption_;
+}
+
+uint16_t Profile::attempts_to_open_resumption_db() const {
+ return attempts_to_open_resumption_db_;
+}
+
+uint16_t Profile::open_attempt_timeout_ms_resumption_db() const {
+ return open_attempt_timeout_ms_resumption_db_;
+}
+
void Profile::UpdateValues() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -720,6 +844,41 @@ void Profile::UpdateValues() {
LOG_UPDATED_BOOL_VALUE(link_to_web_hmi_, kLinkToWebHMI, kHmiSection);
#endif // WEB_HMI
+#ifdef ENABLE_SECURITY
+
+ force_protected_service_ =
+ ReadIntContainer(kSecuritySection, kForceProtectedService, NULL);
+
+ force_unprotected_service_ =
+ ReadIntContainer(kSecuritySection, kForceUnprotectedService, NULL);
+
+ ReadStringValue(&security_manager_protocol_name_, kDefaultSecurityProtocol, kSecuritySection,
+ kSecurityProtocolKey);
+
+ ReadStringValue(&cert_path_, "", kSecuritySection, kSecurityCertificatePathKey);
+ ReadStringValue(&ca_cert_path_, "", kSecuritySection, kSecurityCACertificatePathKey);
+
+ ReadStringValue(&ssl_mode_, kDefaultSSLMode, kSecuritySection,
+ kSecuritySSLModeKey);
+
+ ReadStringValue(&key_path_, "", kSecuritySection, kSecurityKeyPathKey);
+
+ ReadStringValue(&ciphers_list_, SSL_TXT_ALL, kSecuritySection,
+ kSecurityCipherListKey);
+
+ ReadBoolValue(&verify_peer_, kDefaultVerifyPeer, kSecuritySection,
+ kSecurityVerifyPeerKey);
+
+ ReadUIntValue(&update_before_hours_, kDefaultBeforeUpdateHours,
+ kSecuritySection, kBeforeUpdateHours);
+
+#endif // ENABLE_SECURITY
+
+ // Logs enabled
+ ReadBoolValue(&logs_enabled_, false, kMainSection, kLogsEnabledKey);
+
+ LOG_UPDATED_BOOL_VALUE(logs_enabled_, kLogsEnabledKey, kMainSection);
+
// Application config folder
ReadStringValue(&app_config_folder_,
file_system::CurrentWorkingDirectory().c_str(),
@@ -980,6 +1139,13 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(list_files_in_none_, kListFilesRequestKey,
kFilesystemRestrictionsSection);
+ // ListFiles request size
+ ReadUIntValue(&list_files_response_size_, kDefaultListFilesResponseSize,
+ kFilesystemRestrictionsSection, kListFilesResponseSizeKey);
+
+ LOG_UPDATED_VALUE(list_files_response_size_, kListFilesResponseSizeKey,
+ kFilesystemRestrictionsSection);
+
// Default timeout
ReadUIntValue(&default_timeout_, kDefaultTimeout, kMainSection,
kDefaultTimeoutKey);
@@ -1226,13 +1392,6 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(transport_manager_tcp_adapter_port_, kTCPAdapterPortKey,
kTransportManagerSection);
- // MME database name
- ReadStringValue(&mme_db_name_,
- kDefaultMmeDatabaseName,
- kTransportManagerSection,
- kMmeDatabaseNameKey);
-
- LOG_UPDATED_VALUE(mme_db_name_, kMmeDatabaseNameKey, kTransportManagerSection);
// Event MQ
ReadStringValue(&event_mq_name_,
kDefaultEventMQ,
@@ -1299,10 +1458,8 @@ void Profile::UpdateValues() {
kAttemptsToOpenPolicyDBKey, kPolicySection);
// Open attempt timeout in ms
- ReadUIntValue(&open_attempt_timeout_ms_,
- kDefaultOpenAttemptTimeoutMsKey,
- kPolicySection,
- kOpenAttemptTimeoutMsKey);
+ ReadUIntValue(&open_attempt_timeout_ms_, kDefaultOpenAttemptTimeoutMs,
+ kPolicySection, kOpenAttemptTimeoutMsKey);
LOG_UPDATED_VALUE(open_attempt_timeout_ms_,
kOpenAttemptTimeoutMsKey, kPolicySection);
@@ -1316,6 +1473,18 @@ void Profile::UpdateValues() {
enable_policy_ = false;
}
+ // Max protocol version
+ ReadUIntValue(&max_supported_protocol_version_,
+ kDefaultMaxSupportedProtocolVersion,
+ kProtocolHandlerSection,
+ kMaxSupportedProtocolVersionKey);
+
+ // if .ini file contains protocol version less than 2 or more than 3
+ // max_supported_protocol_version_ = 3
+ if (max_supported_protocol_version_ < 2) {
+ max_supported_protocol_version_ = 3;
+ }
+
LOG_UPDATED_BOOL_VALUE(enable_policy_, kEnablePolicy, kPolicySection);
ReadUIntValue(&application_list_update_timeout_,
@@ -1404,6 +1573,26 @@ void Profile::UpdateValues() {
LOG_UPDATED_VALUE(hash_string_size_,
kHashStringSizeKey,
kApplicationManagerSection);
+
+ ReadBoolValue(&use_db_for_resumption_, false, kResumptionSection,
+ kUseDBForResumptionKey);
+
+ LOG_UPDATED_BOOL_VALUE(use_db_for_resumption_, kUseDBForResumptionKey,
+ kResumptionSection);
+
+ ReadUIntValue(&attempts_to_open_resumption_db_, kDefaultAttemptsToOpenResumptionDB,
+ kResumptionSection, kAttemptsToOpenResumptionDBKey);
+
+ LOG_UPDATED_VALUE(attempts_to_open_resumption_db_, kAttemptsToOpenResumptionDBKey,
+ kResumptionSection);
+
+ ReadUIntValue(&open_attempt_timeout_ms_resumption_db_,
+ kDefaultOpenAttemptTimeoutMsResumptionDB,
+ kResumptionSection, kOpenAttemptTimeoutMsResumptionDBKey);
+
+ LOG_UPDATED_VALUE(open_attempt_timeout_ms_resumption_db_,
+ kOpenAttemptTimeoutMsResumptionDBKey,
+ kResumptionSection);
}
bool Profile::ReadValue(bool* value, const char* const pSection,
@@ -1415,13 +1604,12 @@ bool Profile::ReadValue(bool* value, const char* const pSection,
*buf = '\0';
if ((0 != ini_read_value(config_file_name_.c_str(), pSection, pKey, buf))
&& ('\0' != *buf)) {
- const int32_t tmpVal = atoi(buf);
- if (0 == tmpVal) {
- *value = false;
- } else {
+ const int32_t tmpVal = atoi(buf);
+ if ((0 == strcmp("true", buf)) || (0 != tmpVal)) {
*value = true;
+ } else {
+ *value = false;
}
-
ret = true;
}
return ret;
@@ -1498,26 +1686,26 @@ int32_t hex_to_int(const std::string& value) {
}
}
-std::list<int> Profile::ReadIntContainer(
+std::vector<int> Profile::ReadIntContainer(
const char * const pSection, const char * const pKey,
bool *out_result) const {
- const std::list<std::string> string_list =
+ const std::vector<std::string> string_list =
ReadStringContainer(pSection, pKey, out_result);
- std::list<int> value_list;
+ std::vector<int> value_list;
value_list.resize(string_list.size());
std::transform(string_list.begin(), string_list.end(),
value_list.begin(), hex_to_int);
return value_list;
}
-std::list<std::string> Profile::ReadStringContainer(
+std::vector<std::string> Profile::ReadStringContainer(
const char * const pSection, const char * const pKey,
bool *out_result) const {
std::string string;
const bool result = ReadValue(&string, pSection, pKey);
if (out_result)
*out_result = result;
- std::list < std::string > value_container;
+ std::vector < std::string > value_container;
if (result) {
std::istringstream iss(string);
std::string temp_str;
@@ -1542,7 +1730,11 @@ bool Profile::ReadUIntValue(uint16_t* value, uint16_t default_value,
*value = default_value;
return false;
}
-
+ if (user_value > (std::numeric_limits < uint16_t > ::max)())
+ {
+ *value = default_value;
+ return false;
+ }
*value = static_cast<uint16_t>(user_value);
return true;
}
@@ -1558,7 +1750,12 @@ bool Profile::ReadUIntValue(uint32_t* value, uint32_t default_value,
} else {
uint64_t user_value;
if (!StringToNumber(string_value, user_value)) {
- *value = default_value;
+ *value = default_value;
+ return false;
+ }
+ if (user_value > (std::numeric_limits < uint32_t > ::max)())
+ {
+ *value = default_value;
return false;
}
diff --git a/src/components/config_profile/test/ini_file_test.cc b/src/components/config_profile/test/ini_file_test.cc
index 10d500df74..cd124c9ed3 100644
--- a/src/components/config_profile/test/ini_file_test.cc
+++ b/src/components/config_profile/test/ini_file_test.cc
@@ -24,7 +24,7 @@
* 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
- * FERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * 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.
@@ -40,7 +40,7 @@ namespace profile {
using namespace ::profile;
-TEST(IniFileTest, DISABLED_WriteItemReadItem) {
+TEST(IniFileTest, WriteItemReadItem) {
// Write line in chapter
const char * fname = "./test_ini_file.ini";
const char *chapter = "Chapter";
@@ -49,17 +49,16 @@ TEST(IniFileTest, DISABLED_WriteItemReadItem) {
const bool write_result = ini_write_value(fname, chapter, item, value,
INI_FLAG_ITEM_UP_CREA);
EXPECT_TRUE(write_result);
-
- // Read value from file
- char search_value[INI_LINE_LEN] = "";
+ char search_value[INI_LINE_LEN] = {0};
const bool read_result = ini_read_value(fname, chapter, item, search_value);
+ const char *res = search_value;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*search_value, *value);
+ EXPECT_STREQ(res, value);
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_WriteItemWithoutValueReadItem) {
+TEST(IniFileTest, WriteItemWithoutValueReadItem) {
// Write line in chapter
const char * fname = "./test_ini_file.ini";
const char *chapter = "Chapter";
@@ -70,16 +69,16 @@ TEST(IniFileTest, DISABLED_WriteItemWithoutValueReadItem) {
EXPECT_TRUE(write_result);
// Read value from file
- char search_value[INI_LINE_LEN] = "";
+ char search_value[INI_LINE_LEN] = {0};
const bool read_result = ini_read_value(fname, chapter, test_item, search_value);
-
+ const char *res = search_value;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*search_value, *value);
+ EXPECT_STREQ(res, value);
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_WriteSameItemInDifferentChapters) {
+TEST(IniFileTest, WriteSameItemInDifferentChapters) {
// Write line in chapter
const char * fname = "./test_ini_file.ini";
const char *chapter1 = "Chapter1";
@@ -88,12 +87,11 @@ TEST(IniFileTest, DISABLED_WriteSameItemInDifferentChapters) {
const bool write_result = ini_write_value(fname, chapter1, test_item, value,
INI_FLAG_ITEM_UP_CREA);
EXPECT_TRUE(write_result);
-
- char search_value[INI_LINE_LEN] = "";
+ char search_value[INI_LINE_LEN] = {0};
const bool read_result = ini_read_value(fname, chapter1, test_item, search_value);
-
+ const char *res = search_value;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*search_value, *value);
+ EXPECT_STREQ(res, value);
// Create new chapter and write the same value
const char *chapter2 = "Chapter2";
@@ -105,14 +103,13 @@ TEST(IniFileTest, DISABLED_WriteSameItemInDifferentChapters) {
char value2[INI_LINE_LEN] = "test_value";
const bool read_result2 = ini_read_value(fname, chapter2, test_item, value2);
-
+ const char *res2 = value2;
EXPECT_TRUE(read_result2);
- EXPECT_EQ(*value2, *value);
-
+ EXPECT_STREQ(res2, res);
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_RewriteItem) {
+TEST(IniFileTest, RewriteItem) {
// Write line in chapter
const char * fname = "./test_ini_file.ini";
const char *chapter = "Chapter";
@@ -122,12 +119,11 @@ TEST(IniFileTest, DISABLED_RewriteItem) {
INI_FLAG_ITEM_UP_CREA);
EXPECT_TRUE(write_result);
-
- char search_value[INI_LINE_LEN] = "";
+ char search_value[INI_LINE_LEN] = {0};
bool read_result = ini_read_value(fname, chapter, item, search_value);
-
+ const char *res = search_value;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*search_value, *value);
+ EXPECT_STREQ(res, value);
// Write item again
const char * newvalue = "new_test_value";
@@ -135,16 +131,15 @@ TEST(IniFileTest, DISABLED_RewriteItem) {
INI_FLAG_ITEM_UP_CREA);
EXPECT_TRUE(write_result);
-
- char new_search_value[INI_LINE_LEN] = "";
+ char new_search_value[INI_LINE_LEN] = {0};
read_result = ini_read_value(fname, chapter, item, new_search_value);
-
+ const char *new_res = new_search_value;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*new_search_value, *newvalue);
+ EXPECT_STREQ(new_res, newvalue);
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
-TEST(IniFileTest, DISABLED_WriteTwoItemsInOneChapter) {
+TEST(IniFileTest, WriteTwoItemsInOneChapter) {
// Write line in chapter
const char * fname = "./test_ini_file.ini";
const char *chapter = "Chapter";
@@ -164,18 +159,17 @@ TEST(IniFileTest, DISABLED_WriteTwoItemsInOneChapter) {
EXPECT_TRUE(write_result);
// Search both values
- char search_value[INI_LINE_LEN] = "";
+ char search_value[INI_LINE_LEN] = {0};
bool read_result = ini_read_value(fname, chapter, item, search_value);
-
+ const char *res = search_value;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*search_value, *value1);
+ EXPECT_STREQ(res, value1);
- char search_value2[INI_LINE_LEN] = "";
+ char search_value2[INI_LINE_LEN] = {0};
read_result = ini_read_value(fname, chapter, item2, search_value2);
-
+ const char *res2 = search_value2;
EXPECT_TRUE(read_result);
- EXPECT_EQ(*search_value2, *value2);
-
+ EXPECT_STREQ(res2, value2);
EXPECT_TRUE(file_system::DeleteFile("./test_ini_file.ini"));
}
@@ -212,9 +206,9 @@ TEST(IniFileTest, WriteItemInEmptyChapter_ExpectFalse) {
}
TEST(IniFileTest,ParseEmptyLine) {
- char line[INI_LINE_LEN] = "";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "HMI";
+ char line[INI_LINE_LEN] = {0};
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "HMI";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -222,9 +216,9 @@ TEST(IniFileTest,ParseEmptyLine) {
}
TEST(IniFileTest,ParseChapter) {
- char line[INI_LINE_LEN] = "[HMI]";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "HMI";
+ const char * line = "[HMI]";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "HMI";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -232,9 +226,9 @@ TEST(IniFileTest,ParseChapter) {
}
TEST(IniFileTest,ParseChapterTagEmpty) {
- char line[INI_LINE_LEN] = "[HMI]";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "";
+ const char * line = "[HMI]";
+ char val[INI_LINE_LEN] = {0};
+ char tag[INI_LINE_LEN] = {0};
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -242,9 +236,9 @@ TEST(IniFileTest,ParseChapterTagEmpty) {
}
TEST(IniFileTest,ParseChapterWithUppercaseTag) {
- char line[INI_LINE_LEN] = "[Security Manager]";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "SECURITY MANAGER";
+ const char * line = "[Security Manager]";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "SECURITY MANAGER";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -252,9 +246,9 @@ TEST(IniFileTest,ParseChapterWithUppercaseTag) {
}
TEST(IniFileTest,ParseChapterWithLowcaseTag) {
- char line[INI_LINE_LEN] = "[Security Manager]";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "Security Manager";
+ const char * line = "[Security Manager]";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "Security Manager";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -262,9 +256,9 @@ TEST(IniFileTest,ParseChapterWithLowcaseTag) {
}
TEST(IniFileTest,ParseWithWrongChapter) {
- char line[INI_LINE_LEN] = "[HMI]";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "MAIN";
+ const char * line = "[HMI]";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "MAIN";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -285,22 +279,22 @@ TEST(IniFileTest,ParseLineWithItem) {
}
TEST(IniFileTest,ParseLineWithoutItem) {
- char line[INI_LINE_LEN] = "LaunchHMI = ";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "LAUNCHHMI";
+ const char * line = "LaunchHMI = ";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "LAUNCHHMI";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
+ const char *res = val;
+ const char *check_val="";
EXPECT_EQ(INI_RIGHT_ITEM, result);
-
- char check_val[INI_LINE_LEN] = "";
- EXPECT_EQ(*check_val, *val);
+ EXPECT_STREQ(check_val, res);
}
TEST(IniFileTest,ParseLineWithEmptytag) {
- char line[INI_LINE_LEN] = "LaunchHMI = true";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "";
+ const char * line = "LaunchHMI = true";
+ char val[INI_LINE_LEN] = {0};
+ char tag[INI_LINE_LEN] = {0};
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -308,9 +302,9 @@ TEST(IniFileTest,ParseLineWithEmptytag) {
}
TEST(IniFileTest,ParseLineWithLowcaseTag) {
- char line[INI_LINE_LEN] = "LaunchHMI = true";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "LaunchHmi";
+ const char * line = "LaunchHMI = true";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "LaunchHmi";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
@@ -318,16 +312,15 @@ TEST(IniFileTest,ParseLineWithLowcaseTag) {
}
TEST(IniFileTest,ParseLineWithComment) {
- char line[INI_LINE_LEN] = "; [HMI]";
- char val[INI_LINE_LEN] = "";
- char tag[INI_LINE_LEN] = "HMI";
+ const char * line = "; [HMI]";
+ char val[INI_LINE_LEN] = {0};
+ const char * tag = "HMI";
Ini_search_id result;
result = ini_parse_line(line, tag, val);
+ const char *res = val;
EXPECT_EQ(INI_REMARK, result);
-
- char check_val[INI_LINE_LEN] = ";";
- EXPECT_EQ(*check_val, *val);
+ EXPECT_STREQ(line, res);
}
} // namespace profile
diff --git a/src/components/config_profile/test/profile_test.cc b/src/components/config_profile/test/profile_test.cc
index 9d9eca755f..1bcd28b83e 100644
--- a/src/components/config_profile/test/profile_test.cc
+++ b/src/components/config_profile/test/profile_test.cc
@@ -30,9 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <algorithm>
+#include <vector>
+
#include "gtest/gtest.h"
#include "config_profile/profile.h"
-#include <algorithm>
#include "utils/file_system.h"
#include "utils/threads/thread.h"
@@ -388,7 +390,7 @@ TEST_F(ProfileTest, EmptyValuesInPair) {
EXPECT_EQ(value, Profile::instance()->get_vehicle_data_frequency());
}
-TEST_F(ProfileTest, DISABLED_IntInsteadOfPair) {
+TEST_F(ProfileTest, IntInsteadOfPair) {
// Default values
std::pair < uint32_t, int32_t > value;
value.first = 0;
@@ -400,7 +402,7 @@ TEST_F(ProfileTest, DISABLED_IntInsteadOfPair) {
Profile::instance()->config_file_name());
// Ini file includes only one element
value.first = 9;
- value.second = 1000;
+ value.second = 0;
EXPECT_EQ(value, Profile::instance()->start_stream_retry_amount());
// Update config file
@@ -411,7 +413,7 @@ TEST_F(ProfileTest, DISABLED_IntInsteadOfPair) {
TEST_F(ProfileTest, WrongIntValue) {
// Default value
- int32_t heart_beat_timeout = 0;
+ uint32_t heart_beat_timeout = 0;
EXPECT_EQ(heart_beat_timeout, Profile::instance()->heart_beat_timeout());
// Change config file
@@ -428,7 +430,7 @@ TEST_F(ProfileTest, WrongIntValue) {
EXPECT_EQ(heart_beat_timeout, Profile::instance()->heart_beat_timeout());
}
-TEST_F(ProfileTest, DISABLED_WrongMaxIntValue) {
+TEST_F(ProfileTest, WrongMaxIntValue) {
// Default value
uint32_t maxvalue = 2000000000;
EXPECT_EQ(maxvalue, Profile::instance()->max_cmd_id());
@@ -447,7 +449,7 @@ TEST_F(ProfileTest, DISABLED_WrongMaxIntValue) {
EXPECT_EQ(maxvalue, Profile::instance()->max_cmd_id());
}
-TEST_F(ProfileTest, DISABLED_WrongMinIntValue) {
+TEST_F(ProfileTest, WrongMinIntValue) {
// Default value
uint32_t minvalue = threads::Thread::kMinStackSize;
EXPECT_EQ(minvalue, Profile::instance()->thread_min_stack_size());
@@ -473,7 +475,7 @@ TEST_F(ProfileTest, DISABLED_WrongMinIntValue) {
EXPECT_EQ(server_port, Profile::instance()->server_port());
}
-TEST_F(ProfileTest, DISABLED_CheckCorrectValueWhenOtherValueInvalid) {
+TEST_F(ProfileTest, CheckCorrectValueWhenOtherValueInvalid) {
// Default value
uint32_t maxvalue = 2000000000;
EXPECT_EQ(maxvalue, Profile::instance()->max_cmd_id());
@@ -520,7 +522,7 @@ TEST_F(ProfileTest, PairsValueInsteadOfInt) {
EXPECT_EQ(list_files_in_none, Profile::instance()->list_files_in_none());
}
-TEST_F(ProfileTest, DISABLED_StringValueIncludeSlashesAndRussianLetters) {
+TEST_F(ProfileTest, StringValueIncludeSlashesAndRussianLetters) {
// Default values
std::string config_folder = "";
EXPECT_EQ(config_folder, Profile::instance()->app_resourse_folder());
@@ -528,6 +530,7 @@ TEST_F(ProfileTest, DISABLED_StringValueIncludeSlashesAndRussianLetters) {
std::string app_resourse_folder = "";
std::string app_storage_folder = "";
+ std::string current_dir = file_system::CurrentWorkingDirectory();
Profile::instance()->config_file_name("smartDeviceLink_invalid_string.ini");
EXPECT_EQ("smartDeviceLink_invalid_string.ini",
Profile::instance()->config_file_name());
@@ -539,10 +542,10 @@ TEST_F(ProfileTest, DISABLED_StringValueIncludeSlashesAndRussianLetters) {
EXPECT_EQ(tts_delimiter_, Profile::instance()->tts_delimiter());
std::string server_address = "127.0.0.1 + слово";
EXPECT_EQ(server_address, profile::Profile::instance()->server_address());
- app_resourse_folder = "new folder/";
- EXPECT_EQ(app_resourse_folder, Profile::instance()->app_resourse_folder());
- app_storage_folder = "\" \"";
- EXPECT_EQ(app_storage_folder, Profile::instance()->app_storage_folder());
+ app_resourse_folder = "/new folder/";
+ EXPECT_EQ(current_dir+app_resourse_folder, Profile::instance()->app_resourse_folder());
+ app_storage_folder = "/\" \"";
+ EXPECT_EQ(current_dir+app_storage_folder, Profile::instance()->app_storage_folder());
// Update config file
profile::Profile::instance()->UpdateValues();
@@ -551,7 +554,7 @@ TEST_F(ProfileTest, DISABLED_StringValueIncludeSlashesAndRussianLetters) {
EXPECT_EQ(config_folder, Profile::instance()->app_config_folder());
EXPECT_EQ(tts_delimiter_, Profile::instance()->tts_delimiter());
EXPECT_EQ(server_address, profile::Profile::instance()->server_address());
- EXPECT_EQ(app_resourse_folder, Profile::instance()->app_resourse_folder());
+ EXPECT_EQ(current_dir+app_resourse_folder, Profile::instance()->app_resourse_folder());
}
TEST_F(ProfileTest, StringUpperBoundValue) {
@@ -627,7 +630,7 @@ TEST_F(ProfileTest, CheckReadStringValue) {
EXPECT_EQ("127.0.0.1", server_address);
}
-TEST_F(ProfileTest, DISABLED_CheckReadBoolValue) {
+TEST_F(ProfileTest, CheckReadBoolValue) {
// Set new config file
Profile::instance()->config_file_name("smartDeviceLink_test.ini");
EXPECT_EQ("smartDeviceLink_test.ini",
@@ -662,127 +665,127 @@ TEST_F(ProfileTest, CheckReadIntValue) {
EXPECT_EQ(8088, server_port);
}
-//TEST_F(ProfileTest, CheckIntContainer) {
-// // Set new config file
-// Profile::instance()->config_file_name("smartDeviceLink_test.ini");
-// EXPECT_EQ("smartDeviceLink_test.ini",
-// Profile::instance()->config_file_name());
-
-// bool isread = false;
-// std::vector<int> diagmodes_list =
-// profile::Profile::instance()->ReadIntContainer("MAIN",
-// "SupportedDiagModes",
-// &isread);
-// EXPECT_TRUE(isread);
-
-// std::vector<int>::iterator diag_mode = std::find(diagmodes_list.begin(),
-// diagmodes_list.end(), 0x12);
-
-// // This element doesn't appear in list
-// EXPECT_EQ(diag_mode, diagmodes_list.end());
-
-// // List includes 0x01
-// diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), 0x01);
-// EXPECT_EQ(diag_mode, diagmodes_list.begin());
-
-// // List includes 0x03
-// std::vector<int>::iterator element_mode = diagmodes_list.begin();
-// element_mode++;
-// element_mode++;
-
-// diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), 0x03);
-// EXPECT_EQ(diag_mode, element_mode);
-//}
-
-//TEST_F(ProfileTest, CheckVectorContainer) {
-// Profile::instance()->config_file_name("smartDeviceLink_test.ini");
-// EXPECT_EQ("smartDeviceLink_test.ini",
-// Profile::instance()->config_file_name());
-
-// // Get diag_modes after updating
-// const std::vector<uint32_t> &diag_modes = profile::Profile::instance()
-// ->supported_diag_modes();
-
-// bool isread = false;
-// std::vector<int> diagmodes_list =
-// profile::Profile::instance()->ReadIntContainer("MAIN",
-// "SupportedDiagModes",
-// &isread);
-// EXPECT_TRUE(isread);
-// // Compare with result of ReadIntContainer
-// ASSERT_EQ(diag_modes.size(), diagmodes_list.size());
-// bool isEqual = true;
-// std::vector<int>::iterator iter = diagmodes_list.begin();
-
-// for (std::vector<uint32_t>::const_iterator it = diag_modes.begin();
-// it != diag_modes.end(); it++) {
-
-// if ((uint32_t)(*iter) != (*it)) {
-// isEqual = false;
-// break;
-// }
-// iter++;
-// }
-// EXPECT_TRUE(isEqual);
-//}
-
-//TEST_F(ProfileTest, CheckStringContainer) {
-// // Set new config file
-// Profile::instance()->config_file_name("smartDeviceLink_test.ini");
-// EXPECT_EQ("smartDeviceLink_test.ini",
-// Profile::instance()->config_file_name());
-
-// bool isread = false;
-// std::vector < std::string > diagmodes_list = profile::Profile::instance()
-// ->ReadStringContainer("MAIN", "SupportedDiagModes", &isread);
-// EXPECT_TRUE(isread);
-
-// std::vector<std::string>::iterator diag_mode =
-// std::find(diagmodes_list.begin(), diagmodes_list.end(), "0x12");
-
-// // This element doesn't appear in list
-// EXPECT_EQ(diag_mode, diagmodes_list.end());
-
-// // List includes 0x01
-// diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), "0x01");
-// EXPECT_EQ(diag_mode, diagmodes_list.begin());
-
-// // List includes 0x03
-// std::vector<std::string>::iterator element_mode = diagmodes_list.begin();
-// element_mode++;
-// element_mode++;
-// diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), " 0x03");
-// EXPECT_EQ(diag_mode, element_mode);
-//}
-
-//#ifdef ENABLE_SECURITY
-//TEST_F(ProfileTest, CheckIntContainerInSecurityData) {
-// // Set new config file
-// Profile::instance()->config_file_name("smartDeviceLink_test.ini");
-// EXPECT_EQ("smartDeviceLink_test.ini",
-// Profile::instance()->config_file_name());
-
-// std::vector<int> force_unprotected_list =
-// profile::Profile::instance()->ReadIntContainer(
-// "Security Manager", "ForceUnprotectedService", NULL);
-
-// std::vector<int> force_protected_list =
-// profile::Profile::instance()->ReadIntContainer(
-// "Security Manager", "ForceProtectedService", NULL);
-
-// std::vector<int>::iterator res_unprotect = std::find(force_unprotected_list.begin(), force_unprotected_list.end(), 0x07);
-// std::vector<int>::iterator res_protect = std::find(force_protected_list.begin(), force_protected_list.end(), 0x07);
-// // This element doesn't appear in both lists
-// EXPECT_EQ(res_unprotect, force_unprotected_list.end() );
-// EXPECT_EQ(res_protect, force_protected_list.end() );
-
-// // Both lists include 0
-// res_unprotect = std::find(force_unprotected_list.begin(), force_unprotected_list.end(), 0);
-// res_protect = std::find(force_protected_list.begin(), force_protected_list.end(), 0);
-// EXPECT_EQ(res_unprotect, force_unprotected_list.begin() );
-// EXPECT_EQ(res_protect, force_protected_list.begin() );
-//}
-//#endif
+TEST_F(ProfileTest, CheckIntContainer) {
+ // Set new config file
+ Profile::instance()->config_file_name("smartDeviceLink_test.ini");
+ EXPECT_EQ("smartDeviceLink_test.ini",
+ Profile::instance()->config_file_name());
+
+ bool isread = false;
+ std::vector<int> diagmodes_list =
+ profile::Profile::instance()->ReadIntContainer("MAIN",
+ "SupportedDiagModes",
+ &isread);
+ EXPECT_TRUE(isread);
+
+ std::vector<int>::iterator diag_mode = std::find(diagmodes_list.begin(),
+ diagmodes_list.end(), 0x12);
+
+ // This element doesn't appear in list
+ EXPECT_EQ(diag_mode, diagmodes_list.end());
+
+ // List includes 0x01
+ diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), 0x01);
+ EXPECT_EQ(diag_mode, diagmodes_list.begin());
+
+ // List includes 0x03
+ std::vector<int>::iterator element_mode = diagmodes_list.begin();
+ element_mode++;
+ element_mode++;
+
+ diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), 0x03);
+ EXPECT_EQ(diag_mode, element_mode);
+}
+
+TEST_F(ProfileTest, CheckVectorContainer) {
+ Profile::instance()->config_file_name("smartDeviceLink_test.ini");
+ EXPECT_EQ("smartDeviceLink_test.ini",
+ Profile::instance()->config_file_name());
+
+ // Get diag_modes after updating
+ const std::vector<uint32_t> &diag_modes = profile::Profile::instance()
+ ->supported_diag_modes();
+
+ bool isread = false;
+ std::vector<int> diagmodes_list =
+ profile::Profile::instance()->ReadIntContainer("MAIN",
+ "SupportedDiagModes",
+ &isread);
+ EXPECT_TRUE(isread);
+ // Compare with result of ReadIntContainer
+ ASSERT_EQ(diag_modes.size(), diagmodes_list.size());
+ bool isEqual = true;
+ std::vector<int>::iterator iter = diagmodes_list.begin();
+
+ for (std::vector<uint32_t>::const_iterator it = diag_modes.begin();
+ it != diag_modes.end(); it++) {
+
+ if ((uint32_t)(*iter) != (*it)) {
+ isEqual = false;
+ break;
+ }
+ iter++;
+ }
+ EXPECT_TRUE(isEqual);
+}
+
+TEST_F(ProfileTest, CheckStringContainer) {
+ // Set new config file
+ Profile::instance()->config_file_name("smartDeviceLink_test.ini");
+ EXPECT_EQ("smartDeviceLink_test.ini",
+ Profile::instance()->config_file_name());
+
+ bool isread = false;
+ std::vector < std::string > diagmodes_list = profile::Profile::instance()
+ ->ReadStringContainer("MAIN", "SupportedDiagModes", &isread);
+ EXPECT_TRUE(isread);
+
+ std::vector<std::string>::iterator diag_mode =
+ std::find(diagmodes_list.begin(), diagmodes_list.end(), "0x12");
+
+ // This element doesn't appear in list
+ EXPECT_EQ(diag_mode, diagmodes_list.end());
+
+ // List includes 0x01
+ diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), "0x01");
+ EXPECT_EQ(diag_mode, diagmodes_list.begin());
+
+ // List includes 0x03
+ std::vector<std::string>::iterator element_mode = diagmodes_list.begin();
+ element_mode++;
+ element_mode++;
+ diag_mode = std::find(diagmodes_list.begin(), diagmodes_list.end(), " 0x03");
+ EXPECT_EQ(diag_mode, element_mode);
+}
+
+#ifdef ENABLE_SECURITY
+TEST_F(ProfileTest, CheckIntContainerInSecurityData) {
+ // Set new config file
+ Profile::instance()->config_file_name("smartDeviceLink_test.ini");
+ EXPECT_EQ("smartDeviceLink_test.ini",
+ Profile::instance()->config_file_name());
+
+ std::vector<int> force_unprotected_list =
+ profile::Profile::instance()->ReadIntContainer(
+ "Security Manager", "ForceUnprotectedService", NULL);
+
+ std::vector<int> force_protected_list =
+ profile::Profile::instance()->ReadIntContainer(
+ "Security Manager", "ForceProtectedService", NULL);
+
+ std::vector<int>::iterator res_unprotect = std::find(force_unprotected_list.begin(), force_unprotected_list.end(), 0x07);
+ std::vector<int>::iterator res_protect = std::find(force_protected_list.begin(), force_protected_list.end(), 0x07);
+ // This element doesn't appear in both lists
+ EXPECT_EQ(res_unprotect, force_unprotected_list.end() );
+ EXPECT_EQ(res_protect, force_protected_list.end() );
+
+ // Both lists include 0
+ res_unprotect = std::find(force_unprotected_list.begin(), force_unprotected_list.end(), 0);
+ res_protect = std::find(force_protected_list.begin(), force_protected_list.end(), 0);
+ EXPECT_EQ(res_unprotect, force_unprotected_list.begin() );
+ EXPECT_EQ(res_protect, force_protected_list.begin() );
+}
+#endif
} // namespace profile
} // namespace components
diff --git a/src/components/connection_handler/CMakeLists.txt b/src/components/connection_handler/CMakeLists.txt
index 657c90d108..dc1b2d24d6 100644
--- a/src/components/connection_handler/CMakeLists.txt
+++ b/src/components/connection_handler/CMakeLists.txt
@@ -34,7 +34,6 @@ set(CH_SRC_DIR ${COMPONENTS_DIR}/connection_handler/src)
include_directories (
include
${COMPONENTS_DIR}/protocol_handler/include/
- ${COMPONENTS_DIR}/config_profile/include/
${COMPONENTS_DIR}/utils/include/
${ENCRYPTION_INCLUDE_DIRECTORY}
${LOG4CXX_INCLUDE_DIRECTORY}
@@ -48,7 +47,6 @@ set (SOURCES
)
set(LIBRARIES
- ConfigProfile
ProtocolLibrary
)
@@ -57,4 +55,4 @@ target_link_libraries(connectionHandler encryption)
if(BUILD_TESTS)
add_subdirectory(test)
-endif() \ No newline at end of file
+endif()
diff --git a/src/components/connection_handler/include/connection_handler/connection.h b/src/components/connection_handler/include/connection_handler/connection.h
index d20ddc1c00..4c98aa79fb 100644
--- a/src/components/connection_handler/include/connection_handler/connection.h
+++ b/src/components/connection_handler/include/connection_handler/connection.h
@@ -129,7 +129,7 @@ class Connection {
Connection(ConnectionHandle connection_handle,
DeviceHandle connection_device_handle,
ConnectionHandler *connection_handler,
- int32_t heartbeat_timeout);
+ uint32_t heartbeat_timeout);
/**
* @brief Destructor
@@ -146,7 +146,7 @@ class Connection {
* @brief Returns connection device handle
* @return ConnectionDeviceHandle
*/
- DeviceHandle connection_device_handle();
+ DeviceHandle connection_device_handle() const;
/**
* @brief Adds session to connection
@@ -242,9 +242,9 @@ class Connection {
/**
* @brief Sets heart beat timeout
- * @param timeout in seconds
+ * @param timeout in milliseconds
*/
- void SetHeartBeatTimeout(int32_t timeout, uint8_t session_id);
+ void SetHeartBeatTimeout(uint32_t timeout, uint8_t session_id);
/**
* @brief changes protocol version in session
@@ -297,6 +297,7 @@ class Connection {
* @brief monitor that closes connection if there is no traffic over it
*/
HeartBeatMonitor* heartbeat_monitor_;
+ uint32_t heartbeat_timeout_;
threads::Thread *heart_beat_monitor_thread_;
DISALLOW_COPY_AND_ASSIGN(Connection);
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler.h b/src/components/connection_handler/include/connection_handler/connection_handler.h
index 4a79658878..7aeb06bf54 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
#define SRC_COMPONENTS_CONNECTION_HANDLER_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_H_
+#include "connection_handler/connection_handler_settings.h"
#include "transport_manager/transport_manager_listener.h"
#include "protocol_handler/session_observer.h"
#include "connection_handler/device.h"
@@ -45,14 +46,9 @@
*/
namespace connection_handler {
- enum CloseSessionReason {
- kCommon = 0,
- kFlood,
- kMalformed,
- kUnauthorizedApp
- };
+enum CloseSessionReason { kCommon = 0, kFlood, kMalformed, kUnauthorizedApp };
- class ConnectionHandlerObserver;
+class ConnectionHandlerObserver;
/**
* \class ConnectionHandler
@@ -65,14 +61,7 @@ class ConnectionHandler {
* \param observer Pointer to observer object.
**/
virtual void set_connection_handler_observer(
- ConnectionHandlerObserver *observer) = 0;
-
- /**
- * \brief Sets pointer to TransportManager.
- * \param transportManager Pointer to TransportManager object.
- **/
- virtual void set_transport_manager(
- transport_manager::TransportManager *transport_manager) = 0;
+ ConnectionHandlerObserver* observer) = 0;
virtual void StartTransportManager() = 0;
@@ -88,7 +77,8 @@ class ConnectionHandler {
virtual void CloseRevokedConnection(uint32_t connection_key) = 0;
/**
- * \brief Close all associated sessions and close the connection pointed by handle
+ * \brief Close all associated sessions and close the connection pointed by
+ * handle
*/
virtual void CloseConnection(ConnectionHandle connection_handle) = 0;
@@ -103,8 +93,8 @@ class ConnectionHandler {
* @param mac_address
* @return true if successfully
*/
- virtual bool GetDeviceID(const std::string &mac_address,
- DeviceHandle *device_handle) = 0;
+ virtual bool GetDeviceID(const std::string& mac_address,
+ DeviceHandle* device_handle) = 0;
/**
* Close session associated with the key
@@ -118,13 +108,13 @@ class ConnectionHandler {
uint8_t session_id,
CloseSessionReason close_reason) = 0;
- /**
- * @brief SendEndService allows to end up specific service.
- *
- * @param key application identifier whose service should be closed.
- *
- * @param service_type the service that should be closed.
- */
+ /**
+ * @brief SendEndService allows to end up specific service.
+ *
+ * @param key application identifier whose service should be closed.
+ *
+ * @param service_type the service that should be closed.
+ */
virtual void SendEndService(uint32_t key, uint8_t service_type) = 0;
/**
@@ -138,15 +128,22 @@ class ConnectionHandler {
* \brief Send heartbeat to mobile app
*/
virtual void SendHeartBeat(ConnectionHandle connection_handle,
- uint8_t session_id) = 0;
+ uint8_t session_id) = 0;
/**
* Sets heart beat timeout for specified session
* @param connection_key pair of connection and session id
- * @param timeout in seconds
+ * @param timeout in milliseconds
*/
virtual void SetHeartBeatTimeout(uint32_t connection_key,
- int32_t timeout) = 0;
+ uint32_t timeout) = 0;
+
+ /**
+ * \brief Keep connection associated with the key from being closed by
+ * heartbeat monitor
+ */
+ virtual void KeepConnectionAlive(uint32_t connection_key,
+ uint8_t session_id) = 0;
/**
* \brief binds protocol version with session
@@ -158,12 +155,41 @@ class ConnectionHandler {
virtual void BindProtocolVersionWithSession(uint32_t connection_key,
uint8_t protocol_version) = 0;
+ /**
+ * \brief information about given Connection Key.
+ * \param key Unique key used by other components as session identifier
+ * \param app_id Returned: ApplicationID
+ * \param sessions_list Returned: List of session keys
+ * \param device_id Returned: DeviceID
+ * \return int32_t -1 in case of error or 0 in case of success
+ */
+ virtual int32_t GetDataOnSessionKey(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id) const = 0;
+ /**
+ * @brief GetConnectedDevicesMAC allows to obtain MAC adresses for all
+ * currently connected devices.
+ *
+ * @param device_macs collection of MAC adresses for connected devices.
+ */
+ virtual void GetConnectedDevicesMAC(std::vector<std::string> &device_macs) const = 0;
+
+ /**
+ * \brief Connection handler settings getter
+ * \return pointer to connection handler settings class
+ */
+ virtual const ConnectionHandlerSettings& get_settings() const = 0;
+
+ virtual const protocol_handler::SessionObserver& get_session_observer() = 0;
+
+ virtual DevicesDiscoveryStarter& get_device_discovery_starter() = 0;
+
protected:
/**
* \brief Destructor
*/
- virtual ~ConnectionHandler() {
- }
+ virtual ~ConnectionHandler() {}
};
} // namespace connection_handler
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 4ead673663..b6b13b57c1 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
@@ -46,11 +46,11 @@
#include "connection_handler/connection.h"
#include "connection_handler/devices_discovery_starter.h"
#include "connection_handler/connection_handler.h"
+
#include "utils/logger.h"
#include "utils/macro.h"
#include "utils/lock.h"
#include "utils/stl_utils.h"
-#include "utils/singleton.h"
#include "utils/rwlock.h"
/**
@@ -68,28 +68,26 @@ namespace connection_handler {
class ConnectionHandlerImpl : public ConnectionHandler,
public transport_manager::TransportManagerListenerEmpty,
public protocol_handler::SessionObserver,
- public DevicesDiscoveryStarter,
- public utils::Singleton<ConnectionHandlerImpl> {
+ public DevicesDiscoveryStarter {
public:
+
+ /**
+ * @brief ConnectionHandlerImpl
+ */
+ ConnectionHandlerImpl(const ConnectionHandlerSettings& settings,
+ transport_manager::TransportManager& tm);
/**
* \brief Destructor
*/
- virtual ~ConnectionHandlerImpl();
+ ~ConnectionHandlerImpl();
void Stop();
/**
* \brief Sets observer pointer for connection_handler.
* \param observer Pointer to observer object.
*/
- virtual void set_connection_handler_observer(
- ConnectionHandlerObserver *observer);
-
- /**
- * \brief Sets pointer to TransportManager.
- * \param transport_mngr Pointer to TransportManager object.
- **/
- virtual void set_transport_manager(
- transport_manager::TransportManager *transport_mngr);
+ void set_connection_handler_observer(
+ ConnectionHandlerObserver *observer) OVERRIDE;
/**
* \brief Sets pointer to ProtocolHandler.
@@ -102,16 +100,16 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \brief Connects to all services of device
* \param deviceHandle Handle of device to connect to
*/
- virtual void ConnectToDevice(connection_handler::DeviceHandle device_handle);
+ void ConnectToDevice(connection_handler::DeviceHandle device_handle) OVERRIDE;
- virtual void ConnectToAllDevices();
+ void ConnectToAllDevices() OVERRIDE;
- virtual void StartTransportManager();
+ void StartTransportManager() OVERRIDE;
- virtual void OnDeviceListUpdated(
- const std::vector<transport_manager::DeviceInfo> &);
+ void OnDeviceListUpdated(
+ const std::vector<transport_manager::DeviceInfo> &) OVERRIDE;
- virtual void OnFindNewApplicationsRequest();
+ void OnFindNewApplicationsRequest() OVERRIDE;
/**
* \brief Available devices list updated.
@@ -121,44 +119,43 @@ class ConnectionHandlerImpl : public ConnectionHandler,
*
* \param DeviceList New list of available devices.
**/
- virtual void OnDeviceFound(const transport_manager::DeviceInfo &device_info);
- virtual void OnDeviceAdded(const transport_manager::DeviceInfo &device_info);
- virtual void OnDeviceRemoved(const transport_manager::DeviceInfo &device_info);
+ void OnDeviceFound(const transport_manager::DeviceInfo &device_info) OVERRIDE;
+ void OnDeviceAdded(const transport_manager::DeviceInfo &device_info) OVERRIDE;
+ void OnDeviceRemoved(const transport_manager::DeviceInfo &device_info) OVERRIDE;
- virtual void OnScanDevicesFinished();
- virtual void OnScanDevicesFailed(
- const transport_manager::SearchDeviceError &error);
+ void OnScanDevicesFinished() OVERRIDE;
+ void OnScanDevicesFailed(
+ const transport_manager::SearchDeviceError &error) OVERRIDE;
/**
* \brief Notifies about established connection.
*
* \param connection_id ID of new connection.
**/
- virtual void OnConnectionEstablished(
- const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectionUID &connection_id);
- virtual void OnConnectionFailed(
+ void OnConnectionEstablished(const transport_manager::DeviceInfo &device_info,
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
+ void OnConnectionFailed(
const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectError &error);
- virtual void OnConnectionClosed(
- transport_manager::ConnectionUID connection_id);
- virtual void OnConnectionClosedFailure(
+ const transport_manager::ConnectError &error) OVERRIDE;
+ void OnConnectionClosed(
+ transport_manager::ConnectionUID connection_id) OVERRIDE;
+ void OnConnectionClosedFailure(
transport_manager::ConnectionUID connection_id,
- const transport_manager::DisconnectError &error);
- virtual void OnUnexpectedDisconnect(
+ const transport_manager::DisconnectError &error) OVERRIDE;
+ void OnUnexpectedDisconnect(
transport_manager::ConnectionUID connection_id,
- const transport_manager::CommunicationError &error);
- virtual void OnDeviceConnectionLost(
+ const transport_manager::CommunicationError &error) OVERRIDE;
+ void OnDeviceConnectionLost(
const connection_handler::DeviceHandle &device,
- const transport_manager::DisconnectDeviceError &error);
+ const transport_manager::DisconnectDeviceError &error) OVERRIDE;
/**
* \brief Informs about failure during DisconnectDevice procedure of TM
* \param device Information about disconnected device
* \param error Information about possible reason of loosing connection
*/
- virtual void OnDisconnectFailed(
+ void OnDisconnectFailed(
const connection_handler::DeviceHandle &device,
- const transport_manager::DisconnectDeviceError &error);
+ const transport_manager::DisconnectDeviceError &error) OVERRIDE;
/**
* \brief Callback function used by ProtocolHandler
@@ -170,7 +167,7 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param hash_id pointer for session hash identifier
* \return uint32_t Id (number) of new session if successful, otherwise 0.
*/
- virtual uint32_t OnSessionStartedCallback(const transport_manager::ConnectionUID &connection_handle,
+ virtual uint32_t OnSessionStartedCallback(const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id,
const protocol_handler::ServiceType &service_type,
const bool is_protected, uint32_t* hash_id);
@@ -184,10 +181,10 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* If not equal to hash assigned to session on start then operation fails.
* \return uint32_t 0 if operation fails, session key otherwise
*/
- virtual uint32_t OnSessionEndedCallback(
- const transport_manager::ConnectionUID &connection_handle,
+ uint32_t OnSessionEndedCallback(
+ const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id, const uint32_t &hashCode,
- const protocol_handler::ServiceType &service_type);
+ const protocol_handler::ServiceType &service_type) OVERRIDE;
/**
* \brief Callback function used by ProtocolHandler
@@ -211,9 +208,9 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param sessionId Identifier of the session
* \return int32_t Unique key for session
*/
- virtual uint32_t KeyFromPair(
+ uint32_t KeyFromPair(
transport_manager::ConnectionUID connection_handle,
- uint8_t session_id);
+ uint8_t session_id) const OVERRIDE;
/**
* \brief Returns connection identifier and session number from given session key
@@ -221,21 +218,9 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param connection_handle Returned: Connection identifier within which session exists
* \param sessionId Returned: Number of session
*/
- virtual void PairFromKey(uint32_t key,
+ void PairFromKey(uint32_t key,
transport_manager::ConnectionUID *connection_handle,
- uint8_t *session_id);
-
- /**
- * \brief information about given Connection Key.
- * \param key Unique key used by other components as session identifier
- * \param app_id Returned: ApplicationID
- * \param sessions_list Returned: List of session keys
- * \param device_id Returned: DeviceID
- * \return int32_t -1 in case of error or 0 in case of success
- */
- virtual int32_t GetDataOnSessionKey(uint32_t key, uint32_t *app_id = 0,
- std::list<int32_t> *sessions_list = NULL,
- uint32_t *device_id = 0);
+ uint8_t *session_id) const OVERRIDE;
/**
* \brief information about device
@@ -246,11 +231,20 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param connection_type Returned: type of connection (USB, BT, etc.)
* \return int32_t -1 in case of error or 0 in case of success
*/
- virtual int32_t GetDataOnDeviceID(connection_handler::DeviceHandle device_handle,
+ int32_t GetDataOnDeviceID(connection_handler::DeviceHandle device_handle,
std::string *device_name = NULL,
std::list<uint32_t> *applications_list = NULL,
std::string *mac_address = NULL,
- std::string* connection_type = NULL);
+ std::string* connection_type = NULL) const OVERRIDE;
+
+ /**
+ * @brief GetConnectedDevicesMAC allows to obtain MAC adresses for all
+ * currently connected devices.
+ *
+ * @param device_macs collection of MAC adresses for connected devices.
+ */
+ void GetConnectedDevicesMAC(std::vector<std::string> &device_macs) const OVERRIDE;
+
#ifdef ENABLE_SECURITY
/**
* \brief Sets crypto context of connection
@@ -281,6 +275,9 @@ class ConnectionHandlerImpl : public ConnectionHandler,
void SetProtectionFlag(
const uint32_t &key,
const protocol_handler::ServiceType &service_type) OVERRIDE;
+
+ security_manager::SSLContext::HandshakeContext
+ GetHandshakeContext(uint32_t key) const OVERRIDE;
#endif // ENABLE_SECURITY
/**
@@ -289,40 +286,40 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param device_handle
* \return true on sucess otherwise false.
*/
- virtual bool GetDeviceID(const std::string &mac_address,
- DeviceHandle *device_handle);
+ bool GetDeviceID(const std::string &mac_address,
+ DeviceHandle *device_handle) OVERRIDE;
/**
* \brief Method which should start devices discovering
*/
- virtual void StartDevicesDiscovery();
+ void StartDevicesDiscovery() OVERRIDE;
/**
* @brief Close the connection revoked by Policy
* @param connection_key pair of connection and session id
*/
- virtual void CloseRevokedConnection(uint32_t connection_key);
+ void CloseRevokedConnection(uint32_t connection_key) OVERRIDE;
/**
* @brief Close the connection pointed by handle
* @param connection_handle Connection unique id
*/
- virtual void CloseConnection(ConnectionHandle connection_handle) OVERRIDE;
+ void CloseConnection(ConnectionHandle connection_handle) OVERRIDE;
/**
* \brief Close session associated with the key
* \param key Unique key used by other components as session identifier
*/
- virtual void CloseSession(uint32_t key, CloseSessionReason close_reason);
+ void CloseSession(uint32_t key, CloseSessionReason close_reason) OVERRIDE;
/**
* \brief Function used by HearbeatMonitior to close session on HB timeout
* \param connection_handle Connection handler within which session exists
* \param session_id Identifier of the session to be ended
*/
- virtual void CloseSession(ConnectionHandle connection_handle,
+ void CloseSession(ConnectionHandle connection_handle,
uint8_t session_id,
- CloseSessionReason close_reason);
+ CloseSessionReason close_reason) OVERRIDE;
/**
* \brief Function used by OnApplicationFloodCallback and
@@ -338,13 +335,13 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \brief Return count of session for specified connection
* \param connection_key pair of connection handle and session id
*/
- virtual uint32_t GetConnectionSessionsCount(uint32_t connection_key);
+ uint32_t GetConnectionSessionsCount(uint32_t connection_key) OVERRIDE;
/**
* \brief Send heartbeat message to mobile app
*/
- virtual void SendHeartBeat(ConnectionHandle connection_handle,
- uint8_t session_id);
+ void SendHeartBeat(ConnectionHandle connection_handle,
+ uint8_t session_id) OVERRIDE;
/**
* @brief SendEndService allows to end up specific service.
@@ -353,22 +350,22 @@ class ConnectionHandlerImpl : public ConnectionHandler,
*
* @param service_type the service that should be closed.
*/
- virtual void SendEndService(uint32_t key,
- uint8_t service_type);
+ void SendEndService(uint32_t key,
+ uint8_t service_type) OVERRIDE;
/**
* \brief Start heartbeat for specified session
*
* \param connection_key pair of connection and session id
*/
- virtual void StartSessionHeartBeat(uint32_t connection_key);
+ void StartSessionHeartBeat(uint32_t connection_key) OVERRIDE;
/**
* Sets heart beat timeout for specified session
* @param connection_key pair of connection and session id
- * @param timeout in seconds
+ * @param timeout in milliseconds
*/
- virtual void SetHeartBeatTimeout(uint32_t connection_key, int32_t timeout);
+ void SetHeartBeatTimeout(uint32_t connection_key, uint32_t timeout) OVERRIDE;
/**
* \brief Keep connection associated with the key from being closed by heartbeat monitor
@@ -382,8 +379,8 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param protocol_version contains protocol version of
* \registered application.
*/
- virtual void BindProtocolVersionWithSession(uint32_t connection_key,
- uint8_t protocol_version);
+ void BindProtocolVersionWithSession(uint32_t connection_key,
+ uint8_t protocol_version) OVERRIDE;
/**
* \brief returns TRUE if session supports sending HEART BEAT ACK to mobile side
@@ -391,9 +388,9 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* \param sessionId Identifier of the session
* \return TRUE if session has protocol version which supports heartbeat otherwise returns FALSE
*/
- virtual bool IsHeartBeatSupported(
+ bool IsHeartBeatSupported(
transport_manager::ConnectionUID connection_handle,
- uint8_t session_id);
+ uint8_t session_id) const OVERRIDE;
/**
* @brief returns protocol version which application supports
@@ -402,14 +399,20 @@ class ConnectionHandlerImpl : public ConnectionHandler,
* @param method writes value protocol version to protocol_version
* @return TRUE if session and connection exist otherwise returns FALSE
*/
- virtual bool ProtocolVersionUsed(uint32_t connection_id,
- uint8_t session_id, uint8_t& protocol_version);
- private:
- /**
- * \brief Default class constructor
- */
- ConnectionHandlerImpl();
+ bool ProtocolVersionUsed(uint32_t connection_id,
+ uint8_t session_id, uint8_t& protocol_version) const OVERRIDE;
+
+ int32_t GetDataOnSessionKey(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id) const OVERRIDE;
+ const ConnectionHandlerSettings& get_settings() const OVERRIDE;
+
+ const protocol_handler::SessionObserver& get_session_observer();
+ DevicesDiscoveryStarter& get_device_discovery_starter();
+
+ private:
/**
* \brief Disconnect application.
*
@@ -419,8 +422,9 @@ class ConnectionHandlerImpl : public ConnectionHandler,
void RemoveConnection(const ConnectionHandle connection_handle);
void OnConnectionEnded(
- const transport_manager::ConnectionUID &connection_id);
+ const transport_manager::ConnectionUID connection_id);
+ const ConnectionHandlerSettings& settings_;
/**
* \brief Pointer to observer
*/
@@ -429,7 +433,7 @@ class ConnectionHandlerImpl : public ConnectionHandler,
/**
* \brief Pointer to TransportManager
*/
- transport_manager::TransportManager *transport_manager_;
+ transport_manager::TransportManager& transport_manager_;
protocol_handler::ProtocolHandler *protocol_handler_;
@@ -446,7 +450,7 @@ class ConnectionHandlerImpl : public ConnectionHandler,
/**
* \brief Lock for applications list
*/
- mutable sync_primitives::Lock connection_list_lock_;
+ mutable sync_primitives::RWLock connection_list_lock_;
mutable sync_primitives::RWLock connection_handler_observer_lock_;
/**
@@ -457,13 +461,13 @@ class ConnectionHandlerImpl : public ConnectionHandler,
#ifdef BUILD_TESTS
// Methods for test usage
public:
+ const DeviceMap& getDeviceList();
ConnectionList &getConnectionList();
void addDeviceConnection(
const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectionUID &connection_id);
+ const transport_manager::ConnectionUID connection_id);
#endif
private:
- FRIEND_BASE_SINGLETON_CLASS(ConnectionHandlerImpl);
DISALLOW_COPY_AND_ASSIGN(ConnectionHandlerImpl);
};
} // namespace connection_handler
diff --git a/src/components/connection_handler/include/connection_handler/connection_handler_observer.h b/src/components/connection_handler/include/connection_handler/connection_handler_observer.h
index 556a2dc4e2..be7e600556 100644
--- a/src/components/connection_handler/include/connection_handler/connection_handler_observer.h
+++ b/src/components/connection_handler/include/connection_handler/connection_handler_observer.h
@@ -38,6 +38,10 @@
#include "connection_handler/connection_handler.h"
#include "protocol/service_type.h"
+#ifdef ENABLE_SECURITY
+#include "security_manager/ssl_context.h"
+#endif // ENABLE_SECURITY
+
/**
* \namespace connection_handler
* \brief SmartDeviceLink connection_handler namespace.
@@ -100,6 +104,10 @@ class ConnectionHandlerObserver {
const protocol_handler::ServiceType& type,
const connection_handler::CloseSessionReason& close_reason) = 0;
+#ifdef ENABLE_SECURITY
+ virtual security_manager::SSLContext::HandshakeContext
+ GetHandshakeContext(uint32_t key) const = 0;
+#endif // ENABLE_SECURITY
protected:
/**
* \brief Destructor
diff --git a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
index 0233e269dd..c3e02a4715 100644
--- a/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
+++ b/src/components/connection_handler/include/connection_handler/heartbeat_monitor.h
@@ -50,7 +50,7 @@ class Connection;
*/
class HeartBeatMonitor: public threads::ThreadDelegate {
public:
- HeartBeatMonitor(int32_t heartbeat_timeout_seconds,
+ HeartBeatMonitor(uint32_t heartbeat_timeout_mseconds,
Connection *connection);
/**
@@ -73,13 +73,18 @@ class HeartBeatMonitor: public threads::ThreadDelegate {
* \brief Thread exit procedure.
*/
virtual void exitThreadMain();
-
- void set_heartbeat_timeout_seconds(int32_t timeout, uint8_t session_id);
+ /**
+ * @brief Update heart beat timeout for session
+ * @param timeout contains timeout for updating
+ * @param session_id contain id session for which update timeout
+ * timeout
+ **/
+ void set_heartbeat_timeout_milliseconds(uint32_t timeout, uint8_t session_id);
private:
- // \brief Heartbeat timeout, should be read from profile
- int32_t default_heartbeat_timeout_;
+ // \brief Heartbeat timeout
+ uint32_t default_heartbeat_timeout_;
// \brief Connection that must be closed when timeout elapsed
Connection *connection_;
@@ -88,8 +93,8 @@ class HeartBeatMonitor: public threads::ThreadDelegate {
class SessionState {
public:
- explicit SessionState(int32_t heartbeat_timeout_seconds = 0);
- void UpdateTimeout(int32_t heartbeat_timeout_seconds);
+ explicit SessionState(uint32_t heartbeat_timeout_mseconds = 0);
+ void UpdateTimeout(uint32_t heartbeat_timeout_mseconds);
void PrepareToClose();
bool IsReadyToClose() const;
void KeepAlive();
@@ -97,9 +102,9 @@ class HeartBeatMonitor: public threads::ThreadDelegate {
private:
void RefreshExpiration();
- int32_t heartbeat_timeout_seconds_;
- TimevalStruct heartbeat_expiration;
- bool is_heartbeat_sent;
+ uint32_t heartbeat_timeout_mseconds_;
+ TimevalStruct heartbeat_expiration_;
+ bool is_heartbeat_sent_;
};
diff --git a/src/components/connection_handler/src/connection.cc b/src/components/connection_handler/src/connection.cc
index de8c7edb03..1953792a4f 100644
--- a/src/components/connection_handler/src/connection.cc
+++ b/src/components/connection_handler/src/connection.cc
@@ -37,7 +37,6 @@
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler.h"
#include "protocol_handler/protocol_packet.h"
-#include "config_profile/profile.h"
#include "utils/logger.h"
#include "utils/macro.h"
@@ -76,15 +75,16 @@ const Service *Session::FindService(const protocol_handler::ServiceType &service
Connection::Connection(ConnectionHandle connection_handle,
DeviceHandle connection_device_handle,
ConnectionHandler *connection_handler,
- int32_t heartbeat_timeout)
- : connection_handler_(connection_handler),
- connection_handle_(connection_handle),
- connection_device_handle_(connection_device_handle),
- session_map_lock_(true) {
+ uint32_t heartbeat_timeout)
+ : connection_handler_(connection_handler)
+ , connection_handle_(connection_handle)
+ , connection_device_handle_(connection_device_handle)
+ , session_map_lock_(true)
+ , heartbeat_timeout_(heartbeat_timeout) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK(connection_handler_);
- heartbeat_monitor_ = new HeartBeatMonitor(heartbeat_timeout, this);
+ heartbeat_monitor_ = new HeartBeatMonitor(heartbeat_timeout_, this);
heart_beat_monitor_thread_ = threads::CreateThread("HeartBeatMonitor",
heartbeat_monitor_);
heart_beat_monitor_thread_->start();
@@ -292,7 +292,7 @@ ConnectionHandle Connection::connection_handle() const {
return connection_handle_;
}
-DeviceHandle Connection::connection_device_handle() {
+DeviceHandle Connection::connection_device_handle() const {
return connection_device_handle_;
}
@@ -344,10 +344,9 @@ bool Connection::SupportHeartBeat(uint8_t session_id) {
return false;
}
Session &session = session_it->second;
-
return ((::protocol_handler::PROTOCOL_VERSION_3 == session.protocol_version ||
::protocol_handler::PROTOCOL_VERSION_4 == session.protocol_version) &&
- (profile::Profile::instance()->heart_beat_timeout()));
+ (0 != heartbeat_timeout_));
}
bool Connection::ProtocolVersion(uint8_t session_id, uint8_t& protocol_version) {
@@ -374,8 +373,8 @@ void Connection::KeepAlive(uint8_t session_id) {
heartbeat_monitor_->KeepAlive(session_id);
}
-void Connection::SetHeartBeatTimeout(int32_t timeout, uint8_t session_id) {
- heartbeat_monitor_->set_heartbeat_timeout_seconds(timeout, session_id);
+void Connection::SetHeartBeatTimeout(uint32_t timeout, uint8_t session_id) {
+ heartbeat_monitor_->set_heartbeat_timeout_milliseconds(timeout, session_id);
}
} // namespace connection_handler
diff --git a/src/components/connection_handler/src/connection_handler_impl.cc b/src/components/connection_handler/src/connection_handler_impl.cc
index 0fdb0c68bf..e962da7b19 100644
--- a/src/components/connection_handler/src/connection_handler_impl.cc
+++ b/src/components/connection_handler/src/connection_handler_impl.cc
@@ -38,18 +38,11 @@
#include "connection_handler/connection_handler_impl.h"
#include "transport_manager/info.h"
-#include "config_profile/profile.h"
#ifdef ENABLE_SECURITY
#include "security_manager/security_manager.h"
#endif // ENABLE_SECURITY
-namespace {
-int32_t HeartBeatTimeout() {
- return profile::Profile::instance()->heart_beat_timeout();
-}
-} // namespace
-
/**
* \namespace connection_handler
* \brief SmartDeviceLink ConnectionHandler namespace.
@@ -67,13 +60,16 @@ transport_manager::ConnectionUID ConnectionUIDFromHandle(
return transport_manager::ConnectionUID(handle);
}
-ConnectionHandlerImpl::ConnectionHandlerImpl()
- : connection_handler_observer_(NULL),
- transport_manager_(NULL),
- protocol_handler_(NULL),
- connection_list_lock_(true),
- connection_handler_observer_lock_(),
- connection_list_deleter_(&connection_list_) {
+ConnectionHandlerImpl::ConnectionHandlerImpl(
+ const ConnectionHandlerSettings& settings,
+ transport_manager::TransportManager& tm)
+ : settings_(settings)
+ , connection_handler_observer_(NULL)
+ , transport_manager_(tm)
+ , protocol_handler_(NULL)
+ , connection_list_lock_()
+ , connection_handler_observer_lock_()
+ , connection_list_deleter_(&connection_list_) {
}
ConnectionHandlerImpl::~ConnectionHandlerImpl() {
@@ -100,17 +96,6 @@ void ConnectionHandlerImpl::set_connection_handler_observer(
connection_handler_observer_ = observer;
}
-void ConnectionHandlerImpl::set_transport_manager(
- transport_manager::TransportManager *transport_mngr) {
- LOG4CXX_DEBUG(logger_, "ConnectionHandlerImpl::set_transport_manager() "
- << transport_mngr);
- if (!transport_mngr) {
- LOG4CXX_ERROR(logger_, "Null pointer to TransportManager.");
- return;
- }
- transport_manager_ = transport_mngr;
-}
-
void ConnectionHandlerImpl::set_protocol_handler(
protocol_handler::ProtocolHandler *protocol_handler) {
LOG4CXX_DEBUG(logger_, "ConnectionHandlerImpl::set_protocol_handler()"
@@ -166,7 +151,7 @@ void ConnectionHandlerImpl::OnDeviceRemoved(
std::vector<ConnectionHandle> connections_to_remove;
{
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
for (ConnectionList::iterator it = connection_list_.begin();
it != connection_list_.end(); ++it) {
if (device_info.device_handle() ==
@@ -185,7 +170,6 @@ void ConnectionHandlerImpl::OnDeviceRemoved(
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
if (connection_handler_observer_) {
connection_handler_observer_->RemoveDevice(device_info.device_handle());
- connection_handler_observer_->OnDeviceListUpdated(device_list_);
}
}
@@ -200,7 +184,7 @@ void ConnectionHandlerImpl::OnScanDevicesFailed(
void ConnectionHandlerImpl::OnConnectionEstablished(
const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectionUID &connection_id) {
+ const transport_manager::ConnectionUID connection_id) {
LOG4CXX_AUTO_TRACE(logger_);
DeviceMap::iterator it = device_list_.find(device_info.device_handle());
@@ -209,12 +193,12 @@ void ConnectionHandlerImpl::OnConnectionEstablished(
return;
}
LOG4CXX_DEBUG(logger_, "Add Connection #" << connection_id << " to the list.");
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoWriteLock lock(connection_list_lock_);
connection_list_.insert(
ConnectionList::value_type(
connection_id,
new Connection(connection_id, device_info.device_handle(), this,
- HeartBeatTimeout())));
+ get_settings().heart_beat_timeout())));
}
void ConnectionHandlerImpl::OnConnectionFailed(
@@ -241,7 +225,7 @@ void ConnectionHandlerImpl::OnConnectionClosedFailure(
void ConnectionHandlerImpl::OnUnexpectedDisconnect(
transport_manager::ConnectionUID connection_id,
const transport_manager::CommunicationError &error) {
- LOG4CXX_ERROR(logger_, "ConnectionHandlerImpl::OnUnexpectedDisconnect");
+ LOG4CXX_AUTO_TRACE(logger_);
OnConnectionEnded(connection_id);
}
@@ -262,45 +246,34 @@ void ConnectionHandlerImpl::OnDisconnectFailed(
void ConnectionHandlerImpl::RemoveConnection(
const ConnectionHandle connection_handle) {
- LOG4CXX_INFO(logger_, "ConnectionHandlerImpl::RemoveConnection()");
+ LOG4CXX_AUTO_TRACE(logger_);
OnConnectionEnded(connection_handle);
}
#ifdef ENABLE_SECURITY
-namespace {
-bool AllowProtection(const protocol_handler::ServiceType &service_type,
- const bool is_protected) {
- if (is_protected) {
- // Check deliver-specific services (which shall not be protected)
- const std::list<int> force_unprotected_list =
- profile::Profile::instance()->ReadIntContainer(
- "Security Manager", "ForceUnprotectedService", NULL);
- if (std::find(force_unprotected_list.begin(), force_unprotected_list.end(), service_type) !=
- force_unprotected_list.end()) {
- LOG4CXX_ERROR(logger_, "Service " << static_cast<int>(service_type)
- << " is forbidden to be protected");
- return false;
- }
- } else {
- // Check deliver-specific services (which shall be protected)
- const std::list<int> force_protected_list =
- profile::Profile::instance()->ReadIntContainer(
- "Security Manager", "ForceProtectedService", NULL);
- if (std::find(force_protected_list.begin(), force_protected_list.end(), service_type) !=
- force_protected_list.end()) {
- LOG4CXX_ERROR(logger_, "Service " << static_cast<int>(service_type)
- << " shall be protected");
- return false;
- }
+bool AllowProtection(const ConnectionHandlerSettings& settings,
+ const protocol_handler::ServiceType& service_type,
+ const bool is_protected) {
+ const std::vector<int>& force_unprotected_list =
+ is_protected ? settings.force_unprotected_service()
+ : settings.force_protected_service();
+
+ if (std::find(force_unprotected_list.begin(), force_unprotected_list.end(), service_type) !=
+ force_unprotected_list.end()) {
+ LOG4CXX_ERROR(logger_,
+ "Service " << static_cast<int>(service_type)
+ << " shall be protected");
+ return false;
}
+ LOG4CXX_DEBUG(logger_,
+ "Service " << static_cast<int>(service_type) << " allowed");
return true;
}
-} // namespace
#endif // ENABLE_SECURITY
uint32_t ConnectionHandlerImpl::OnSessionStartedCallback(
- const transport_manager::ConnectionUID &connection_handle,
+ const transport_manager::ConnectionUID connection_handle,
const uint8_t session_id, const protocol_handler::ServiceType &service_type,
const bool is_protected, uint32_t* hash_id) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -309,11 +282,11 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback(
*hash_id = protocol_handler::HASH_ID_WRONG;
}
#ifdef ENABLE_SECURITY
- if (!AllowProtection(service_type, is_protected)) {
+ if (!AllowProtection(get_settings(), service_type, is_protected)) {
return 0;
}
#endif // ENABLE_SECURITY
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Unknown connection!");
@@ -352,6 +325,7 @@ uint32_t ConnectionHandlerImpl::OnSessionStartedCallback(
const bool success = connection_handler_observer_->OnServiceStartedCallback(
connection->connection_device_handle(), session_key, service_type);
if (!success) {
+ LOG4CXX_WARN(logger_, "Service starting forbidden by connection_handler_observer");
if (protocol_handler::kRpc == service_type) {
connection->RemoveSession(new_session_id);
} else {
@@ -389,17 +363,18 @@ void ConnectionHandlerImpl::OnMalformedMessageCallback(
PairFromKey(connection_key, &connection_handle, &session_id);
LOG4CXX_INFO(logger_, "Disconnect malformed messaging application");
- CloseConnectionSessions(connection_handle, kCommon);
+ CloseConnectionSessions(connection_handle, kMalformed);
CloseConnection(connection_handle);
}
uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
- const uint32_t &connection_handle, const uint8_t session_id,
+ const transport_manager::ConnectionUID connection_handle,
+ const uint8_t session_id,
const uint32_t &hashCode,
const protocol_handler::ServiceType &service_type) {
LOG4CXX_AUTO_TRACE(logger_);
- connection_list_lock_.Acquire();
+ connection_list_lock_.AcquireForReading();
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_WARN(logger_, "Unknown connection!");
@@ -447,7 +422,8 @@ uint32_t ConnectionHandlerImpl::OnSessionEndedCallback(
}
uint32_t ConnectionHandlerImpl::KeyFromPair(
- transport_manager::ConnectionUID connection_handle, uint8_t session_id) {
+ transport_manager::ConnectionUID connection_handle,
+ uint8_t session_id) const {
const uint32_t key = connection_handle | (session_id << 16);
LOG4CXX_DEBUG(logger_, "Key for ConnectionHandle:"
<< static_cast<uint32_t>(connection_handle)
@@ -461,8 +437,8 @@ uint32_t ConnectionHandlerImpl::KeyFromPair(
}
void ConnectionHandlerImpl::PairFromKey(uint32_t key,
- uint32_t *connection_handle,
- uint8_t *session_id) {
+ transport_manager::ConnectionUID *connection_handle,
+ uint8_t *session_id) const {
*connection_handle = key & 0xFF00FFFF;
*session_id = key >> 16;
LOG4CXX_DEBUG(logger_, "ConnectionHandle:"
@@ -472,59 +448,63 @@ void ConnectionHandlerImpl::PairFromKey(uint32_t key,
}
int32_t ConnectionHandlerImpl::GetDataOnSessionKey(
- uint32_t key, uint32_t *app_id, std::list<int32_t> *sessions_list,
- uint32_t *device_id) {
+ uint32_t key, uint32_t* app_id, std::list<int32_t>* sessions_list,
+ uint32_t* device_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- int32_t result = -1;
+ const int32_t error_result = -1;
transport_manager::ConnectionUID conn_handle = 0;
uint8_t session_id = 0;
PairFromKey(key, &conn_handle, &session_id);
- ConnectionList::iterator it = connection_list_.find(conn_handle);
+ ConnectionList::const_iterator it = connection_list_.find(conn_handle);
if (connection_list_.end() == it) {
- LOG4CXX_ERROR(logger_, "Unknown connection!");
- return result;
+ LOG4CXX_ERROR(logger_, "Connection not found for key: " << key);
+ return error_result;
+ }
+
+ const Connection &connection = *it->second;
+ const SessionMap session_map = connection.session_map();
+ if (0 == session_id || session_map.end() == session_map.find(session_id)) {
+ LOG4CXX_ERROR(logger_, "Session not found in connection: "
+ << static_cast<int32_t>(conn_handle));
+ return error_result;
}
- Connection &connection = *it->second;
if (device_id) {
*device_id = connection.connection_device_handle();
}
-
+ if (app_id) {
+ *app_id = KeyFromPair(conn_handle, session_id);
+ }
if (sessions_list) {
sessions_list->clear();
- }
- if (0 == session_id) {
- LOG4CXX_WARN(
- logger_,
- "No sessions in connection " << static_cast<int32_t>(conn_handle));
- if (app_id) {
- *app_id = 0;
- }
- } else {
- if (app_id) {
- *app_id = KeyFromPair(conn_handle, session_id);
+ SessionMap::const_iterator session_it = session_map.begin();
+ for (; session_map.end() != session_it; ++session_it) {
+ sessions_list->push_back(KeyFromPair(conn_handle, it->first));
}
+ }
- LOG4CXX_INFO(logger_, "Connection "
- << static_cast<int32_t>(conn_handle)
- << " has " << connection.session_map().size()
- << " sessions.");
+ LOG4CXX_INFO(logger_, "Connection "
+ << static_cast<int32_t>(conn_handle)
+ << " has " << session_map.size()
+ << " sessions.");
+ return 0;
+}
- if (sessions_list) {
- const SessionMap session_map = connection.session_map();
- for (SessionMap::const_iterator session_it = session_map.begin();
- session_map.end() != session_it; ++session_it) {
- sessions_list->push_back(KeyFromPair(conn_handle, it->first));
- }
- }
+const ConnectionHandlerSettings& ConnectionHandlerImpl::get_settings() const
+{
+ return settings_;
+}
- result = 0;
- }
+const protocol_handler::SessionObserver&
+ConnectionHandlerImpl::get_session_observer() {
+ return *this;
+}
- return result;
+DevicesDiscoveryStarter& ConnectionHandlerImpl::get_device_discovery_starter() {
+ return *this;
}
struct CompareMAC {
@@ -554,11 +534,11 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID(
DeviceHandle device_handle,
std::string *device_name,
std::list<uint32_t> *applications_list, std::string *mac_address,
- std::string* connection_type ) {
+ std::string* connection_type ) const {
LOG4CXX_AUTO_TRACE(logger_);
int32_t result = -1;
- DeviceMap::iterator it = device_list_.find(device_handle);
+ DeviceMap::const_iterator it = device_list_.find(device_handle);
if (device_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Device not found!");
return result;
@@ -572,14 +552,14 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID(
}
if (applications_list) {
applications_list->clear();
- sync_primitives::AutoLock connection_list_lock(connection_list_lock_);
- for (ConnectionList::iterator itr = connection_list_.begin();
+ sync_primitives::AutoReadLock connection_list_lock(connection_list_lock_);
+ for (ConnectionList::const_iterator itr = connection_list_.begin();
itr != connection_list_.end(); ++itr) {
if (device_handle == (*itr).second->connection_device_handle()) {
const SessionMap &session_map = (itr->second)->session_map();
for (SessionMap::const_iterator session_it = session_map.begin();
session_map.end() != session_it; ++session_it) {
- const transport_manager::ConnectionUID &connection_handle = itr->first;
+ const transport_manager::ConnectionUID connection_handle = itr->first;
const uint32_t session_id = session_it->first;
const uint32_t application_id = KeyFromPair(connection_handle, session_id);
applications_list->push_back(application_id);
@@ -596,6 +576,18 @@ int32_t ConnectionHandlerImpl::GetDataOnDeviceID(
return result;
}
+
+void ConnectionHandlerImpl::GetConnectedDevicesMAC(
+ std::vector<std::string> &device_macs) const {
+ DeviceMap::const_iterator first = device_list_.begin();
+ DeviceMap::const_iterator last = device_list_.end();
+
+ while(first != last) {
+ device_macs.push_back((*first).second.mac_address());
+ ++first;
+ }
+}
+
#ifdef ENABLE_SECURITY
int ConnectionHandlerImpl::SetSSLContext(
const uint32_t &key, security_manager::SSLContext *context) {
@@ -604,7 +596,7 @@ int ConnectionHandlerImpl::SetSSLContext(
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Unknown connection!");
@@ -621,7 +613,7 @@ security_manager::SSLContext *ConnectionHandlerImpl::GetSSLContext(
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Unknown connection!");
@@ -638,7 +630,7 @@ void ConnectionHandlerImpl::SetProtectionFlag(
uint8_t session_id = 0;
PairFromKey(key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() == it) {
LOG4CXX_ERROR(logger_, "Unknown connection!");
@@ -647,16 +639,17 @@ void ConnectionHandlerImpl::SetProtectionFlag(
Connection &connection = *it->second;
connection.SetProtectionFlag(session_id, service_type);
}
+
+security_manager::SSLContext::HandshakeContext
+ConnectionHandlerImpl::GetHandshakeContext(uint32_t key) const {
+ return connection_handler_observer_->GetHandshakeContext(key);
+}
#endif // ENABLE_SECURITY
void ConnectionHandlerImpl::StartDevicesDiscovery() {
LOG4CXX_AUTO_TRACE(logger_);
- if (NULL == transport_manager_) {
- LOG4CXX_ERROR(logger_, "Null pointer to TransportManager.");
- return;
- }
- transport_manager_->SearchDevices();
+ transport_manager_.SearchDevices();
sync_primitives::AutoReadLock read_lock(connection_handler_observer_lock_);
if (connection_handler_observer_) {
connection_handler_observer_->OnDeviceListUpdated(device_list_);
@@ -668,19 +661,15 @@ void ConnectionHandlerImpl::ConnectToDevice(
connection_handler::DeviceMap::const_iterator it_in;
it_in = device_list_.find(device_handle);
if (device_list_.end() != it_in) {
- LOG4CXX_INFO_EXT(logger_,
+ LOG4CXX_INFO(logger_,
"Connecting to device with handle " << device_handle);
- if (transport_manager_) {
- if (transport_manager::E_SUCCESS
- != transport_manager_->ConnectDevice(device_handle)) {
- LOG4CXX_WARN(logger_, "Can't connect to device");
- }
+ if (transport_manager::E_SUCCESS
+ != transport_manager_.ConnectDevice(device_handle)) {
+ LOG4CXX_WARN(logger_, "Can't connect to device");
} else {
- LOG4CXX_ERROR(logger_, "Null pointer to TransportManager.");
+ LOG4CXX_ERROR(
+ logger_, "Application Manager wanted to connect to non-existing device");
}
- } else {
- LOG4CXX_ERROR(
- logger_, "Application Manager wanted to connect to non-existing device");
}
}
@@ -692,13 +681,8 @@ void ConnectionHandlerImpl::ConnectToAllDevices() {
}
void ConnectionHandlerImpl::StartTransportManager() {
- LOG4CXX_INFO(logger_, "ConnectionHandlerImpl::StartTransportManager()");
- if (NULL == transport_manager_) {
- LOG4CXX_ERROR(logger_, "Null pointer to TransportManager.");
- return;
- }
-
- transport_manager_->Visibility(true);
+ LOG4CXX_AUTO_TRACE(logger_);
+ transport_manager_.Visibility(true);
}
void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) {
@@ -714,15 +698,11 @@ void ConnectionHandlerImpl::CloseRevokedConnection(uint32_t connection_key) {
void ConnectionHandlerImpl::CloseConnection(
ConnectionHandle connection_handle) {
LOG4CXX_AUTO_TRACE(logger_);
- if (!transport_manager_) {
- LOG4CXX_ERROR(logger_, "Null pointer to TransportManager.");
- return;
- }
transport_manager::ConnectionUID connection_uid =
ConnectionUIDFromHandle(connection_handle);
- transport_manager_->DisconnectForce(connection_uid);
+ transport_manager_.DisconnectForce(connection_uid);
- sync_primitives::AutoLock connection_list_lock(connection_list_lock_);
+ sync_primitives::AutoWriteLock connection_list_lock(connection_list_lock_);
ConnectionList::iterator connection_list_itr =
connection_list_.find(connection_uid);
@@ -733,11 +713,12 @@ void ConnectionHandlerImpl::CloseConnection(
uint32_t ConnectionHandlerImpl::GetConnectionSessionsCount(
uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator itr = connection_list_.find(connection_handle);
if (connection_list_.end() != itr) {
@@ -773,7 +754,7 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle,
SessionMap session_map;
{
- sync_primitives::AutoLock connection_list_lock(connection_list_lock_);
+ sync_primitives::AutoReadLock connection_list_lock(connection_list_lock_);
ConnectionList::iterator connection_list_itr =
connection_list_.find(connection_id);
@@ -793,26 +774,27 @@ void ConnectionHandlerImpl::CloseSession(ConnectionHandle connection_handle,
return;
}
+
SessionMap::const_iterator session_map_itr = session_map.find(session_id);
if (session_map_itr != session_map.end()) {
const uint32_t session_key = KeyFromPair(connection_id, session_id);
const Session &session = session_map_itr->second;
const ServiceList &service_list = session.service_list;
- ServiceList::const_iterator service_list_itr = service_list.begin();
- for (;service_list_itr != service_list.end(); ++service_list_itr) {
+ ServiceList::const_reverse_iterator service_list_itr = service_list.rbegin();
+ for (;service_list_itr != service_list.rend(); ++service_list_itr) {
const protocol_handler::ServiceType service_type =
service_list_itr->service_type;
- connection_handler_observer_->OnServiceEndedCallback(
- session_key, service_type, close_reason);
+ connection_handler_observer_->OnServiceEndedCallback(session_key,
+ service_type,
+ close_reason);
}
} else {
- LOG4CXX_ERROR(logger_, "Session with id: "
- << session_id << " not found");
+ LOG4CXX_ERROR(logger_, "Session with id: " << session_id << " not found");
return;
}
- LOG4CXX_DEBUG(logger_, "Session with id: " << session_id
- << " has been closed successfully");
+
+ LOG4CXX_DEBUG(logger_, "Session with id: " << session_id << " has been closed successfully");
}
void ConnectionHandlerImpl::CloseConnectionSessions(
@@ -829,7 +811,7 @@ void ConnectionHandlerImpl::CloseConnectionSessions(
typedef std::vector<uint8_t> SessionIdVector;
SessionIdVector session_id_vector;
{
- sync_primitives::AutoLock connection_list_lock(connection_list_lock_);
+ sync_primitives::AutoReadLock connection_list_lock(connection_list_lock_);
ConnectionList::iterator connection_list_itr =
connection_list_.find(connection_id);
@@ -867,11 +849,12 @@ void ConnectionHandlerImpl::SendEndService(uint32_t key,
}
void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) {
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() != it) {
it->second->StartHeartBeat(session_id);
@@ -879,11 +862,12 @@ void ConnectionHandlerImpl::StartSessionHeartBeat(uint32_t connection_key) {
}
void ConnectionHandlerImpl::SetHeartBeatTimeout(uint32_t connection_key,
- int32_t timeout) {
+ uint32_t timeout) {
+ LOG4CXX_AUTO_TRACE(logger_);
uint32_t connection_handle = 0;
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() != it) {
it->second->SetHeartBeatTimeout(timeout, session_id);
@@ -901,8 +885,8 @@ void ConnectionHandlerImpl::SendHeartBeat(ConnectionHandle connection_handle,
void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key,
uint8_t session_id) {
- sync_primitives::AutoLock lock(connection_list_lock_);
-
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_key);
if (connection_list_.end() != it) {
it->second->KeepAlive(session_id);
@@ -910,11 +894,10 @@ void ConnectionHandlerImpl::KeepConnectionAlive(uint32_t connection_key,
}
void ConnectionHandlerImpl::OnConnectionEnded(
- const transport_manager::ConnectionUID &connection_id) {
+ const transport_manager::ConnectionUID connection_id) {
LOG4CXX_INFO(logger_, "Delete Connection: " << static_cast<int32_t>(connection_id)
<< " from the list.");
-
- connection_list_lock_.Acquire();
+ connection_list_lock_.AcquireForWriting();
ConnectionList::iterator itr = connection_list_.find(connection_id);
if (connection_list_.end() == itr) {
LOG4CXX_ERROR(logger_, "Connection not found!");
@@ -938,8 +921,8 @@ void ConnectionHandlerImpl::OnConnectionEnded(
session_key, service_it->service_type, CloseSessionReason::kCommon);
}
}
- }
-}
+ }
+ }
void ConnectionHandlerImpl::BindProtocolVersionWithSession(
uint32_t connection_key, uint8_t protocol_version) {
@@ -948,7 +931,7 @@ void ConnectionHandlerImpl::BindProtocolVersionWithSession(
uint8_t session_id = 0;
PairFromKey(connection_key, &connection_handle, &session_id);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
ConnectionList::iterator it = connection_list_.find(connection_handle);
if (connection_list_.end() != it) {
it->second->UpdateProtocolVersionSession(session_id, protocol_version);
@@ -956,11 +939,12 @@ void ConnectionHandlerImpl::BindProtocolVersionWithSession(
}
bool ConnectionHandlerImpl::IsHeartBeatSupported(
- transport_manager::ConnectionUID connection_handle,uint8_t session_id) {
+ transport_manager::ConnectionUID connection_handle,
+ uint8_t session_id) const {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(connection_list_lock_);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
uint32_t connection = static_cast<uint32_t>(connection_handle);
- ConnectionList::iterator it = connection_list_.find(connection);
+ ConnectionList::const_iterator it = connection_list_.find(connection);
if (connection_list_.end() == it) {
LOG4CXX_WARN(logger_, "Connection not found !");
return false;
@@ -969,10 +953,10 @@ bool ConnectionHandlerImpl::IsHeartBeatSupported(
}
bool ConnectionHandlerImpl::ProtocolVersionUsed(uint32_t connection_id,
- uint8_t session_id, uint8_t& protocol_version) {
+ uint8_t session_id, uint8_t& protocol_version) const {
LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock lock(connection_list_lock_);
- ConnectionList::iterator it = connection_list_.find(connection_id);
+ sync_primitives::AutoReadLock lock(connection_list_lock_);
+ ConnectionList::const_iterator it = connection_list_.find(connection_id);
if (connection_list_.end() != it) {
return it->second->ProtocolVersion(session_id, protocol_version);
}
@@ -985,9 +969,12 @@ ConnectionList &ConnectionHandlerImpl::getConnectionList() {
return connection_list_;
}
-void ConnectionHandlerImpl::addDeviceConnection(
- const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectionUID &connection_id) {
+const DeviceMap& ConnectionHandlerImpl::getDeviceList() {
+ return device_list_;
+}
+
+void ConnectionHandlerImpl::addDeviceConnection(const transport_manager::DeviceInfo &device_info,
+ const transport_manager::ConnectionUID connection_id) {
// Add Device
OnDeviceAdded(device_info);
// Add connection
diff --git a/src/components/connection_handler/src/device.cc b/src/components/connection_handler/src/device.cc
index 40a048654a..5ba4ba278f 100644
--- a/src/components/connection_handler/src/device.cc
+++ b/src/components/connection_handler/src/device.cc
@@ -52,9 +52,10 @@ Device::Device(DeviceHandle device_handle,
user_friendly_name_(user_friendly_name),
mac_address_(mac_address),
connection_type_(connection_type){
- LOG4CXX_INFO(logger_, "Device MAC address is: " << mac_address_);
mac_address_ = encryption::MakeHash(mac_address);
- LOG4CXX_INFO(logger_, "Device MAC address hash is: " << mac_address_);
+ LOG4CXX_DEBUG(logger_,
+ "Device: MAC address - " << mac_address
+ << ", hash - " << mac_address_);
}
DeviceHandle Device::device_handle() const {
diff --git a/src/components/connection_handler/src/heartbeat_monitor.cc b/src/components/connection_handler/src/heartbeat_monitor.cc
index 2349e0589f..0ed8b704a2 100644
--- a/src/components/connection_handler/src/heartbeat_monitor.cc
+++ b/src/components/connection_handler/src/heartbeat_monitor.cc
@@ -43,17 +43,16 @@ using namespace sync_primitives;
CREATE_LOGGERPTR_GLOBAL(logger_, "HeartBeatMonitor")
-HeartBeatMonitor::HeartBeatMonitor(int32_t heartbeat_timeout_seconds,
+HeartBeatMonitor::HeartBeatMonitor(uint32_t heartbeat_timeout_mseconds,
Connection *connection)
- : default_heartbeat_timeout_(heartbeat_timeout_seconds),
+ : default_heartbeat_timeout_(heartbeat_timeout_mseconds),
connection_(connection),
sessions_list_lock_(true),
run_(true) {
}
void HeartBeatMonitor::Process() {
- AutoLock auto_lock(sessions_list_lock_);
-
+ sessions_list_lock_.Acquire();
SessionMap::iterator it = sessions_.begin();
while (it != sessions_.end()) {
SessionState &state = it->second;
@@ -61,7 +60,10 @@ void HeartBeatMonitor::Process() {
const uint8_t session_id = it->first;
if (state.IsReadyToClose()) {
LOG4CXX_WARN(logger_, "Will close session");
+ sessions_list_lock_.Release();
+ RemoveSession(session_id);
connection_->CloseSession(session_id);
+ sessions_list_lock_.Acquire();
it = sessions_.begin();
continue;
} else {
@@ -73,6 +75,7 @@ void HeartBeatMonitor::Process() {
}
++it;
}
+ sessions_list_lock_.Release();
}
void HeartBeatMonitor::threadMain() {
@@ -95,12 +98,12 @@ void HeartBeatMonitor::AddSession(uint8_t session_id) {
"Session with id " << static_cast<int32_t>(session_id) << " already exists");
return;
}
- sessions_.insert(std::make_pair(session_id,
- SessionState(default_heartbeat_timeout_)));
+ sessions_.insert(std::make_pair(session_id, SessionState(default_heartbeat_timeout_)));
LOG4CXX_INFO(logger_, "Start heartbeat for session " << session_id);
}
void HeartBeatMonitor::RemoveSession(uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
AutoLock auto_lock(sessions_list_lock_);
LOG4CXX_DEBUG(logger_,
@@ -114,6 +117,7 @@ void HeartBeatMonitor::RemoveSession(uint8_t session_id) {
}
void HeartBeatMonitor::KeepAlive(uint8_t session_id) {
+ LOG4CXX_AUTO_TRACE(logger_);
AutoLock auto_lock(sessions_list_lock_);
if (sessions_.end() != sessions_.find(session_id)) {
@@ -133,7 +137,7 @@ void HeartBeatMonitor::exitThreadMain() {
heartbeat_monitor_.NotifyOne();
}
-void HeartBeatMonitor::set_heartbeat_timeout_seconds(int32_t timeout,
+void HeartBeatMonitor::set_heartbeat_timeout_milliseconds(uint32_t timeout,
uint8_t session_id) {
LOG4CXX_DEBUG(logger_, "Set new heart beat timeout " << timeout <<
"For session: " << session_id);
@@ -144,46 +148,49 @@ void HeartBeatMonitor::set_heartbeat_timeout_seconds(int32_t timeout,
}
}
-HeartBeatMonitor::SessionState::SessionState(int32_t heartbeat_timeout_seconds)
- : heartbeat_timeout_seconds_(heartbeat_timeout_seconds),
- is_heartbeat_sent(false) {
+HeartBeatMonitor::SessionState::SessionState(uint32_t heartbeat_timeout_mseconds)
+ : heartbeat_timeout_mseconds_(heartbeat_timeout_mseconds),
+ is_heartbeat_sent_(false) {
LOG4CXX_AUTO_TRACE(logger_);
RefreshExpiration();
}
-void HeartBeatMonitor::SessionState::RefreshExpiration () {
- LOG4CXX_DEBUG(logger_, "Refresh expiration: " << heartbeat_timeout_seconds_);
- heartbeat_expiration = date_time::DateTime::getCurrentTime();
- heartbeat_expiration.tv_sec += heartbeat_timeout_seconds_;
+void HeartBeatMonitor::SessionState::RefreshExpiration() {
+ LOG4CXX_DEBUG(logger_, "Refresh expiration: " << heartbeat_timeout_mseconds_);
+ using namespace date_time;
+ TimevalStruct time = DateTime::getCurrentTime();
+ DateTime::AddMilliseconds(time, heartbeat_timeout_mseconds_);
+ heartbeat_expiration_ = time;
+
}
void HeartBeatMonitor::SessionState::UpdateTimeout(
- int32_t heartbeat_timeout_seconds) {
+ uint32_t heartbeat_timeout_mseconds) {
LOG4CXX_DEBUG(logger_, "Update timout with value " <<
- heartbeat_timeout_seconds_);
- heartbeat_timeout_seconds_ = heartbeat_timeout_seconds;
+ heartbeat_timeout_mseconds_);
+ heartbeat_timeout_mseconds_ = heartbeat_timeout_mseconds;
RefreshExpiration();
}
void HeartBeatMonitor::SessionState::PrepareToClose() {
- is_heartbeat_sent = true;
+ is_heartbeat_sent_ = true;
LOG4CXX_DEBUG(logger_, "Prepare to close");
RefreshExpiration();
}
bool HeartBeatMonitor::SessionState::IsReadyToClose() const {
- return is_heartbeat_sent;
+ return is_heartbeat_sent_;
}
void HeartBeatMonitor::SessionState::KeepAlive() {
- is_heartbeat_sent = false;
- LOG4CXX_DEBUG(logger_, "keep alive");
+ LOG4CXX_AUTO_TRACE(logger_);
+ is_heartbeat_sent_ = false;
RefreshExpiration();
}
bool HeartBeatMonitor::SessionState::HasTimeoutElapsed() {
TimevalStruct now = date_time::DateTime::getCurrentTime();
- return date_time::DateTime::Greater(now, heartbeat_expiration);
+ return date_time::DateTime::Greater(now, heartbeat_expiration_);
}
} // namespace connection_handler
diff --git a/src/components/connection_handler/test/CMakeLists.txt b/src/components/connection_handler/test/CMakeLists.txt
index 7c0e1b2a98..23c92440ee 100644
--- a/src/components/connection_handler/test/CMakeLists.txt
+++ b/src/components/connection_handler/test/CMakeLists.txt
@@ -38,6 +38,7 @@ include_directories(
${COMPONENTS_DIR}/security_manager/test/include
${COMPONENTS_DIR}/protocol_handler/test/include
${COMPONENTS_DIR}/security_manager/include
+ ${COMPONENTS_DIR}/application_manager/include
${COMPONENTS_DIR}/connection_handler/test/include
${COMPONENTS_DIR}/transport_manager/test/include
)
@@ -51,10 +52,10 @@ set(LIBRARIES
)
set(SOURCES
- #connection_handler_impl_test.cc
+ connection_handler_impl_test.cc
connection_test.cc
device_test.cc
- #heart_beat_monitor_test.cc
+ heart_beat_monitor_test.cc
)
file(COPY ${appMain_DIR}/smartDeviceLink.ini DESTINATION "./")
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 94e4c816fa..9c5b1ea377 100644
--- a/src/components/connection_handler/test/connection_handler_impl_test.cc
+++ b/src/components/connection_handler/test/connection_handler_impl_test.cc
@@ -30,38 +30,64 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
#include <fstream>
#include <cstdint>
+#include <vector>
#include "connection_handler/connection_handler_impl.h"
#include "protocol/common.h"
-#include "config_profile/profile.h"
// TODO(EZamakhov): move security test
-#include "security_manager_mock.h"
-#include "protocol_handler_mock.h"
+#include "security_manager/mock_security_manager.h"
+#include "security_manager/mock_ssl_context.h"
+#include "protocol_handler/protocol_handler_mock.h"
#include "connection_handler_observer_mock.h"
-#include "transport_manager_mock.h"
+#include "connection_handler/mock_connection_handler_settings.h"
+#include "transport_manager/transport_manager_mock.h"
+#include "encryption/hashing.h"
namespace test {
namespace components {
-namespace connection_handle_test {
+namespace connection_handler_test {
using namespace ::connection_handler;
using ::protocol_handler::ServiceType;
using namespace ::protocol_handler;
using ::testing::_;
using ::testing::InSequence;
+using ::testing::Mock;
+using ::testing::Return;
+using ::testing::ReturnRefOfCopy;
+
// For service types and PROTECTION_ON/OFF
+enum UnnamedService {
+ served_service1 = 0x06,
+ served_service2 = 0x08
+};
+
class ConnectionHandlerTest : public ::testing::Test {
protected:
void SetUp() OVERRIDE {
- connection_handler_ = ConnectionHandlerImpl::instance();
+ connection_handler_ = new ConnectionHandlerImpl(
+ mock_connection_handler_settings,
+ mock_transport_manager);
uid_ = 1u;
connection_key_ = connection_handler_->KeyFromPair(0, 0u);
+ protected_services_.clear();
+ unprotected_services_.clear();
+ SetSpecificServices();
}
void TearDown() OVERRIDE {
- ConnectionHandlerImpl::destroy();
+ delete connection_handler_;
+ }
+
+ void SetSpecificServices() {
+#ifdef ENABLE_SECURITY
+ ON_CALL(mock_connection_handler_settings, force_protected_service())
+ .WillByDefault(ReturnRefOfCopy(protected_services_));
+ ON_CALL(mock_connection_handler_settings, force_unprotected_service())
+ .WillByDefault(ReturnRefOfCopy(unprotected_services_));
+#endif // ENABLE_SECURITY
}
// Additional SetUp
void AddTestDeviceConnection() {
@@ -76,10 +102,11 @@ class ConnectionHandlerTest : public ::testing::Test {
device_name_,
connection_type_);
// Add Device and connection
+ ON_CALL(mock_connection_handler_settings, heart_beat_timeout())
+ .WillByDefault(Return(1000u));
connection_handler_->addDeviceConnection(device_info, uid_);
connection_key_ = connection_handler_->KeyFromPair(uid_, 0u);
// Remove all specific services
- SetSpecificServices("", "");
}
void AddTestSession() {
start_session_id_ = connection_handler_->OnSessionStartedCallback(
@@ -102,22 +129,6 @@ class ConnectionHandlerTest : public ::testing::Test {
EXPECT_EQ(session_id, start_session_id_);
}
- // Additional SetUp
- void SetSpecificServices(const std::string& protect, const std::string& not_protect) {
- const char* config_file = "config.ini";
- std::ofstream file_config(config_file);
- ASSERT_TRUE(file_config.is_open());
- const std::string non("NON");
- file_config << "[Security Manager]" << std::endl
- << "; Force protected services (could be id's from 0x01 to 0xFF)"
- << std::endl << "ForceProtectedService = "
- << (protect.empty() ? non : protect) << std::endl
- << "; Force unprotected services" << std::endl
- << "ForceUnprotectedService = "
- << (not_protect.empty() ? non : not_protect) << std::endl;
- file_config.close();
- profile::Profile::instance()->config_file_name(config_file);
- }
// Check Service Wrapper
// If session_id is NULL - check that there is no sessions in connection
void CheckSessionExists(const int connectionId, const int session_id) {
@@ -221,6 +232,10 @@ class ConnectionHandlerTest : public ::testing::Test {
}
ConnectionHandlerImpl* connection_handler_;
+ testing::NiceMock<transport_manager_test::MockTransportManager>
+ mock_transport_manager;
+ testing::NiceMock<MockConnectionHandlerSettings>
+ mock_connection_handler_settings;
transport_manager::DeviceHandle device_handle_;
transport_manager::ConnectionUID uid_;
uint32_t connection_key_;
@@ -231,6 +246,9 @@ class ConnectionHandlerTest : public ::testing::Test {
std::string device_name_;
std::string mac_address_;
+ const uint32_t heartbeat_timeout = 100u;
+ std::vector<int> protected_services_;
+ std::vector<int> unprotected_services_;
};
TEST_F(ConnectionHandlerTest, StartSession_NoConnection) {
@@ -251,6 +269,15 @@ TEST_F(ConnectionHandlerTest, StartSession) {
AddTestSession();
}
+TEST_F(ConnectionHandlerTest, AddConnection_StopConnection) {
+ // Add virtual device and connection
+ AddTestDeviceConnection();
+ EXPECT_FALSE(connection_handler_->getConnectionList().empty());
+ // Stop connection
+ connection_handler_->Stop();
+ EXPECT_TRUE(connection_handler_->getConnectionList().empty());
+}
+
TEST_F(ConnectionHandlerTest, GetConnectionSessionsCount) {
AddTestDeviceConnection();
EXPECT_EQ(0u, connection_handler_->GetConnectionSessionsCount(connection_key_));
@@ -270,6 +297,13 @@ TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey) {
EXPECT_EQ(testid, app_id);
}
+TEST_F(ConnectionHandlerTest, GetAppIdOnSessionKey_SessionNotStarted) {
+ AddTestDeviceConnection();
+
+ uint32_t app_id = 0;
+ EXPECT_EQ(-1, connection_handler_->GetDataOnSessionKey(connection_key_, &app_id, NULL, NULL));
+}
+
TEST_F(ConnectionHandlerTest,GetDeviceID) {
AddTestDeviceConnection();
AddTestSession();
@@ -305,6 +339,21 @@ TEST_F(ConnectionHandlerTest,GetConnectionType) {
EXPECT_EQ(connection_type_, test_connection_type);
}
+TEST_F(ConnectionHandlerTest, GetApplicationsOnDevice) {
+ AddTestDeviceConnection();
+ AddTestSession();
+
+ const DeviceHandle handle = 0;
+ std::list<uint32_t> applications_list;
+ EXPECT_EQ(0, connection_handler_->GetDataOnDeviceID(handle, NULL,
+ &applications_list));
+
+ uint32_t test_id = connection_handler_->KeyFromPair(uid_, start_session_id_);
+ EXPECT_EQ(1u, applications_list.size());
+
+ EXPECT_EQ(test_id, applications_list.front());
+}
+
TEST_F(ConnectionHandlerTest, GetDefaultProtocolVersion) {
AddTestDeviceConnection();
AddTestSession();
@@ -353,7 +402,6 @@ TEST_F(ConnectionHandlerTest, GetPairFromKey) {
TEST_F(ConnectionHandlerTest, IsHeartBeatSupported) {
AddTestDeviceConnection();
AddTestSession();
-
ChangeProtocol(uid_, start_session_id_, PROTOCOL_VERSION_3);
EXPECT_TRUE(connection_handler_->IsHeartBeatSupported(uid_, start_session_id_));
}
@@ -432,25 +480,52 @@ TEST_F(ConnectionHandlerTest, OnApplicationFloodCallBack) {
protocol_handler_test::ProtocolHandlerMock mock_protocol_handler;
connection_handler_->set_protocol_handler(&mock_protocol_handler);
- EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_));
+ EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_)).Times(1);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
- OnServiceEndedCallback(connection_key_,kMobileNav, kCommon)).Times(1);
+ OnServiceEndedCallback(connection_key_,kMobileNav, kCommon));
EXPECT_CALL(mock_connection_handler_observer,
- OnServiceEndedCallback(connection_key_,kAudio, kCommon)).Times(1);
+ OnServiceEndedCallback(connection_key_,kAudio, kCommon));
EXPECT_CALL(mock_connection_handler_observer,
- OnServiceEndedCallback(connection_key_,kBulk, kCommon)).Times(1);
+ OnServiceEndedCallback(connection_key_,kBulk, kCommon));
EXPECT_CALL(mock_connection_handler_observer,
- OnServiceEndedCallback(connection_key_,kRpc, kCommon)).Times(1);
+ OnServiceEndedCallback(connection_key_,kRpc, kCommon));
connection_handler_->OnApplicationFloodCallBack(uid_);
}
+TEST_F(ConnectionHandlerTest, OnApplicationFloodCallBack_SessionFound) {
+ // Precondition
+ AddTestDeviceConnection();
+ AddTestSession();
+ AddTestService(kAudio);
+ AddTestService(kMobileNav);
+
+ connection_handler_test::ConnectionHandlerObserverMock mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(&mock_connection_handler_observer);
+
+ protocol_handler_test::ProtocolHandlerMock mock_protocol_handler;
+ connection_handler_->set_protocol_handler(&mock_protocol_handler);
+
+ EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_));
+
+ InSequence seq;
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kMobileNav, kFlood));
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kAudio, kFlood));
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kBulk, kFlood));
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kRpc, kFlood));
+
+ connection_handler_->OnApplicationFloodCallBack(connection_key_);
+}
+
TEST_F(ConnectionHandlerTest, StartDevicesDiscovery) {
AddTestDeviceConnection();
AddTestSession();
- transport_manager_test::TransportManagerMock mock_transport_manager;
- connection_handler_->set_transport_manager(&mock_transport_manager);
+
connection_handler_test::ConnectionHandlerObserverMock mock_connection_handler_observer;
connection_handler_->set_connection_handler_observer(&mock_connection_handler_observer);
@@ -459,20 +534,217 @@ TEST_F(ConnectionHandlerTest, StartDevicesDiscovery) {
connection_handler_->StartDevicesDiscovery();
}
+MATCHER_P(CheckDevList, check_device_map, "") {
+ DeviceMap device_list = arg;
+ if (device_list.size() != check_device_map.size()) {
+ return false;
+ }
+ DeviceMap::const_iterator it = device_list.begin();
+ DeviceMap::const_iterator end = device_list.end();
+
+ DeviceMap::const_iterator check_it = check_device_map.begin();
+ for (; it != end; ++it, ++check_it) {
+ if (it->first != check_it->first) {
+ return false;
+ }
+ if ((*it).second.device_handle() != (*check_it).second.device_handle()) {
+ return false;
+ }
+ if ((*it).second.mac_address() != (*check_it).second.mac_address()) {
+ return false;
+ }
+ if ((*it).second.connection_type() != (*check_it).second.connection_type()) {
+ return false;
+ }
+ }
+ return true;
+}
+
+TEST_F(ConnectionHandlerTest, UpdateDeviceList) {
+ // Precondition
+ AddTestDeviceConnection();
+ AddTestSession();
+ connection_handler_test::ConnectionHandlerObserverMock
+ mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(
+ &mock_connection_handler_observer);
+
+ connection_type_ = "BTMAC";
+ device_name_ = "test_name";
+ mac_address_ = "test_address";
+ const transport_manager::DeviceInfo added_info(0, "test_address", "test_name",
+ "BTMAC");
+ connection_handler_->OnDeviceAdded(added_info);
+
+ // Prepare map with DeviceInfo that sets in OnDeviceListUpdated
+ const transport_manager::DeviceInfo unused_parameter(
+ 0, "mac_address_", "device_name_", "connection_type_");
+ std::vector<transport_manager::DeviceInfo> unused_info;
+ unused_info.push_back(unused_parameter);
+ DeviceMap map_with_unused_var;
+ map_with_unused_var.insert(DeviceMap::value_type(
+ unused_parameter.device_handle(),
+ Device(unused_parameter.device_handle(), unused_parameter.name(),
+ unused_parameter.mac_address(),
+ unused_parameter.connection_type())));
+
+ // Only previously added devices is updated
+ EXPECT_CALL(
+ mock_connection_handler_observer,
+ OnDeviceListUpdated(CheckDevList(connection_handler_->getDeviceList())));
+
+ // New value that sets in OnDeviceListUpdated does not add
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnDeviceListUpdated(CheckDevList(map_with_unused_var))).Times(0);
+
+ connection_handler_->OnDeviceListUpdated(unused_info);
+}
+
+TEST_F(ConnectionHandlerTest, GetConnectedDevicesMAC) {
+ // Precondition
+ const std::string mac_address1 = "test_address1";
+ const std::string mac_address2 = "test_address2";
+
+ const transport_manager::DeviceInfo device1(0, mac_address1, device_name_,
+ connection_type_);
+ const transport_manager::DeviceInfo device2(1, mac_address2, device_name_,
+ connection_type_);
+ connection_handler_->OnDeviceAdded(device1);
+ connection_handler_->OnDeviceAdded(device2);
+
+ // Expect mac adress was hashed and saved
+ const std::string check_mac1 = encryption::MakeHash(mac_address1);
+ const std::string check_mac2 = encryption::MakeHash(mac_address2);
+ std::vector<std::string> device_macs;
+ connection_handler_->GetConnectedDevicesMAC(device_macs);
+ ASSERT_EQ(2u,device_macs.size());
+ EXPECT_EQ(check_mac1, device_macs.at(0));
+ EXPECT_EQ(check_mac2, device_macs.at(1));
+}
+
TEST_F(ConnectionHandlerTest, StartTransportManager) {
AddTestDeviceConnection();
AddTestSession();
- transport_manager_test::TransportManagerMock mock_transport_manager;
- connection_handler_->set_transport_manager(&mock_transport_manager);
+
EXPECT_CALL(mock_transport_manager, Visibility(true));
connection_handler_->StartTransportManager();
}
+TEST_F(ConnectionHandlerTest, OnDeviceRemoved_ServiceNotStarted) {
+ // Precondition
+ const uint32_t dev_handle1 = 1;
+ const uint32_t dev_handle2 = 2;
+
+ const transport_manager::DeviceInfo device1(dev_handle1, mac_address_,
+ device_name_, connection_type_);
+ const transport_manager::DeviceInfo device2(dev_handle2, mac_address_,
+ device_name_, connection_type_);
+ connection_handler_->OnDeviceAdded(device1);
+ connection_handler_->OnDeviceAdded(device2);
+
+
+ connection_handler_test::ConnectionHandlerObserverMock mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(&mock_connection_handler_observer);
+
+ EXPECT_CALL(mock_connection_handler_observer, RemoveDevice(dev_handle1) );
+ EXPECT_CALL(mock_connection_handler_observer, OnServiceEndedCallback(_,_,_)).Times(0);
+ connection_handler_->OnDeviceRemoved(device1);
+}
+
+TEST_F(ConnectionHandlerTest, OnDeviceRemoved_ServiceStarted) {
+ // Precondition
+ AddTestDeviceConnection();
+ AddTestSession();
+
+ const transport_manager::DeviceInfo device1(device_handle_,
+ mac_address_,
+ device_name_,
+ connection_type_);
+
+ connection_handler_test::ConnectionHandlerObserverMock mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(&mock_connection_handler_observer);
+
+ EXPECT_CALL(mock_connection_handler_observer, RemoveDevice(device_handle_));
+
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kBulk, kCommon));
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kRpc, kCommon));
+ connection_handler_->OnDeviceRemoved(device1);
+}
+
+TEST_F(ConnectionHandlerTest, OnConnectionClosed) {
+ AddTestDeviceConnection();
+ AddTestSession();
+
+ connection_handler_test::ConnectionHandlerObserverMock mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(&mock_connection_handler_observer);
+
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kBulk, kCommon));
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kRpc, kCommon));
+
+ connection_handler_->OnConnectionClosed(uid_);
+}
+
+TEST_F(ConnectionHandlerTest, OnUnexpectedDisconnect) {
+ AddTestDeviceConnection();
+ AddTestSession();
+
+ connection_handler_test::ConnectionHandlerObserverMock mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(&mock_connection_handler_observer);
+ transport_manager::CommunicationError err;
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kBulk, CloseSessionReason::kCommon));
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceEndedCallback(connection_key_,kRpc, CloseSessionReason::kCommon));
+
+ connection_handler_->OnUnexpectedDisconnect(uid_,err);
+}
+
+
+TEST_F(ConnectionHandlerTest, ConnectToDevice) {
+ // Precondition
+ const uint32_t dev_handle1 = 1;
+ const uint32_t dev_handle2 = 2;
+
+ const transport_manager::DeviceInfo device1(dev_handle1, mac_address_,
+ device_name_, connection_type_);
+ const transport_manager::DeviceInfo device2(dev_handle2, mac_address_,
+ device_name_, connection_type_);
+ connection_handler_->OnDeviceAdded(device1);
+ connection_handler_->OnDeviceAdded(device2);
+
+ EXPECT_CALL(mock_transport_manager, ConnectDevice(dev_handle1))
+ .WillOnce(Return(transport_manager::E_SUCCESS));
+ EXPECT_CALL(mock_transport_manager, ConnectDevice(dev_handle2)).Times(0);
+ connection_handler_->ConnectToDevice(dev_handle1);
+}
+
+TEST_F(ConnectionHandlerTest, ConnectToAllDevices) {
+ // Precondition
+ const uint32_t dev_handle1 = 1;
+ const uint32_t dev_handle2 = 2;
+
+ const transport_manager::DeviceInfo device1(dev_handle1, mac_address_,
+ device_name_, connection_type_);
+ const transport_manager::DeviceInfo device2(dev_handle2, mac_address_,
+ device_name_, connection_type_);
+ connection_handler_->OnDeviceAdded(device1);
+ connection_handler_->OnDeviceAdded(device2);
+
+ EXPECT_CALL(mock_transport_manager, ConnectDevice(dev_handle1))
+ .WillOnce(Return(transport_manager::E_SUCCESS));
+ EXPECT_CALL(mock_transport_manager, ConnectDevice(dev_handle2))
+ .WillOnce(Return(transport_manager::E_SUCCESS));
+ connection_handler_->ConnectToAllDevices();
+}
+
TEST_F(ConnectionHandlerTest, CloseConnection) {
AddTestDeviceConnection();
AddTestSession();
- transport_manager_test::TransportManagerMock mock_transport_manager;
- connection_handler_->set_transport_manager(&mock_transport_manager);
+
EXPECT_CALL(mock_transport_manager, DisconnectForce(uid_));
connection_handler_->CloseConnection(uid_);
}
@@ -480,8 +752,7 @@ TEST_F(ConnectionHandlerTest, CloseConnection) {
TEST_F(ConnectionHandlerTest, CloseRevokedConnection) {
AddTestDeviceConnection();
AddTestSession();
- transport_manager_test::TransportManagerMock mock_transport_manager;
- connection_handler_->set_transport_manager(&mock_transport_manager);
+
EXPECT_CALL(mock_transport_manager, DisconnectForce(uid_));
connection_handler_->CloseRevokedConnection(connection_key_);
}
@@ -497,7 +768,7 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithCommonReason) {
protocol_handler_test::ProtocolHandlerMock mock_protocol_handler;
connection_handler_->set_protocol_handler(&mock_protocol_handler);
- EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_));
+ EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_)).Times(1);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
@@ -509,6 +780,7 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithCommonReason) {
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_,kRpc, kCommon)).Times(1);
connection_handler_->CloseSession(connection_key_, kCommon);
+ Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(ConnectionHandlerTest, CloseSessionWithFloodReason) {
@@ -522,7 +794,7 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithFloodReason) {
protocol_handler_test::ProtocolHandlerMock mock_protocol_handler;
connection_handler_->set_protocol_handler(&mock_protocol_handler);
- EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_));
+ EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_)).Times(1);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
@@ -534,6 +806,7 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithFloodReason) {
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_,kRpc, kFlood)).Times(1);
connection_handler_->CloseSession(connection_key_, kFlood);
+ Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) {
@@ -559,6 +832,7 @@ TEST_F(ConnectionHandlerTest, CloseSessionWithMalformedMessage) {
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_,kRpc, kMalformed)).Times(1);
connection_handler_->CloseSession(connection_key_, kMalformed);
+ Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) {
@@ -584,6 +858,7 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithMalformedMessage) {
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_,kRpc, kMalformed)).Times(1);
connection_handler_->CloseConnectionSessions(uid_, kMalformed);
+ Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithCommonReason) {
@@ -597,11 +872,11 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithCommonReason) {
protocol_handler_test::ProtocolHandlerMock mock_protocol_handler;
connection_handler_->set_protocol_handler(&mock_protocol_handler);
- EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_));
+ EXPECT_CALL(mock_protocol_handler, SendEndSession(uid_,start_session_id_)).Times(1);
InSequence seq;
EXPECT_CALL(mock_connection_handler_observer,
- OnServiceEndedCallback(connection_key_,kMobileNav, kCommon)).Times(1);
+ OnServiceEndedCallback(connection_key_, kMobileNav, kCommon)).Times(1);
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_,kAudio, kCommon)).Times(1);
EXPECT_CALL(mock_connection_handler_observer,
@@ -609,6 +884,7 @@ TEST_F(ConnectionHandlerTest, CloseConnectionSessionsWithCommonReason) {
EXPECT_CALL(mock_connection_handler_observer,
OnServiceEndedCallback(connection_key_,kRpc, kCommon)).Times(1);
connection_handler_->CloseConnectionSessions(uid_, kCommon);
+ Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(ConnectionHandlerTest, StartService_withServices) {
@@ -707,11 +983,35 @@ TEST_F(ConnectionHandlerTest, SessionStop_CheckSpecificHash) {
}
}
+TEST_F(ConnectionHandlerTest, SessionStarted_WithRpc) {
+ // Add virtual device and connection
+ AddTestDeviceConnection();
+ // Expect that rpc service has started
+ connection_handler_test::ConnectionHandlerObserverMock
+ mock_connection_handler_observer;
+ connection_handler_->set_connection_handler_observer(
+ &mock_connection_handler_observer);
+ uint32_t session_key =
+ connection_handler_->KeyFromPair(uid_, start_session_id_);
+ EXPECT_CALL(mock_connection_handler_observer,
+ OnServiceStartedCallback(device_handle_, session_key, kRpc))
+ .WillOnce(Return(true));
+
+ // Start new session with RPC service
+ uint32_t new_session_id = connection_handler_->OnSessionStartedCallback(
+ uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_);
+
+ EXPECT_NE(0u, new_session_id);
+}
+
TEST_F(ConnectionHandlerTest, SessionStarted_StartSession_SecureSpecific_Unprotect) {
+ EXPECT_CALL(mock_connection_handler_settings, heart_beat_timeout())
+ .WillOnce(Return(heartbeat_timeout));
// Add virtual device and connection
AddTestDeviceConnection();
// Forbid start kRPC without encryption
- SetSpecificServices("0x07", "");
+ protected_services_.push_back(kRpc);
+ SetSpecificServices();
// Start new session with RPC service
const uint32_t session_id_fail = connection_handler_->OnSessionStartedCallback(
uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_);
@@ -724,7 +1024,9 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartSession_SecureSpecific_Unprote
#endif // ENABLE_SECURITY
// Allow start kRPC without encryption
- SetSpecificServices("0x00, Non", "");
+ protected_services_.clear();
+ protected_services_.push_back(kControl);
+ SetSpecificServices();
// Start new session with RPC service
const uint32_t session_id = connection_handler_->OnSessionStartedCallback(
uid_, 0, kRpc, PROTECTION_OFF, &out_hash_id_);
@@ -737,7 +1039,11 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartSession_SecureSpecific_Protect
// Add virtual device and connection
AddTestDeviceConnection();
// Forbid start kRPC with encryption
- SetSpecificServices("", "0x06, 0x07, 0x08, Non");
+ unprotected_services_.push_back(UnnamedService::served_service1);
+ unprotected_services_.push_back(kRpc);
+ unprotected_services_.push_back(UnnamedService::served_service2);
+ unprotected_services_.push_back(kControl);
+ SetSpecificServices();
// Start new session with RPC service
const uint32_t session_id_fail = connection_handler_->OnSessionStartedCallback(
uid_, 0, kRpc, PROTECTION_ON, NULL);
@@ -748,7 +1054,9 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartSession_SecureSpecific_Protect
#endif // ENABLE_SECURITY
// Allow start kRPC with encryption
- SetSpecificServices("", "0x00, 0x05, Non");
+ unprotected_services_.clear();
+ unprotected_services_.push_back(kControl);
+ SetSpecificServices();
// Start new session with RPC service
const uint32_t session_id = connection_handler_->OnSessionStartedCallback(
uid_, 0, kRpc, PROTECTION_ON, &out_hash_id_);
@@ -763,11 +1071,12 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartService_SecureSpecific_Unprote
AddTestDeviceConnection();
AddTestSession();
- // Audio is 0x0A
- ASSERT_EQ(0x0A, kAudio);
-
// Forbid start kAudio without encryption
- SetSpecificServices("0x06, 0x0A, 0x08, Non", "");
+ protected_services_.push_back(UnnamedService::served_service1);
+ protected_services_.push_back(kAudio);
+ protected_services_.push_back(UnnamedService::served_service2);
+ protected_services_.push_back(kControl);
+ SetSpecificServices();
// Start new session with Audio service
const uint32_t session_id2 = connection_handler_->OnSessionStartedCallback(
uid_, start_session_id_, kAudio, PROTECTION_OFF, NULL);
@@ -777,7 +1086,12 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartService_SecureSpecific_Unprote
EXPECT_EQ(1u, session_id2);
#endif // ENABLE_SECURITY
// Allow start kAudio without encryption
- SetSpecificServices("0x06, 0x0B, 0x08, Non", "");
+ protected_services_.clear();
+ protected_services_.push_back(UnnamedService::served_service1);
+ protected_services_.push_back(kMobileNav);
+ protected_services_.push_back(UnnamedService::served_service2);
+ protected_services_.push_back(kControl);
+ SetSpecificServices();
const uint32_t session_id3 = connection_handler_->OnSessionStartedCallback(
uid_, start_session_id_, kAudio, PROTECTION_OFF, &out_hash_id_);
// Returned original session id
@@ -797,10 +1111,12 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartService_SecureSpecific_Protect
AddTestDeviceConnection();
AddTestSession();
- // Audio is 0x0A
- ASSERT_EQ(0x0A, kAudio);
// Forbid start kAudio with encryption
- SetSpecificServices("", "0x06, 0x0A, 0x08, Non");
+ unprotected_services_.push_back(UnnamedService::served_service1);
+ unprotected_services_.push_back(kAudio);
+ unprotected_services_.push_back(UnnamedService::served_service2);
+ unprotected_services_.push_back(kControl);
+ SetSpecificServices();
// Start new session with Audio service
const uint32_t session_id_reject = connection_handler_->OnSessionStartedCallback(
uid_, start_session_id_, kAudio, PROTECTION_ON, NULL);
@@ -810,7 +1126,8 @@ TEST_F(ConnectionHandlerTest, SessionStarted_StartService_SecureSpecific_Protect
EXPECT_EQ(1u, session_id_reject);
#endif // ENABLE_SECURITY
// Allow start kAudio with encryption
- SetSpecificServices("", "Non");
+ unprotected_services_.clear();
+ SetSpecificServices();
const uint32_t session_id3 = connection_handler_->OnSessionStartedCallback(
uid_, start_session_id_, kAudio, PROTECTION_ON, &out_hash_id_);
// Returned original session id
@@ -918,7 +1235,7 @@ TEST_F(ConnectionHandlerTest, SetSSLContext) {
EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kControl),
reinterpret_cast<security_manager::SSLContext *>(NULL));
- testing::StrictMock<security_manager_test::SSLContextMock> mock_ssl_context;
+ testing::StrictMock<security_manager_test::MockSSLContext> mock_ssl_context;
// Error on no connection
EXPECT_EQ(
connection_handler_->SetSSLContext(connection_key_, &mock_ssl_context),
@@ -959,7 +1276,7 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) {
EXPECT_EQ(connection_handler_->GetSSLContext(connection_key_, kControl),
reinterpret_cast<security_manager::SSLContext *>(NULL));
- testing::StrictMock<security_manager_test::SSLContextMock> mock_ssl_context;
+ testing::StrictMock<security_manager_test::MockSSLContext> mock_ssl_context;
AddTestDeviceConnection();
AddTestSession();
EXPECT_EQ(
@@ -983,7 +1300,7 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByProtectedService) {
&mock_ssl_context);
}
TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedRPC) {
- testing::StrictMock<security_manager_test::SSLContextMock> mock_ssl_context;
+ testing::StrictMock<security_manager_test::MockSSLContext> mock_ssl_context;
AddTestDeviceConnection();
AddTestSession();
EXPECT_EQ(
@@ -1010,7 +1327,7 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedRPC) {
&mock_ssl_context);
}
TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedBulk) {
- testing::StrictMock<security_manager_test::SSLContextMock> mock_ssl_context;
+ testing::StrictMock<security_manager_test::MockSSLContext> mock_ssl_context;
AddTestDeviceConnection();
AddTestSession();
EXPECT_EQ(
@@ -1038,6 +1355,17 @@ TEST_F(ConnectionHandlerTest, GetSSLContext_ByDealyProtectedBulk) {
}
#endif // ENABLE_SECURITY
-} // namespace connection_handle_test
+TEST_F(ConnectionHandlerTest, SendHeartBeat) {
+ // Add virtual device and connection
+ AddTestDeviceConnection();
+ AddTestSession();
+ protocol_handler_test::ProtocolHandlerMock mock_protocol_handler;
+ connection_handler_->set_protocol_handler(&mock_protocol_handler);
+
+ EXPECT_CALL(mock_protocol_handler,SendHeartBeat(uid_,start_session_id_) );
+ connection_handler_->SendHeartBeat(uid_, start_session_id_);
+}
+
+} // namespace connection_handler_test
} // namespace components
} // namespace test
diff --git a/src/components/connection_handler/test/connection_test.cc b/src/components/connection_handler/test/connection_test.cc
index a1e9307ce3..ca54980bb8 100644
--- a/src/components/connection_handler/test/connection_test.cc
+++ b/src/components/connection_handler/test/connection_test.cc
@@ -30,14 +30,18 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
#include <algorithm>
+
+#include "gtest/gtest.h"
+
#include "protocol/common.h"
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler_impl.h"
#include "protocol/service_type.h"
-#include "utils/shared_ptr.h"
-#include "security_manager_mock.h"
+#include "connection_handler/mock_connection_handler_settings.h"
+#include "transport_manager/transport_manager_mock.h"
+#include "security_manager/mock_security_manager.h"
+#include "security_manager/mock_ssl_context.h"
#define EXPECT_RETURN_TRUE true
#define EXPECT_RETURN_FALSE false
@@ -46,24 +50,27 @@
namespace test {
namespace components {
-namespace connection_handle {
+namespace connection_handler_test {
using namespace ::connection_handler;
using namespace ::protocol_handler;
class ConnectionTest : public ::testing::Test {
protected:
void SetUp() OVERRIDE {
- connection_handler_ = ConnectionHandlerImpl::instance();
+ connection_handler_ = new ConnectionHandlerImpl(
+ mock_connection_handler_settings, transport_manager_mock);
const ConnectionHandle connectionHandle = 0;
- const DeviceHandle device_handle = 0;
- connection_.reset(
- new Connection(connectionHandle, device_handle, connection_handler_,
- 10000));
+ const DeviceHandle device_handle = 0u;
+ const uint32_t heart_beat = 10000u;
+ connection_ = new Connection(connectionHandle,
+ device_handle,
+ connection_handler_,
+ heart_beat);
}
void TearDown() OVERRIDE {
- connection_.reset();
- ConnectionHandlerImpl::destroy();
+ delete connection_;
+ delete connection_handler_;
}
void StartSession() {
session_id = connection_->AddNewSession();
@@ -72,17 +79,16 @@ class ConnectionTest : public ::testing::Test {
EXPECT_FALSE(sessionMap.empty());
const ServiceList serviceList = sessionMap.begin()->second.service_list;
EXPECT_FALSE(serviceList.empty());
- const ServiceList::const_iterator it = std::find(serviceList.begin(),
- serviceList.end(),
- protocol_handler::kRpc);
- EXPECT_NE(it, serviceList.end());
+ const ServiceList::const_iterator it =
+ std::find(serviceList.begin(), serviceList.end(), kRpc);
+ const bool found_result = (it != serviceList.end());
+ EXPECT_TRUE(found_result);
}
- void AddNewService(const protocol_handler::ServiceType service_type,
- const bool protection,
+ void AddNewService(const ServiceType service_type, const bool protection,
const bool expect_add_new_service_call_result,
const bool expect_exist_service) {
- const bool result = connection_->AddNewService(session_id, service_type,
- protection);
+ const bool result =
+ connection_->AddNewService(session_id, service_type, protection);
EXPECT_EQ(result, expect_add_new_service_call_result);
#ifdef ENABLE_SECURITY
@@ -107,7 +113,7 @@ class ConnectionTest : public ::testing::Test {
#endif // ENABLE_SECURITY
}
- void RemoveService(const protocol_handler::ServiceType service_type,
+ void RemoveService(const ServiceType service_type,
const bool expect_remove_service_result,
const bool expect_exist_service) {
const bool result = connection_->RemoveService(session_id, service_type);
@@ -115,22 +121,23 @@ class ConnectionTest : public ::testing::Test {
const SessionMap newSessionMap = connection_->session_map();
EXPECT_FALSE(newSessionMap.empty());
- const ServiceList newServiceList = newSessionMap.begin()->second
- .service_list;
+ const ServiceList newServiceList =
+ newSessionMap.begin()->second.service_list;
EXPECT_FALSE(newServiceList.empty());
- const ServiceList::const_iterator it = std::find(newServiceList.begin(),
- newServiceList.end(),
- service_type);
- const bool found_result = it != newServiceList.end();
+ const ServiceList::const_iterator it =
+ std::find(newServiceList.begin(), newServiceList.end(), service_type);
+ const bool found_result = (it != newServiceList.end());
EXPECT_EQ(expect_exist_service, found_result);
}
- ::utils::SharedPtr<Connection> connection_;
+ Connection* connection_;
+ MockConnectionHandlerSettings mock_connection_handler_settings;
+ testing::StrictMock<transport_manager_test::MockTransportManager>
+ transport_manager_mock;
ConnectionHandlerImpl* connection_handler_;
uint32_t session_id;
};
-
TEST_F(ConnectionTest, Session_TryGetProtocolVersionWithoutSession) {
uint8_t protocol_version;
EXPECT_FALSE(connection_->ProtocolVersion(session_id, protocol_version));
@@ -140,14 +147,14 @@ TEST_F(ConnectionTest, Session_GetDefaultProtocolVersion) {
StartSession();
uint8_t protocol_version;
EXPECT_TRUE(connection_->ProtocolVersion(session_id, protocol_version));
- EXPECT_EQ(protocol_version, ::protocol_handler::PROTOCOL_VERSION_2);
+ EXPECT_EQ(static_cast<uint8_t>(PROTOCOL_VERSION_2), protocol_version);
}
TEST_F(ConnectionTest, Session_UpdateProtocolVersion) {
StartSession();
- uint8_t protocol_version = ::protocol_handler::PROTOCOL_VERSION_3;
+ uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_3);
connection_->UpdateProtocolVersionSession(session_id, protocol_version);
EXPECT_TRUE(connection_->ProtocolVersion(session_id, protocol_version));
- EXPECT_EQ(protocol_version, ::protocol_handler::PROTOCOL_VERSION_3);
+ EXPECT_EQ(static_cast<uint8_t>(PROTOCOL_VERSION_3), protocol_version);
}
TEST_F(ConnectionTest, HeartBeat_NotSupported) {
@@ -155,44 +162,66 @@ TEST_F(ConnectionTest, HeartBeat_NotSupported) {
StartSession();
uint8_t protocol_version;
EXPECT_TRUE(connection_->ProtocolVersion(session_id, protocol_version));
- EXPECT_EQ(protocol_version, ::protocol_handler::PROTOCOL_VERSION_2);
+ EXPECT_EQ(static_cast<uint8_t>(PROTOCOL_VERSION_2), protocol_version);
// Assert
EXPECT_FALSE(connection_->SupportHeartBeat(session_id));
}
-TEST_F(ConnectionTest, DISABLED_HeartBeat_Supported) {
+TEST_F(ConnectionTest, HeartBeat_Protocol3_Supported) {
// Arrange
StartSession();
-
- // Check if protocol version is 3
- uint8_t protocol_version = ::protocol_handler::PROTOCOL_VERSION_3;
+ // Check execution if protocol version is 3
+ const uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_3);
connection_->UpdateProtocolVersionSession(session_id, protocol_version);
- EXPECT_EQ(protocol_version, ::protocol_handler::PROTOCOL_VERSION_3);
+ EXPECT_TRUE(connection_->SupportHeartBeat(session_id));
+}
- // Assert
+TEST_F(ConnectionTest, HeartBeat_Protocol4_PositiveHeartBeat_Supported) {
+ // Arrange
+ StartSession();
+ // Check execution if protocol version is 4
+ const uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_4);
+ connection_->UpdateProtocolVersionSession(session_id, protocol_version);
EXPECT_TRUE(connection_->SupportHeartBeat(session_id));
}
+TEST_F(ConnectionTest, HeartBeat_Protocol4_ZeroHeartBeat_NotSupported) {
+ // Correctc of connection (need connection with heartbeat=0)
+ delete connection_;
+ connection_ = 0;
+
+ const ConnectionHandle connectionHandle = 0;
+ const DeviceHandle device_handle = 0u;
+ const uint32_t heart_beat = 0u;
+ connection_ = new Connection(connectionHandle,
+ device_handle,
+ connection_handler_,
+ heart_beat);
+ StartSession();
+ // Check execution if protocol version is 4
+ const uint8_t protocol_version = static_cast<uint8_t>(PROTOCOL_VERSION_4);
+ connection_->UpdateProtocolVersionSession(session_id, protocol_version);
+ EXPECT_FALSE(connection_->SupportHeartBeat(session_id));
+}
+
// Try to add service without session
TEST_F(ConnectionTest, Session_AddNewServiceWithoutSession) {
- EXPECT_EQ(
- connection_->AddNewService(session_id, protocol_handler::kAudio, true),
- EXPECT_RETURN_FALSE);
- EXPECT_EQ(
- connection_->AddNewService(session_id, protocol_handler::kAudio, false),
- EXPECT_RETURN_FALSE);
- EXPECT_EQ(
- connection_->AddNewService(session_id, protocol_handler::kMobileNav, true),
- EXPECT_RETURN_FALSE);
- EXPECT_EQ(
- connection_->AddNewService(session_id, protocol_handler::kMobileNav, false),
- EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->AddNewService(session_id, kAudio, true),
+ EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->AddNewService(session_id, kAudio, false),
+ EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->AddNewService(session_id, kMobileNav, true),
+ EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->AddNewService(session_id, kMobileNav, false),
+ EXPECT_RETURN_FALSE);
}
// Try to remove service without session
TEST_F(ConnectionTest, Session_RemoveServiceWithoutSession) {
- EXPECT_EQ(connection_->RemoveService(session_id, protocol_handler::kAudio),
+ EXPECT_EQ(connection_->RemoveService(session_id, kAudio),
+ EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->RemoveService(session_id, kMobileNav),
EXPECT_RETURN_FALSE);
EXPECT_EQ(
connection_->RemoveService(session_id, protocol_handler::kMobileNav),
@@ -201,18 +230,15 @@ TEST_F(ConnectionTest, Session_RemoveServiceWithoutSession) {
// Try to remove RPC
TEST_F(ConnectionTest, Session_RemoveRPCBulk) {
StartSession();
- EXPECT_EQ(connection_->RemoveService(session_id, protocol_handler::kRpc),
- EXPECT_RETURN_FALSE);
- EXPECT_EQ(connection_->RemoveService(session_id, protocol_handler::kBulk),
- EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->RemoveService(session_id, kRpc), EXPECT_RETURN_FALSE);
+ EXPECT_EQ(connection_->RemoveService(session_id, kBulk), EXPECT_RETURN_FALSE);
}
// Control Service could not be started anyway
TEST_F(ConnectionTest, Session_AddControlService) {
StartSession();
-
- AddNewService(protocol_handler::kControl, PROTECTION_OFF, EXPECT_RETURN_FALSE,
+ AddNewService(kControl, PROTECTION_OFF, EXPECT_RETURN_FALSE,
EXPECT_SERVICE_NOT_EXISTS);
- AddNewService(protocol_handler::kControl, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ AddNewService(kControl, PROTECTION_ON, EXPECT_RETURN_FALSE,
EXPECT_SERVICE_NOT_EXISTS);
}
@@ -220,51 +246,47 @@ TEST_F(ConnectionTest, Session_AddControlService) {
TEST_F(ConnectionTest, Session_AddInvalidService) {
StartSession();
- AddNewService(protocol_handler::kInvalidServiceType, PROTECTION_OFF,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_NOT_EXISTS);
- AddNewService(protocol_handler::kInvalidServiceType, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_NOT_EXISTS);
+ AddNewService(kInvalidServiceType, PROTECTION_OFF, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_NOT_EXISTS);
+ AddNewService(kInvalidServiceType, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_NOT_EXISTS);
}
// RPC and Bulk Services could be only delay protected
TEST_F(ConnectionTest, Session_AddRPCBulkServices) {
StartSession();
- AddNewService(protocol_handler::kRpc, PROTECTION_OFF,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kRpc, PROTECTION_OFF, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
// Bulk shall not be added and shall be PROTECTION_OFF
- AddNewService(protocol_handler::kBulk, PROTECTION_OFF,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kBulk, PROTECTION_OFF, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
#ifdef ENABLE_SECURITY
- AddNewService(protocol_handler::kRpc, PROTECTION_ON,
- EXPECT_RETURN_TRUE,
- EXPECT_SERVICE_EXISTS);
+ AddNewService(kRpc, PROTECTION_ON, EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
#else
- AddNewService(protocol_handler::kRpc, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kRpc, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
#endif // ENABLE_SECURITY
// Bulk shall not be added and shall be PROTECTION_ON
- AddNewService(protocol_handler::kBulk, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kBulk, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
}
TEST_F(ConnectionTest, Session_AddAllOtherService_Unprotected) {
StartSession();
-
- AddNewService(protocol_handler::kAudio, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
- AddNewService(protocol_handler::kMobileNav, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
}
TEST_F(ConnectionTest, Session_AddAllOtherService_Protected) {
StartSession();
-
- AddNewService(protocol_handler::kAudio, PROTECTION_ON,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
- AddNewService(protocol_handler::kMobileNav, PROTECTION_ON,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
}
TEST_F(ConnectionTest, FindAddedService) {
@@ -272,82 +294,79 @@ TEST_F(ConnectionTest, FindAddedService) {
// Arrange
SessionMap currentSessionMap = connection_->session_map();
- Service * sessionWithService = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kAudio);
+ Service* sessionWithService =
+ currentSessionMap.find(session_id)->second.FindService(kAudio);
EXPECT_EQ(NULL, sessionWithService);
// Act
- AddNewService(protocol_handler::kAudio, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
currentSessionMap = connection_->session_map();
// Expect that service is existing
- sessionWithService = currentSessionMap.find(session_id)->second.FindService(
- protocol_handler::kAudio);
+ sessionWithService =
+ currentSessionMap.find(session_id)->second.FindService(kAudio);
EXPECT_TRUE(sessionWithService != NULL);
}
TEST_F(ConnectionTest, Session_RemoveAddedService) {
StartSession();
- AddNewService(protocol_handler::kAudio, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
- EXPECT_EQ(connection_->RemoveService(session_id, protocol_handler::kAudio),
- EXPECT_RETURN_TRUE);
+ EXPECT_EQ(connection_->RemoveService(session_id, kAudio), EXPECT_RETURN_TRUE);
// Try delete nonexisting service
- EXPECT_EQ(connection_->RemoveService(session_id, protocol_handler::kAudio),
+ EXPECT_EQ(connection_->RemoveService(session_id, kAudio),
EXPECT_RETURN_FALSE);
}
TEST_F(ConnectionTest, Session_AddAllOtherService_DelayProtected1) {
StartSession();
- AddNewService(protocol_handler::kAudio, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
- AddNewService(protocol_handler::kMobileNav, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
#ifdef ENABLE_SECURITY
- AddNewService(protocol_handler::kAudio, PROTECTION_ON,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
- AddNewService(protocol_handler::kMobileNav, PROTECTION_ON,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
#else
- AddNewService(protocol_handler::kAudio, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
- AddNewService(protocol_handler::kMobileNav, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
#endif // ENABLE_SECURITY
}
// Use other order
TEST_F(ConnectionTest, Session_AddAllOtherService_DelayProtected2) {
StartSession();
-
- AddNewService(protocol_handler::kAudio, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
#ifdef ENABLE_SECURITY
- AddNewService(protocol_handler::kAudio, PROTECTION_ON,
- EXPECT_RETURN_TRUE,
- EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
#else
- AddNewService(protocol_handler::kAudio, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kAudio, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
#endif // ENABLE_SECURITY
- AddNewService(protocol_handler::kMobileNav, PROTECTION_OFF,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_OFF, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
#ifdef ENABLE_SECURITY
- AddNewService(protocol_handler::kMobileNav, PROTECTION_ON,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
#else
- AddNewService(protocol_handler::kMobileNav, PROTECTION_ON,
- EXPECT_RETURN_FALSE, EXPECT_SERVICE_EXISTS);
+ AddNewService(kMobileNav, PROTECTION_ON, EXPECT_RETURN_FALSE,
+ EXPECT_SERVICE_EXISTS);
#endif // ENABLE_SECURITY
}
@@ -360,86 +379,84 @@ TEST_F(ConnectionTest, RemoveSession) {
#ifdef ENABLE_SECURITY
TEST_F(ConnectionTest, SetSSLContextWithoutSession) {
- //random value. Session was not started
+ // random value. Session was not started
uint8_t session_id = 10;
- security_manager_test::SSLContextMock mock_ssl_context;
+ security_manager_test::MockSSLContext mock_ssl_context;
int setResult = connection_->SetSSLContext(session_id, &mock_ssl_context);
- EXPECT_EQ(security_manager::SecurityManager::ERROR_INTERNAL,setResult);
+ EXPECT_EQ(security_manager::SecurityManager::ERROR_INTERNAL, setResult);
}
TEST_F(ConnectionTest, GetSSLContextWithoutSession) {
- //random value. Session was not started
+ // random value. Session was not started
uint8_t session_id = 10;
- EXPECT_EQ(NULL,connection_->GetSSLContext(session_id,protocol_handler::kMobileNav));
+ EXPECT_EQ(NULL, connection_->GetSSLContext(session_id, kMobileNav));
}
TEST_F(ConnectionTest, SetGetSSLContext) {
StartSession();
- EXPECT_EQ(NULL,connection_->GetSSLContext(session_id,protocol_handler::kMobileNav));
- AddNewService(protocol_handler::kMobileNav, PROTECTION_ON,
- EXPECT_RETURN_TRUE, EXPECT_SERVICE_EXISTS);
+ EXPECT_EQ(NULL, connection_->GetSSLContext(session_id, kMobileNav));
+ AddNewService(kMobileNav, PROTECTION_ON, EXPECT_RETURN_TRUE,
+ EXPECT_SERVICE_EXISTS);
- EXPECT_EQ(NULL,connection_->GetSSLContext(session_id,protocol_handler::kMobileNav));
+ EXPECT_EQ(NULL, connection_->GetSSLContext(session_id, kMobileNav));
- security_manager_test::SSLContextMock mock_ssl_context;
- //Set SSLContext
+ security_manager_test::MockSSLContext mock_ssl_context;
+ // Set SSLContext
int setResult = connection_->SetSSLContext(session_id, &mock_ssl_context);
- EXPECT_EQ(security_manager::SecurityManager::ERROR_SUCCESS,setResult);
+ EXPECT_EQ(security_manager::SecurityManager::ERROR_SUCCESS, setResult);
- security_manager::SSLContext *result = connection_->GetSSLContext(session_id,protocol_handler::kMobileNav);
- EXPECT_EQ(result,&mock_ssl_context);
+ security_manager::SSLContext* result =
+ connection_->GetSSLContext(session_id, kMobileNav);
+ EXPECT_EQ(result, &mock_ssl_context);
}
TEST_F(ConnectionTest, SetProtectionFlagForRPC) {
StartSession();
// Arrange
SessionMap currentSessionMap = connection_->session_map();
- Service * service_rpc = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kRpc);
+ Service* service_rpc =
+ currentSessionMap.find(session_id)->second.FindService(kRpc);
EXPECT_FALSE(service_rpc->is_protected_);
- Service * service_bulk = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kBulk);
+ Service* service_bulk =
+ currentSessionMap.find(session_id)->second.FindService(kBulk);
EXPECT_FALSE(service_bulk->is_protected_);
// Expect that service protection is enabled
- connection_->SetProtectionFlag(session_id, protocol_handler::kRpc);
+ connection_->SetProtectionFlag(session_id, kRpc);
currentSessionMap = connection_->session_map();
- service_bulk = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kBulk);
+ service_bulk = currentSessionMap.find(session_id)->second.FindService(kBulk);
EXPECT_TRUE(service_bulk->is_protected_);
- service_rpc = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kRpc);
+ service_rpc = currentSessionMap.find(session_id)->second.FindService(kRpc);
EXPECT_TRUE(service_rpc->is_protected_);
}
-
TEST_F(ConnectionTest, SetProtectionFlagForBulk) {
StartSession();
// Arrange
SessionMap currentSessionMap = connection_->session_map();
- Service * service_rpc = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kRpc);
+ Service* service_rpc =
+ currentSessionMap.find(session_id)->second.FindService(kRpc);
EXPECT_FALSE(service_rpc->is_protected_);
- Service * service_bulk = currentSessionMap.find(session_id)->second
- .FindService(protocol_handler::kBulk);
+ Service* service_bulk =
+ currentSessionMap.find(session_id)->second.FindService(kBulk);
EXPECT_FALSE(service_bulk->is_protected_);
// Expect that service protection is enabled
- connection_->SetProtectionFlag(session_id, protocol_handler::kBulk);
+ connection_->SetProtectionFlag(session_id, kBulk);
currentSessionMap = connection_->session_map();
- service_bulk = currentSessionMap.find(session_id)->second.FindService(protocol_handler::kBulk);
+ service_bulk = currentSessionMap.find(session_id)->second.FindService(kBulk);
EXPECT_TRUE(service_bulk->is_protected_);
- service_rpc = currentSessionMap.find(session_id)->second.FindService(protocol_handler::kRpc);
+ service_rpc = currentSessionMap.find(session_id)->second.FindService(kRpc);
EXPECT_TRUE(service_rpc->is_protected_);
}
@@ -448,4 +465,3 @@ TEST_F(ConnectionTest, SetProtectionFlagForBulk) {
} // namespace connection_handle
} // namespace components
} // namespace test
-
diff --git a/src/components/connection_handler/test/heart_beat_monitor_test.cc b/src/components/connection_handler/test/heart_beat_monitor_test.cc
index 710977c643..e442a144bf 100644
--- a/src/components/connection_handler/test/heart_beat_monitor_test.cc
+++ b/src/components/connection_handler/test/heart_beat_monitor_test.cc
@@ -32,12 +32,11 @@
#include <string>
#include <iostream>
-//#include <stdio.h>
-#include "gmock/gmock.h"
+#include "gtest/gtest.h"
#include "connection_handler/heartbeat_monitor.h"
#include "connection_handler/connection.h"
#include "connection_handler/connection_handler.h"
-#include "config_profile/profile.h"
+#include "connection_handler/mock_connection_handler.h"
namespace {
const int32_t MILLISECONDS_IN_SECOND = 1000;
@@ -50,91 +49,37 @@ namespace components {
namespace connection_handler_test {
using ::testing::_;
-class ConnectionHandlerMock : public connection_handler::ConnectionHandler {
+class HeartBeatMonitorTest : public testing::Test {
public:
- MOCK_METHOD1(set_connection_handler_observer,
- void(connection_handler::ConnectionHandlerObserver*));
- MOCK_METHOD1(set_transport_manager,
- void(transport_manager::TransportManager*));
- MOCK_METHOD0(StartTransportManager,
- void());
- MOCK_METHOD1(ConnectToDevice,
- void(connection_handler::DeviceHandle device_handle));
- MOCK_METHOD0(ConnectToAllDevices,
- void());
- MOCK_METHOD1(CloseRevokedConnection, void(uint32_t connection_key));
- MOCK_METHOD1(CloseConnection,
- void(connection_handler::ConnectionHandle connection_handle));
- MOCK_METHOD1(GetConnectionSessionsCount, uint32_t(uint32_t connection_key));
- MOCK_METHOD2(GetDeviceID,
- bool(const std::string& mac_address,
- connection_handler::DeviceHandle* device_handle));
- MOCK_CONST_METHOD1(GetConnectedDevicesMAC, void(std::vector<std::string> &device_macs));
- MOCK_METHOD2(CloseSession,
- void(uint32_t key,
- connection_handler::CloseSessionReason close_reason));
- MOCK_METHOD3(CloseSession,
- void(connection_handler::ConnectionHandle connection_handle,
- uint8_t session_id,
- connection_handler::CloseSessionReason close_reason));
- MOCK_METHOD2(SendEndService,
- void(uint32_t key, uint8_t service_type));
-
- MOCK_METHOD1(StartSessionHeartBeat,
- void(uint32_t key));
- MOCK_METHOD2(SendHeartBeat,
- void(connection_handler::ConnectionHandle connection_handle,
- uint8_t session_id));
- MOCK_METHOD2(SetHeartBeatTimeout, void(uint32_t connection_key,
- uint32_t timeout));
- MOCK_METHOD2(BindProtocolVersionWithSession,
- void(uint32_t connection_key,
- uint8_t protocol_version));
- MOCK_METHOD4(GetDataOnSessionKey,
- int32_t(uint32_t key, uint32_t* app_id,
- std::list<int32_t>* sessions_list,
- uint32_t* device_id));
-};
+ HeartBeatMonitorTest() : conn(NULL) {
+ kTimeout = 5000u;
+ }
-class HeartBeatMonitorTest : public testing::Test {
-public:
- HeartBeatMonitorTest():
- conn(NULL) {
- profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
- kTimeout = profile::Profile::instance()->heart_beat_timeout();
- }
-
-protected:
- testing::NiceMock<ConnectionHandlerMock> connection_handler_mock;
+ protected:
+ testing::NiceMock<MockConnectionHandler> connection_handler_mock;
connection_handler::Connection* conn;
uint32_t kTimeout;
- static const connection_handler::ConnectionHandle kConnectionHandle = 0xABCDEF;
+ static const connection_handler::ConnectionHandle kConnectionHandle =
+ 0xABCDEF;
virtual void SetUp() {
- conn = new connection_handler::Connection(kConnectionHandle, 0,
- &connection_handler_mock,
- kTimeout);
- }
-
- virtual void TearDown() {
- delete conn;
+ conn = new connection_handler::Connection(
+ kConnectionHandle, 0, &connection_handler_mock, kTimeout);
}
+ virtual void TearDown() { delete conn; }
};
-ACTION_P2(RemoveSession, conn, session_id){
- conn->RemoveSession(session_id);
-}
+ACTION_P2(RemoveSession, conn, session_id) { conn->RemoveSession(session_id); }
TEST_F(HeartBeatMonitorTest, TimerNotStarted) {
-
- // Whithout StartHeartBeat nothing to be call
+ // Whithout StartHeartBeat nothing to be call
EXPECT_CALL(connection_handler_mock, CloseSession(_, _)).Times(0);
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
conn->AddNewSession();
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, TimerNotElapsed) {
@@ -144,19 +89,19 @@ TEST_F(HeartBeatMonitorTest, TimerNotElapsed) {
const uint32_t session = conn->AddNewSession();
conn->StartHeartBeat(session);
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout * MICROSECONDS_IN_MILLISECONDS - MICROSECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, TimerElapsed) {
const uint32_t session = conn->AddNewSession();
- EXPECT_CALL(connection_handler_mock, CloseSession(_, session,_))
- .WillOnce(RemoveSession(conn, session));
+ EXPECT_CALL(connection_handler_mock, CloseSession(_, session, _))
+ .WillOnce(RemoveSession(conn, session));
EXPECT_CALL(connection_handler_mock, CloseConnection(_));
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, session));
conn->StartHeartBeat(session);
- usleep(2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, KeptAlive) {
@@ -179,8 +124,8 @@ TEST_F(HeartBeatMonitorTest, NotKeptAlive) {
const uint32_t session = conn->AddNewSession();
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, session));
- EXPECT_CALL(connection_handler_mock, CloseSession(_, session,_))
- .WillOnce(RemoveSession(conn, session));
+ EXPECT_CALL(connection_handler_mock, CloseSession(_, session, _))
+ .WillOnce(RemoveSession(conn, session));
EXPECT_CALL(connection_handler_mock, CloseConnection(_));
conn->StartHeartBeat(session);
@@ -197,17 +142,17 @@ TEST_F(HeartBeatMonitorTest, TwoSessionsElapsed) {
const uint32_t kSession1 = conn->AddNewSession();
const uint32_t kSession2 = conn->AddNewSession();
- EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession1,_))
- .WillOnce(RemoveSession(conn, kSession1));
- EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession2,_))
- .WillOnce(RemoveSession(conn, kSession2));
+ EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession1, _))
+ .WillOnce(RemoveSession(conn, kSession1));
+ EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession2, _))
+ .WillOnce(RemoveSession(conn, kSession2));
EXPECT_CALL(connection_handler_mock, CloseConnection(_));
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession1));
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession2));
conn->StartHeartBeat(kSession1);
conn->StartHeartBeat(kSession2);
- usleep(2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
+ testing::Mock::AsyncVerifyAndClearExpectations(2 * kTimeout * MICROSECONDS_IN_MILLISECONDS + MICROSECONDS_IN_SECOND);
}
TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
@@ -217,19 +162,18 @@ TEST_F(HeartBeatMonitorTest, IncreaseHeartBeatTimeout) {
EXPECT_CALL(connection_handler_mock, CloseConnection(_)).Times(0);
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, _)).Times(0);
-
const uint32_t kNewTimeout = kTimeout + MICROSECONDS_IN_MILLISECONDS;
conn->StartHeartBeat(kSession);
conn->SetHeartBeatTimeout(kNewTimeout, kSession);
// new timeout greater by old timeout so mock object shouldn't be invoked
- usleep(kTimeout * MICROSECONDS_IN_MILLISECONDS);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout * MICROSECONDS_IN_MILLISECONDS);
}
TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
const uint32_t kSession = conn->AddNewSession();
- EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession,_))
- .WillOnce(RemoveSession(conn, kSession));
+ EXPECT_CALL(connection_handler_mock, CloseSession(_, kSession, _))
+ .WillOnce(RemoveSession(conn, kSession));
EXPECT_CALL(connection_handler_mock, CloseConnection(_));
EXPECT_CALL(connection_handler_mock, SendHeartBeat(_, kSession));
@@ -237,9 +181,9 @@ TEST_F(HeartBeatMonitorTest, DecreaseHeartBeatTimeout) {
conn->StartHeartBeat(kSession);
conn->SetHeartBeatTimeout(kNewTimeout, kSession);
// new timeout less than old timeout so mock object should be invoked
- usleep(kTimeout * 2 * MICROSECONDS_IN_MILLISECONDS);
+ testing::Mock::AsyncVerifyAndClearExpectations(kTimeout * 2 * MICROSECONDS_IN_MILLISECONDS);
}
-} // namespace connection_handler_test
-} // namespace components
-} // namespace test
+} // namespace connection_handler_test
+} // namespace components
+} // namespace test
diff --git a/src/components/dbus/src/dbus_adapter.cc b/src/components/dbus/src/dbus_adapter.cc
index 5f38e3d80f..4f0cb74527 100644
--- a/src/components/dbus/src/dbus_adapter.cc
+++ b/src/components/dbus/src/dbus_adapter.cc
@@ -348,7 +348,7 @@ bool DBusAdapter::ProcessMethodCall(DBusMessage* msg,
bool DBusAdapter::ProcessMethodReturn(DBusMessage* msg,
smart_objects::SmartObject& obj) {
- LOG4CXX_INFO(logger_, "ProcessMethodReturn");
+ LOG4CXX_AUTO_TRACE(logger_);
dbus_uint32_t reply_serial = dbus_message_get_reply_serial(msg);
std::pair<uint, MessageId> ids = GetRequestToHMI(reply_serial);
if (ids.second == hmi_apis::FunctionID::INVALID_ENUM) {
@@ -675,7 +675,7 @@ bool DBusAdapter::GetHeader(DBusMessageIter* iter, int* code,
bool DBusAdapter::GetArguments(DBusMessageIter* iter, const ListArgs& rules,
smart_objects::SmartObject& args) {
- LOG4CXX_TRACE(logger_, "GetArguments");
+ LOG4CXX_AUTO_TRACE(logger_);
size_t size = rules.size();
for (size_t i = 0; i < size; ++i) {
diff --git a/src/components/formatters/CMakeLists.txt b/src/components/formatters/CMakeLists.txt
index 3dd7dc9366..1858342ff3 100644
--- a/src/components/formatters/CMakeLists.txt
+++ b/src/components/formatters/CMakeLists.txt
@@ -38,16 +38,17 @@ include_directories (
${JSONCPP_INCLUDE_DIRECTORY}
${MESSAGE_BROKER_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/smart_objects/include
+ ${COMPONENTS_DIR}/utils/include
)
set (SOURCES
- ${FORMATTERS_SRC_DIR}/CSmartFactory.cpp
+ ${FORMATTERS_SRC_DIR}/CSmartFactory.cc
)
set (FORMATTER_SOURCES
- ${FORMATTERS_SRC_DIR}/CFormatterJsonBase.cpp
- ${FORMATTERS_SRC_DIR}/CFormatterJsonSDLRPCv1.cpp
- ${FORMATTERS_SRC_DIR}/CFormatterJsonSDLRPCv2.cpp
+ ${FORMATTERS_SRC_DIR}/CFormatterJsonBase.cc
+ ${FORMATTERS_SRC_DIR}/CFormatterJsonSDLRPCv1.cc
+ ${FORMATTERS_SRC_DIR}/CFormatterJsonSDLRPCv2.cc
${FORMATTERS_SRC_DIR}/formatter_json_rpc.cc
${FORMATTERS_SRC_DIR}/meta_formatter.cc
${FORMATTERS_SRC_DIR}/generic_json_formatter.cc
diff --git a/src/components/formatters/include/formatters/CFormatterJsonBase.hpp b/src/components/formatters/include/formatters/CFormatterJsonBase.h
index ef57d9b1b9..ef57d9b1b9 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonBase.hpp
+++ b/src/components/formatters/include/formatters/CFormatterJsonBase.h
diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.hpp b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
index 03454395b0..99f0a265e3 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.hpp
+++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv1.h
@@ -35,9 +35,9 @@
#include "smart_objects/smart_object.h"
#include "smart_objects/enum_schema_item.h"
-#include "CFormatterJsonBase.hpp"
+#include "CFormatterJsonBase.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
#include "formatters/meta_formatter.h"
namespace NsSmartDeviceLink {
diff --git a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.hpp b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
index 3b4e206515..2d62fe2fcb 100644
--- a/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.hpp
+++ b/src/components/formatters/include/formatters/CFormatterJsonSDLRPCv2.h
@@ -35,8 +35,8 @@
#include "smart_objects/smart_object.h"
-#include "CFormatterJsonBase.hpp"
-#include "formatters/CSmartFactory.hpp"
+#include "CFormatterJsonBase.h"
+#include "formatters/CSmartFactory.h"
namespace NsSmartDeviceLink {
namespace NsJSONHandler {
diff --git a/src/components/formatters/include/formatters/CSmartFactory.hpp b/src/components/formatters/include/formatters/CSmartFactory.h
index 55f9a30385..55f9a30385 100644
--- a/src/components/formatters/include/formatters/CSmartFactory.hpp
+++ b/src/components/formatters/include/formatters/CSmartFactory.h
diff --git a/src/components/formatters/include/formatters/formatter_json_rpc.h b/src/components/formatters/include/formatters/formatter_json_rpc.h
index d4653ef565..b51f21a573 100644
--- a/src/components/formatters/include/formatters/formatter_json_rpc.h
+++ b/src/components/formatters/include/formatters/formatter_json_rpc.h
@@ -42,8 +42,8 @@
#include "smart_objects/enum_schema_item.h"
#include "json/json.h"
-#include "CFormatterJsonBase.hpp"
-#include "formatters/CSmartFactory.hpp"
+#include "CFormatterJsonBase.h"
+#include "formatters/CSmartFactory.h"
namespace NsSmartDeviceLink {
namespace NsJSONHandler {
diff --git a/src/components/formatters/include/formatters/generic_json_formatter.h b/src/components/formatters/include/formatters/generic_json_formatter.h
index a4b3f3f712..e99f8b2f2f 100644
--- a/src/components/formatters/include/formatters/generic_json_formatter.h
+++ b/src/components/formatters/include/formatters/generic_json_formatter.h
@@ -35,7 +35,7 @@
#ifndef SMARTDEVICELINK_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_GENERIC_JSON_FORMATTER_H_
#define SMARTDEVICELINK_COMPONENTS_FORMATTERS_INCLUDE_FORMATTERS_GENERIC_JSON_FORMATTER_H_
-#include "CFormatterJsonBase.hpp"
+#include "CFormatterJsonBase.h"
namespace NsSmartDeviceLink {
namespace NsJSONHandler {
diff --git a/src/components/formatters/src/CFormatterJsonBase.cpp b/src/components/formatters/src/CFormatterJsonBase.cc
index 64a60e4f8f..8c2a70f1d4 100644
--- a/src/components/formatters/src/CFormatterJsonBase.cpp
+++ b/src/components/formatters/src/CFormatterJsonBase.cc
@@ -32,8 +32,8 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
#include "json/json.h"
-
-#include "formatters/CFormatterJsonBase.hpp"
+#include "formatters/CFormatterJsonBase.h"
+#include "utils/convert_utils.h"
void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::jsonValueToObj(
const Json::Value& value,
@@ -55,9 +55,10 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::jsonValue
for (uint32_t i = 0; i < value.size(); i++) {
jsonValueToObj(value[i], obj[i]);
}
- } else if (value.type() == Json::intValue
- || value.type() == Json::uintValue) {
- obj = value.asInt();
+ } else if (value.type() == Json::intValue) {
+ obj = utils::ConvertLongLongIntToInt64(value.asInt64());
+ } else if (value.type() == Json::uintValue) {
+ obj = utils::ConvertLongLongUIntToUInt64(value.asUInt64());
} else if (value.type() == Json::realValue) {
obj = value.asDouble();
} else if (value.type() == Json::booleanValue) {
@@ -103,7 +104,10 @@ void NsSmartDeviceLink::NsJSONHandler::Formatters::CFormatterJsonBase::objToJson
item = obj.asBool();
} else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Integer
== obj.getType()) {
- item = obj.asInt();
+ item = utils::ConvertInt64ToLongLongInt(obj.asInt());
+ } else if (NsSmartDeviceLink::NsSmartObjects::SmartType_UInteger
+ == obj.getType()) {
+ item = utils::ConvertUInt64ToLongLongUInt(obj.asUInt());
} else if (NsSmartDeviceLink::NsSmartObjects::SmartType_Double
== obj.getType()) {
item = obj.asDouble();
diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cpp b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
index 407a001883..f490b85ea6 100644
--- a/src/components/formatters/src/CFormatterJsonSDLRPCv1.cpp
+++ b/src/components/formatters/src/CFormatterJsonSDLRPCv1.cc
@@ -1,34 +1,38 @@
-// Copyright (c) 2013, Ford Motor Company
-// All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are met:
-//
-// Redistributions of source code must retain the above copyright notice, this
-// list of conditions and the following disclaimer.
-//
-// Redistributions in binary form must reproduce the above copyright notice,
-// this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided with the
-// distribution.
-//
-// Neither the name of the Ford Motor Company nor the names of its contributors
-// may be used to endorse or promote products derived from this software
-// without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 'A PARTICULAR PURPOSE
-// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
-// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-// POSSIBILITY OF SUCH DAMAGE.
-#include "formatters/CFormatterJsonSDLRPCv1.hpp"
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "formatters/CFormatterJsonSDLRPCv1.h"
#include "formatters/meta_formatter.h"
+#include "utils/convert_utils.h"
namespace strings = NsSmartDeviceLink::NsJSONHandler::strings;
namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects;
@@ -96,8 +100,8 @@ bool CFormatterJsonSDLRPCv1::toString(const smart_objects_ns::SmartObject& obj,
root[type][S_PARAMETERS] = params;
if (formattedObj[strings::S_PARAMS].keyExists(strings::S_CORRELATION_ID)) {
- root[type][S_CORRELATION_ID] =
- formattedObj[strings::S_PARAMS][strings::S_CORRELATION_ID].asInt();
+ root[type][S_CORRELATION_ID] = utils::ConvertInt64ToLongLongInt(
+ formattedObj[strings::S_PARAMS][strings::S_CORRELATION_ID].asInt());
}
root[type][S_NAME] = formattedObj[strings::S_PARAMS][strings::S_FUNCTION_ID]
diff --git a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cpp b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
index d76e28911c..f4bc2f598f 100644
--- a/src/components/formatters/src/CFormatterJsonSDLRPCv2.cpp
+++ b/src/components/formatters/src/CFormatterJsonSDLRPCv2.cc
@@ -28,7 +28,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-#include "formatters/CFormatterJsonSDLRPCv2.hpp"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
#include "formatters/meta_formatter.h"
namespace smart_objects_ns = NsSmartDeviceLink::NsSmartObjects;
diff --git a/src/components/formatters/src/CSmartFactory.cpp b/src/components/formatters/src/CSmartFactory.cc
index 363db7696e..a7b5bfd8d3 100644
--- a/src/components/formatters/src/CSmartFactory.cpp
+++ b/src/components/formatters/src/CSmartFactory.cc
@@ -32,7 +32,7 @@
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_MSG_PARAMS("msg_params");
const std::string NsSmartDeviceLink::NsJSONHandler::strings::S_PARAMS("params");
diff --git a/src/components/formatters/src/formatter_json_rpc.cc b/src/components/formatters/src/formatter_json_rpc.cc
index 012962bbb2..e349ced4d6 100644
--- a/src/components/formatters/src/formatter_json_rpc.cc
+++ b/src/components/formatters/src/formatter_json_rpc.cc
@@ -33,6 +33,7 @@
// POSSIBILITY OF SUCH DAMAGE.
#include "formatters/formatter_json_rpc.h"
+#include "utils/convert_utils.h"
namespace NsSmartDeviceLink {
namespace NsJSONHandler {
@@ -40,23 +41,23 @@ namespace Formatters {
namespace strings = NsJSONHandler::strings;
-const char *FormatterJsonRpc::kRequest = "request";
-const char *FormatterJsonRpc::kResponse = "response";
-const char *FormatterJsonRpc::kNotification = "notification";
-const char *FormatterJsonRpc::kErrorResponse = "error_response";
-const char *FormatterJsonRpc::kJsonRpc = "jsonrpc";
-const char *FormatterJsonRpc::kJsonRpcExpectedValue = "2.0";
-const char *FormatterJsonRpc::kId = "id";
-const char *FormatterJsonRpc::kMethod = "method";
-const char *FormatterJsonRpc::kParams = "params";
-const char *FormatterJsonRpc::kResult = "result";
-const char *FormatterJsonRpc::kError = "error";
-const char *FormatterJsonRpc::kCode = "code";
-const char *FormatterJsonRpc::kData = "data";
-const char *FormatterJsonRpc::kMessage = "message";
-
-bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject &obj,
- std::string &out_str) {
+const char* FormatterJsonRpc::kRequest = "request";
+const char* FormatterJsonRpc::kResponse = "response";
+const char* FormatterJsonRpc::kNotification = "notification";
+const char* FormatterJsonRpc::kErrorResponse = "error_response";
+const char* FormatterJsonRpc::kJsonRpc = "jsonrpc";
+const char* FormatterJsonRpc::kJsonRpcExpectedValue = "2.0";
+const char* FormatterJsonRpc::kId = "id";
+const char* FormatterJsonRpc::kMethod = "method";
+const char* FormatterJsonRpc::kParams = "params";
+const char* FormatterJsonRpc::kResult = "result";
+const char* FormatterJsonRpc::kError = "error";
+const char* FormatterJsonRpc::kCode = "code";
+const char* FormatterJsonRpc::kData = "data";
+const char* FormatterJsonRpc::kMessage = "message";
+
+bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject& obj,
+ std::string& out_str) {
bool result = true;
try {
Json::Value root(Json::objectValue);
@@ -70,8 +71,8 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject &obj,
bool is_message_params = formatted_object.keyExists(strings::S_MSG_PARAMS);
bool empty_message_params = true;
if (true == is_message_params) {
- const NsSmartObjects::SmartObject &msg_params = formatted_object
- .getElement(strings::S_MSG_PARAMS);
+ const NsSmartObjects::SmartObject& msg_params =
+ formatted_object.getElement(strings::S_MSG_PARAMS);
result = (NsSmartObjects::SmartType_Map == msg_params.getType());
if (true == result) {
@@ -85,13 +86,13 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject &obj,
if (false == formatted_object.keyExists(strings::S_PARAMS)) {
result = false;
} else {
- const NsSmartObjects::SmartObject &params = formatted_object.getElement(
- strings::S_PARAMS);
+ const NsSmartObjects::SmartObject& params =
+ formatted_object.getElement(strings::S_PARAMS);
if (NsSmartObjects::SmartType_Map != params.getType()) {
result = false;
} else {
- const NsSmartObjects::SmartObject &message_type_object = params
- .getElement(strings::S_MESSAGE_TYPE);
+ const NsSmartObjects::SmartObject& message_type_object =
+ params.getElement(strings::S_MESSAGE_TYPE);
if (NsSmartObjects::SmartType_String != message_type_object.getType()) {
result = false;
@@ -112,13 +113,14 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject &obj,
if (false == params.keyExists(strings::kCode)) {
result = false;
} else {
- const NsSmartObjects::SmartObject &code = params.getElement(
- strings::kCode);
+ const NsSmartObjects::SmartObject& code =
+ params.getElement(strings::kCode);
if (NsSmartObjects::SmartType_Integer != code.getType()) {
result = false;
} else {
- root[kResult][kCode] = code.asInt();
+ root[kResult][kCode] =
+ utils::ConvertInt64ToLongLongInt(code.asInt());
}
}
} else if (kNotification == message_type) {
@@ -129,12 +131,13 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject &obj,
result = result && SetMethod(params, root[kError][kData]);
result = result && SetMessage(params, root[kError]);
- const NsSmartObjects::SmartObject &code = params.getElement(
- strings::kCode);
+ const NsSmartObjects::SmartObject& code =
+ params.getElement(strings::kCode);
if (NsSmartObjects::SmartType_Integer != code.getType()) {
result = false;
} else {
- root[kError][kCode] = code.asInt();
+ root[kError][kCode] =
+ utils::ConvertInt64ToLongLongInt(code.asInt());
}
}
}
@@ -148,12 +151,12 @@ bool FormatterJsonRpc::ToString(const NsSmartObjects::SmartObject &obj,
return result;
}
-bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject &params,
- Json::Value &method_container) {
+bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject& params,
+ Json::Value& method_container) {
bool result = false;
if (true == params.keyExists(strings::S_FUNCTION_ID)) {
- const NsSmartObjects::SmartObject &function_id =
+ const NsSmartObjects::SmartObject& function_id =
params.getElement(strings::S_FUNCTION_ID);
if (NsSmartObjects::SmartType_String == function_id.getType()) {
@@ -165,16 +168,16 @@ bool FormatterJsonRpc::SetMethod(const NsSmartObjects::SmartObject &params,
return result;
}
-bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject &params,
- Json::Value &id_container) {
+bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject& params,
+ Json::Value& id_container) {
bool result = false;
if (true == params.keyExists(strings::S_CORRELATION_ID)) {
- const NsSmartObjects::SmartObject &id = params.getElement(
- strings::S_CORRELATION_ID);
+ const NsSmartObjects::SmartObject& id =
+ params.getElement(strings::S_CORRELATION_ID);
if (NsSmartObjects::SmartType_Integer == id.getType()) {
- id_container[kId] = id.asUInt();
+ id_container[kId] = utils::ConvertUInt64ToLongLongUInt(id.asUInt());
result = true;
}
}
@@ -182,16 +185,16 @@ bool FormatterJsonRpc::SetId(const NsSmartObjects::SmartObject &params,
return result;
}
-bool FormatterJsonRpc::SetMessage(const NsSmartObjects::SmartObject &params,
- Json::Value &message_container) {
+bool FormatterJsonRpc::SetMessage(const NsSmartObjects::SmartObject& params,
+ Json::Value& message_container) {
bool result = false;
if (true == params.keyExists(strings::kMessage)) {
- const NsSmartObjects::SmartObject &message = params.getElement(
- strings::kMessage);
+ const NsSmartObjects::SmartObject& message =
+ params.getElement(strings::kMessage);
if (NsSmartObjects::SmartType_String == message.getType()) {
- message_container[kMessage] = message.asString();
+ message_container[kMessage] = message.asString();
result = true;
}
}
diff --git a/src/components/formatters/test/CFormatterJsonBase_test.cc b/src/components/formatters/test/CFormatterJsonBase_test.cc
index 9efbfdcf77..366c305e0b 100644
--- a/src/components/formatters/test/CFormatterJsonBase_test.cc
+++ b/src/components/formatters/test/CFormatterJsonBase_test.cc
@@ -35,7 +35,7 @@
#include "json/value.h"
#include "gtest/gtest.h"
#include "json/reader.h"
-#include "formatters/CFormatterJsonBase.hpp"
+#include "formatters/CFormatterJsonBase.h"
#include "formatters/generic_json_formatter.h"
namespace test {
@@ -100,7 +100,7 @@ TEST(CFormatterJsonBaseTest, JSonSignedMaxIntValueToSmartObj_ExpectSuccessful) {
EXPECT_EQ(ival, object.asInt());
}
-TEST(CFormatterJsonBaseTest, DISABLED_JSonUnsignedMaxIntValueToSmartObj_ExpectSuccessful) {
+TEST(CFormatterJsonBaseTest, JSonUnsignedMaxIntValueToSmartObj_ExpectSuccessful) {
// Arrange value
Json::UInt ui_val = Json::Value::maxUInt;
Json::Value json_value(ui_val); // Json value from maximum possible unsigned int
@@ -111,15 +111,26 @@ TEST(CFormatterJsonBaseTest, DISABLED_JSonUnsignedMaxIntValueToSmartObj_ExpectSu
EXPECT_EQ(ui_val, object.asUInt());
}
-TEST(CFormatterJsonBaseTest, JSonSignedMaxInt64ValueToSmartObj_ExpectFailed) {
+TEST(CFormatterJsonBaseTest, JSonSignedMaxInt64ValueToSmartObj_ExpectSuccess) {
// Arrange value
Json::Int64 ival = Json::Value::maxInt64;
Json::Value json_value(ival); // Json value from maximum possible signed int
SmartObject object;
// Convert json to smart object
CFormatterJsonBase::jsonValueToObj(json_value, object);
+ // Check conversion was successful
+ EXPECT_EQ(ival, object.asInt());
+}
+
+TEST(CFormatterJsonBaseTest, JSonUnsignedMaxInt64ValueToSmartObj_ExpectFailed) {
+ // Arrange value
+ Json::UInt64 ival = Json::Value::maxUInt64;
+ Json::Value json_value(ival); // Json value from max possible unsigned int
+ SmartObject object;
+ // Convert json to smart object
+ CFormatterJsonBase::jsonValueToObj(json_value, object);
// Check conversion was not successful as there is no such conversion
- EXPECT_EQ(invalid_int64_value, object.asInt64());
+ EXPECT_EQ(invalid_int64_value, object.asInt());
}
TEST(CFormatterJsonBaseTest, JSonBoolValueToSmartObj_ExpectSuccessful) {
@@ -169,11 +180,14 @@ TEST(CFormatterJsonBaseTest, JSonArrayValueToSmartObj_ExpectSuccessful) {
TEST(CFormatterJsonBaseTest, JSonObjectValueToSmartObj_ExpectSuccessful) {
// Arrange value
const char* json_object =
- "{ \"json_test_object\": [\"test1\", \"test2\", \"test3\"], \"json_test_object2\": [\"test11\", \"test12\", \"test13\" ]}"; // Json object
+ "{ \"json_test_object\": [\"test1\", \"test2\", \"test3\"], "
+ "\"json_test_object2\": [\"test11\", \"test12\", \"test13\" ]}";
Json::Value json_value; // Json value from object. Will be initialized later
SmartObject object;
Json::Reader reader; // Json reader - Needed for correct parsing
- ASSERT_TRUE(reader.parse(json_object, json_value)); // If parsing not successful - no sense to continue
+ ASSERT_TRUE(reader.parse(
+ json_object,
+ json_value)); // If parsing not successful - no sense to continue
CFormatterJsonBase::jsonValueToObj(json_value, object);
// Check conversion was successful
EXPECT_TRUE(json_value.isObject());
@@ -193,7 +207,7 @@ TEST(CFormatterJsonBaseTest, JSonObjectValueToSmartObj_ExpectSuccessful) {
EXPECT_EQ(*it, *it1);
++it1;
}
- ASSERT(it == mems.end() && it1 == keys.end());
+ EXPECT_TRUE(it == mems.end() && it1 == keys.end());
}
TEST(CFormatterJsonBaseTest, StringSmartObjectToJSon_ExpectSuccessful) {
@@ -240,7 +254,7 @@ TEST(CFormatterJsonBaseTest, MinIntSmartObjectToJSon_ExpectSuccessful) {
EXPECT_EQ(ival, json_value.asInt());
}
-TEST(CFormatterJsonBaseTest, DISABLED_UnsignedMaxIntSmartObjectToJSon_ExpectSuccessful) {
+TEST(CFormatterJsonBaseTest, UnsignedMaxIntSmartObjectToJSon_ExpectSuccessful) {
// Arrange value
Json::UInt ui_val = Json::Value::maxUInt;
Json::Value json_value; // Json value from maximum unsigned int
@@ -299,8 +313,10 @@ TEST(CFormatterJsonBaseTest, ArraySmartObjectToJSon_ExpectSuccessful) {
TEST(CFormatterJsonBaseTest, JSonObjectValueToObj_ExpectSuccessful) {
// Arrange value
const char* json_object =
- "{ \"json_test_object\": [\"test1\", \"test2\", \"test3\"], \"json_test_object2\": [\"test11\", \"test12\", \"test13\" ]}"; // Json object
- Json::Value json_value; // Json value from json object. Will be initialized later
+ "{ \"json_test_object\": [\"test1\", \"test2\", \"test3\"], "
+ "\"json_test_object2\": [\"test11\", \"test12\", \"test13\" ]}";
+ Json::Value
+ json_value; // Json value from json object. Will be initialized later
Json::Value result; // Json value from Smart object. Will keep conversion result
SmartObject object;
Json::Reader reader; // Json reader - Needed for correct parsing
@@ -329,7 +345,7 @@ TEST(CFormatterJsonBaseTest, JSonObjectValueToObj_ExpectSuccessful) {
EXPECT_EQ(*it, *it1);
++it1;
}
- ASSERT(it == mems.end() && it1 == keys.end());
+ EXPECT_TRUE(it == mems.end() && it1 == keys.end());
}
} // namespace formatters
diff --git a/src/components/formatters/test/CSmartFactory_test.cc b/src/components/formatters/test/CSmartFactory_test.cc
index 41a77f1f1e..745b960533 100644
--- a/src/components/formatters/test/CSmartFactory_test.cc
+++ b/src/components/formatters/test/CSmartFactory_test.cc
@@ -31,7 +31,7 @@
*/
#include "SmartFactoryTestHelper.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
#include "gtest/gtest.h"
namespace test {
diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc
index 55b7f886fd..27c41f717b 100644
--- a/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc
+++ b/src/components/formatters/test/cFormatterJsonSDLRPCv1_test.cc
@@ -32,7 +32,7 @@
#include "gtest/gtest.h"
-#include "formatters/CFormatterJsonSDLRPCv1.hpp"
+#include "formatters/CFormatterJsonSDLRPCv1.h"
#include "create_smartSchema.h"
namespace test {
diff --git a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
index 814cff4ab7..090d01c82f 100644
--- a/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
+++ b/src/components/formatters/test/cFormatterJsonSDLRPCv2_test.cc
@@ -32,7 +32,7 @@
#include "gtest/gtest.h"
#include "create_smartSchema.h"
-#include "formatters/CFormatterJsonSDLRPCv2.hpp"
+#include "formatters/CFormatterJsonSDLRPCv2.h"
namespace test {
namespace components {
diff --git a/src/components/formatters/test/formatter_json_rpc_test.cc b/src/components/formatters/test/formatter_json_rpc_test.cc
index 9047d6790a..3650fb14d6 100644
--- a/src/components/formatters/test/formatter_json_rpc_test.cc
+++ b/src/components/formatters/test/formatter_json_rpc_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,21 +31,62 @@
*/
#include <algorithm>
+#include "formatters/formatter_json_rpc.h"
+#include <string>
+#include <set>
+#include <algorithm>
+#include <json/writer.h>
#include "gtest/gtest.h"
#include "formatters/formatter_json_rpc.h"
-#include "formatters/CSmartFactory.hpp"
+#include <string>
+#include <set>
+#include "gtest/gtest.h"
+#include "formatters/CSmartFactory.h"
#include "HMI_API_schema.h"
#include "MOBILE_API_schema.h"
namespace test {
namespace components {
-namespace formatters {
+namespace formatters_test {
using namespace NsSmartDeviceLink::NsSmartObjects;
using namespace NsSmartDeviceLink::NsJSONHandler::Formatters;
using namespace NsSmartDeviceLink::NsJSONHandler::strings;
-TEST(FormatterJsonRPCTest, CorrectRPCv1_request_SmartObjectToString_EXPECT_SUCCESS) {
+void CompactJson(std::string& str) {
+ Json::Value root;
+ Json::Reader reader;
+ reader.parse(str, root);
+ Json::FastWriter writer;
+ str = writer.write(root);
+ if (str[str.size() - 1] == '\n') {
+ str.erase(str.size()-1,1);
+ }
+}
+
+namespace {
+const int64_t big_64int = 100000000000;
+const std::string str_with_big_int64 = "100000000000";
+} // namespace
+
+TEST(FormatterJsonRPCTest, CheckCompactJson){
+ std::string before_compact(
+ "{\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"BasicCommunication.OnSystemRequest\","
+ "\n \"params\" : {\n \"fileName\" : \"file \n Name\",\n \"length\" : 100000000000,\n"
+ "\"offset\" : 100000000000,\n \"requestType\" : \"PROPRIETARY\"\n }\n}\n");
+ std::string after_compact = before_compact;
+ CompactJson(after_compact);
+
+ EXPECT_NE(before_compact, after_compact);
+
+ std::string expected(
+ "{\"jsonrpc\":\"2.0\",\"method\":\"BasicCommunication.OnSystemRequest\","
+ "\"params\":{\"fileName\":\"file \\n Name\",\"length\":100000000000,"
+ "\"offset\":100000000000,\"requestType\":\"PROPRIETARY\"}}");
+ EXPECT_EQ(expected, after_compact);
+}
+
+TEST(FormatterJsonRPCTest, CorrectRPCv1Request_ToString_Success) {
// Create SmartObject
SmartObject obj;
obj[S_PARAMS][S_FUNCTION_ID] = hmi_apis::FunctionID::VR_IsReady;
@@ -59,15 +100,15 @@ TEST(FormatterJsonRPCTest, CorrectRPCv1_request_SmartObjectToString_EXPECT_SUCCE
EXPECT_TRUE(factory.attachSchema(obj, false));
std::string result;
- // Convert SmrtObject to Json string
+ // Convert SmartObject to Json string
EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
- EXPECT_EQ(
- std::string(
- "{\n \"id\" : 4444,\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"VR.IsReady\"\n}\n"),
- result);
+ CompactJson(result);
+ const std::string json_string(
+ "{\"id\":4444,\"jsonrpc\":\"2.0\",\"method\":\"VR.IsReady\"}");
+ EXPECT_EQ(json_string, result);
}
-TEST(FormatterJsonRPCTest, CorrectRPCv2_request_SmartObjectToString_EXPECT_SUCCESS) {
+TEST(FormatterJsonRPCTest, CorrectRPCv2Request_ToString_Success) {
// Create SmartObject
SmartObject obj;
obj[S_PARAMS][S_FUNCTION_ID] = mobile_apis::FunctionID::AddCommandID;
@@ -79,15 +120,45 @@ TEST(FormatterJsonRPCTest, CorrectRPCv2_request_SmartObjectToString_EXPECT_SUCCE
EXPECT_TRUE(factory.attachSchema(obj, false));
std::string result;
- // Convert SmrtObject to Json string
+ // Convert SmartObject to Json string
+ EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
+ CompactJson(result);
+ const std::string json_string(
+ "{\"id\":4444,\"jsonrpc\":\"2.0\",\"method\":\"AddCommandID\"}");
+ EXPECT_EQ(json_string, result);
+}
+
+TEST(FormatterJsonRPCTest, UpperBoundValuesInSystemRequest_ToString_Success) {
+ // Create SmartObject
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] =
+ hmi_apis::FunctionID::BasicCommunication_OnSystemRequest;
+ obj[S_PARAMS][S_MESSAGE_TYPE] = hmi_apis::messageType::notification;
+ obj[S_PARAMS][S_PROTOCOL_VERSION] = 2;
+ obj[S_PARAMS][S_PROTOCOL_TYPE] = 1;
+ obj[S_PARAMS][S_CORRELATION_ID] = 4444;
+ obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map);
+ obj[S_MSG_PARAMS]["requestType"] = hmi_apis::Common_RequestType::PROPRIETARY;
+ obj[S_MSG_PARAMS]["fileName"] = "fileName";
+ obj[S_MSG_PARAMS]["length"] = big_64int;
+ obj[S_MSG_PARAMS]["offset"] = big_64int;
+ // Attach Schema
+
+ hmi_apis::HMI_API factory;
+ EXPECT_TRUE(factory.attachSchema(obj, false));
+ EXPECT_EQ(Errors::OK, obj.validate());
+ std::string result;
+ // Convert SmartObject to Json string
EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
- EXPECT_EQ(
- std::string(
- "{\n \"id\" : 4444,\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"AddCommandID\"\n}\n"),
- result);
+ CompactJson(result);
+ const std::string json_string(
+ "{\"jsonrpc\":\"2.0\",\"method\":\"BasicCommunication.OnSystemRequest\","
+ "\"params\":{\"fileName\":\"fileName\",\"length\":100000000000,"
+ "\"offset\":100000000000,\"requestType\":\"PROPRIETARY\"}}");
+ EXPECT_EQ(json_string, result);
}
-TEST(FormatterJsonRPCTest, CorrectRPCv1_notification_SmartObjectToString_EXPECT_SUCCESS) {
+TEST(FormatterJsonRPCTest, CorrectRPCv1Notification_ToString_Success) {
// Create SmartObject
SmartObject obj;
std::string result;
@@ -100,20 +171,138 @@ TEST(FormatterJsonRPCTest, CorrectRPCv1_notification_SmartObjectToString_EXPECT_
// Attach Schema
hmi_apis::HMI_API factory;
EXPECT_TRUE(factory.attachSchema(obj, false));
- // Convert SmrtObject to Json string
+ // Convert SmartObject to Json string
EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
- EXPECT_EQ(
- std::string(
- "{\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"Buttons.OnButtonPress\",\n \"params\" : {}\n}\n"),
- result);
+ CompactJson(result);
+ const std::string json_string(
+ "{\"jsonrpc\":\"2.0\",\"method\":\"Buttons.OnButtonPress\",\"params\":{}"
+ "}");
+ EXPECT_EQ(json_string, result);
+}
+
+TEST(FormatterJsonRPCTest, CorrectResponseToString_Success) {
+ // Create SmartObject
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = hmi_apis::FunctionID::VR_AddCommand;
+ obj[S_PARAMS][S_MESSAGE_TYPE] = hmi_apis::messageType::response;
+ obj[S_PARAMS][S_CORRELATION_ID] = 4440;
+ obj[S_PARAMS][kCode] = hmi_apis::Common_Result::SUCCESS;
+ obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map);
+ // Attach Schema
+ hmi_apis::HMI_API factory;
+ EXPECT_TRUE(factory.attachSchema(obj, false));
+
+ std::string result;
+ // Convert SmartObject to Json string
+ EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
+ CompactJson(result);
+ const std::string json_string(
+ "{\"id\":4440,\"jsonrpc\":\"2.0\",\"result\":{\"code\":0,\"method\":\"VR."
+ "AddCommand\"}}");
+ EXPECT_EQ(json_string, result);
}
-TEST(FormatterJsonRPCTest, InvalidRPC_SmartObjectToString_EXPECT_FALSE) {
+TEST(FormatterJsonRPCTest, ErrorResponse_ToString_Success) {
// Create SmartObject
SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = hmi_apis::FunctionID::VR_AddCommand;
+ obj[S_PARAMS][S_MESSAGE_TYPE] = hmi_apis::messageType::error_response;
+ obj[S_PARAMS][S_CORRELATION_ID] = 4440;
+ obj[S_PARAMS][kCode] = hmi_apis::Common_Result::GENERIC_ERROR;
+ obj[S_PARAMS][kMessage] = "Some error";
+ obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map);
+ // Attach Schema
+ hmi_apis::HMI_API factory;
+ EXPECT_TRUE(factory.attachSchema(obj, false));
+
+ std::string result;
+ // Convert SmartObject to Json string
+ EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
+ CompactJson(result);
+
+ const std::string json_string(
+ "{\"error\":{\"code\":22,\"data\":{\"method\":\"VR.AddCommand\"},"
+ "\"message\":\"Some error\"},\"id\":4440,\"jsonrpc\":\"2.0\"}");
+ EXPECT_EQ(json_string, result);
+}
+
+TEST(FormatterJsonRPCTest, ResponseWithoutCorID_ToString_Fail) {
+ // Create SmartObject
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = hmi_apis::FunctionID::VR_AddCommand;
+ obj[S_PARAMS][S_MESSAGE_TYPE] = hmi_apis::messageType::response;
+ obj[S_PARAMS][S_PROTOCOL_VERSION] = 2;
+ obj[S_PARAMS][S_PROTOCOL_TYPE] = 1;
+ obj[S_PARAMS][S_CORRELATION_ID] = 4444;
+ obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map);
+ // Attach Schema
+ hmi_apis::HMI_API factory;
+ EXPECT_TRUE(factory.attachSchema(obj, false));
+
+ std::string result;
+ // Convert SmartObject to Json string will finish wrong
+ EXPECT_FALSE(FormatterJsonRpc::ToString(obj, result));
+}
+
+TEST(FormatterJsonRPCTest, RequestWithoutMSGParams_ToString_Success) {
+ // Create SmartObject
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = mobile_apis::FunctionID::AddCommandID;
+ obj[S_PARAMS][S_MESSAGE_TYPE] = mobile_apis::messageType::request;
+ obj[S_PARAMS][S_CORRELATION_ID] = 4444;
+ // Attach Schema
+ mobile_apis::MOBILE_API factory;
+ EXPECT_TRUE(factory.attachSchema(obj, false));
+
+ std::string result;
+ // Convert SmartObject to Json string
+ EXPECT_TRUE(FormatterJsonRpc::ToString(obj, result));
+ CompactJson(result);
+ const std::string json_string(
+ "{\"id\":4444,\"jsonrpc\":\"2.0\",\"method\":\"AddCommandID\"}");
+ EXPECT_EQ(json_string, result);
+}
+
+TEST(FormatterJsonRPCTest, RequestWithoutCorID_ToString_Fail) {
+ // Create SmartObject
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = mobile_apis::FunctionID::AddCommandID;
+ obj[S_PARAMS][S_MESSAGE_TYPE] = mobile_apis::messageType::request;
+ obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map);
+ // Attach Schema
+ mobile_apis::MOBILE_API factory;
+ EXPECT_TRUE(factory.attachSchema(obj, false));
+
+ std::string result;
+ // Converting SmartObject to Json string is failed
+ EXPECT_FALSE(FormatterJsonRpc::ToString(obj, result));
+ CompactJson(result);
+
+ const std::string json_string("{\"jsonrpc\":\"2.0\",\"method\":\"AddCommandID\"}");
+ EXPECT_EQ(json_string, result);
+}
+
+TEST(FormatterJsonRPCTest, RequestWithoutType_ToString_Fail) {
+ // Create SmartObject
+ SmartObject obj;
+ obj[S_PARAMS][S_FUNCTION_ID] = mobile_apis::FunctionID::AddCommandID;
+ obj[S_MSG_PARAMS] = SmartObject(SmartType::SmartType_Map);
+ // Attach Schema is impossible
+ mobile_apis::MOBILE_API factory;
+ EXPECT_FALSE(factory.attachSchema(obj, false));
+
+ std::string result;
+ // Converting SmartObject to Json string is failed
+ EXPECT_FALSE(FormatterJsonRpc::ToString(obj, result));
+ EXPECT_EQ(std::string("{\n \"jsonrpc\" : \"2.0\"\n}\n"), result);
+}
+
+TEST(FormatterJsonRPCTest, InvalidRPC_ToString_False) {
+ // Create SmartObject with notification id and response message type
+ SmartObject obj;
std::string result;
obj[S_PARAMS][S_FUNCTION_ID] =
- hmi_apis::FunctionID::BasicCommunication_OnReady;
+ hmi_apis::FunctionID::BasicCommunication_OnReady;
obj[S_PARAMS][S_MESSAGE_TYPE] = hmi_apis::messageType::response;
obj[S_PARAMS][S_PROTOCOL_VERSION] = 2;
obj[S_PARAMS][S_PROTOCOL_TYPE] = 1;
@@ -128,72 +317,110 @@ TEST(FormatterJsonRPCTest, InvalidRPC_SmartObjectToString_EXPECT_FALSE) {
EXPECT_EQ(std::string("{\n \"jsonrpc\" : \"2.0\"\n}\n"), result);
}
-TEST(FormatterJsonRPCTest, FromStringNotificationToSmartObj_ExpectSuccess) {
+TEST(FormatterJsonRPCTest, Notification_ToSmartObject_Success) {
// Source Json string
const std::string json_string(
- "{\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"BasicCommunication.OnReady\",\n \"params\" : {}\n}\n");
+ "{\n \"jsonrpc\" : \"2.0\",\n \"method\" : "
+ "\"BasicCommunication.OnReady\",\n \"params\" : {}\n}\n");
// Smart Object to keep result
SmartObject obj;
// Convert json string to smart object
- EXPECT_EQ(
- 0,
- (FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
- hmi_apis::messageType::eType>(json_string, obj)));
+ int32_t result = FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ json_string, obj);
+ EXPECT_EQ(0, result);
// Get keys collection from Smart Object
std::set<std::string> keys = obj["params"].enumerate();
EXPECT_EQ(4u, keys.size());
}
-TEST(FormatterJsonRPCTest, FromStringToSmartObjInvalidFormat_ExpectFalse) {
+TEST(FormatterJsonRPCTest, InvalidFormatToSmartObject_False) {
// Source Json string
const std::string json_string(
- "{\n \"method\" : \"BasicCommunication.OnReady\",\n \"params\" : {}\n}\n");
+ "{\n \"method\" : \"BasicCommunication.OnReady\",\n \"params\" : "
+ "{}\n}\n");
// Smart Object to keep result
SmartObject obj;
// Convert json string to smart object
- EXPECT_EQ(
- 2,
- (FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
- hmi_apis::messageType::eType>(json_string, obj)));
+ int32_t result = FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ json_string, obj);
+ EXPECT_EQ(2, result);
// Get keys collection from Smart Object
std::set<std::string> keys = obj["params"].enumerate();
EXPECT_EQ(4u, keys.size());
}
-TEST(FormatterJsonRPCTest, FromStringRequestToSmartObj_ExpectSuccess) {
+TEST(FormatterJsonRPCTest, RequestToSmartObject_Success) {
// Source Json string
const std::string json_string(
- "{\n \"id\" : 4444,\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"VR.IsReady\"\n}\n");
+ "{\n \"id\" : 4444,\n \"jsonrpc\" : \"2.0\",\n \"method\" : "
+ "\"VR.IsReady\"\n}\n");
// Smart Object to keep result
SmartObject obj;
// Convert json string to smart object
- EXPECT_EQ(
- 0,
- (FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
- hmi_apis::messageType::eType>(json_string, obj)));
+ int32_t result = FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ json_string, obj);
+ int32_t function_id = hmi_apis::FunctionID::VR_IsReady;
+ EXPECT_EQ(0, result);
// Get keys collection from Smart Object
std::set<std::string> keys = obj["params"].enumerate();
- std::set<std::string>::iterator it1 = keys.begin();
EXPECT_EQ(5u, keys.size());
+ EXPECT_EQ(4444, obj["params"]["correlation_id"].asInt());
+ EXPECT_EQ(function_id, obj["params"]["function_id"].asInt());
+ EXPECT_EQ(0, obj["params"]["message_type"].asInt());
+ EXPECT_EQ(1, obj["params"]["protocol_type"].asInt());
+ EXPECT_EQ(2, obj["params"]["protocol_version"].asInt());
}
-TEST(FormatterJsonRPCTest, FromStringResponseToSmartObj_ExpectSuccess) {
+TEST(FormatterJsonRPCTest, ResponseToSmartObject_Success) {
// Source Json string
const std::string json_string(
- "{\n \"id\" : 4444,\n \"jsonrpc\" : \"2.0\",\n \"method\" : \"VR.IsReady\"\n}\n");
+ "{\"id\":4440,\"jsonrpc\":\"2.0\",\"result\":{\"code\":0,\"method\":\"VR."
+ "AddCommand\"}}");
// Smart Object to keep result
SmartObject obj;
// Convert json string to smart object
- EXPECT_EQ(
- 0,
- (FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
- hmi_apis::messageType::eType>(json_string, obj)));
+ int32_t result = FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ json_string, obj);
+
+ int32_t function_id = hmi_apis::FunctionID::VR_AddCommand;
+
+ EXPECT_EQ(0, result);
// Get keys collection from Smart Object
std::set<std::string> keys = obj["params"].enumerate();
- std::set<std::string>::iterator it1 = keys.begin();
- EXPECT_EQ(5u, keys.size());
+ EXPECT_EQ(6u, keys.size());
+ EXPECT_EQ(0, obj["params"]["code"].asInt());
+ EXPECT_EQ(4440, obj["params"]["correlation_id"].asInt());
+ EXPECT_EQ(function_id, obj["params"]["function_id"].asInt());
+ EXPECT_EQ(1, obj["params"]["message_type"].asInt());
+ EXPECT_EQ(1, obj["params"]["protocol_type"].asInt());
+ EXPECT_EQ(2, obj["params"]["protocol_version"].asInt());
+}
+
+TEST(FormatterJsonRPCTest, StringWithUpperBoundValueToSmartObject_Success) {
+ // Source Json string
+ const std::string json_string(
+ "{\"jsonrpc\":\"2.0\",\"method\":\"BasicCommunication.OnSystemRequest\","
+ "\"params\":{\"fileName\":\"filename\",\"length\":100000000000,"
+ "\"requestType\":\"PROPRIETARY\"}}");
+ // Smart Object to keep result
+ SmartObject obj;
+ // Convert json string to smart object
+
+ int32_t res = FormatterJsonRpc::FromString<hmi_apis::FunctionID::eType,
+ hmi_apis::messageType::eType>(
+ json_string, obj);
+ // Get keys collection from Smart Object
+ EXPECT_EQ(0, res);
+ EXPECT_EQ(big_64int, obj["msg_params"]["length"].asInt());
+ EXPECT_EQ(str_with_big_int64, obj["msg_params"]["length"].asString());
+ std::set<std::string> keys = obj["params"].enumerate();
+ EXPECT_EQ(4u, keys.size());
}
-} // namespace formatters
+} // namespace formatters_test
} // namespace components
} // namespace test
diff --git a/src/components/formatters/test/include/SmartFactoryTestHelper.h b/src/components/formatters/test/include/SmartFactoryTestHelper.h
index ca7021b844..e9bb32255a 100644
--- a/src/components/formatters/test/include/SmartFactoryTestHelper.h
+++ b/src/components/formatters/test/include/SmartFactoryTestHelper.h
@@ -36,7 +36,7 @@
#include <map>
#include <set>
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
#include "HMI_API_schema.h"
#include "smart_objects/always_true_schema_item.h"
#include "smart_objects/always_false_schema_item.h"
diff --git a/src/components/formatters/test/include/create_smartSchema.h b/src/components/formatters/test/include/create_smartSchema.h
index c3bc2651e5..4498c5d333 100644
--- a/src/components/formatters/test/include/create_smartSchema.h
+++ b/src/components/formatters/test/include/create_smartSchema.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_FORMATTERS_TEST_INCLUDE_CREATESMARTSCHEMA_H_
#define SRC_COMPONENTS_FORMATTERS_TEST_INCLUDE_CREATESMARTSCHEMA_H_
-#include "formatters/CFormatterJsonSDLRPCv1.hpp"
+#include "formatters/CFormatterJsonSDLRPCv1.h"
#include "SmartFactoryTestHelper.h"
namespace test {
diff --git a/src/components/formatters/test/include/meta_formatter_test_helper.h b/src/components/formatters/test/include/meta_formatter_test_helper.h
index e2be3beb64..a1111e2a49 100644
--- a/src/components/formatters/test/include/meta_formatter_test_helper.h
+++ b/src/components/formatters/test/include/meta_formatter_test_helper.h
@@ -36,8 +36,8 @@
#include "gtest/gtest.h"
#include "smart_objects/smart_object.h"
-#include "formatters/CFormatterJsonSDLRPCv1.hpp"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CFormatterJsonSDLRPCv1.h"
+#include "formatters/CSmartFactory.h"
#include "create_smartSchema.h"
namespace test {
diff --git a/src/components/hmi_message_handler/CMakeLists.txt b/src/components/hmi_message_handler/CMakeLists.txt
index 9559b6b00f..aa10729458 100644
--- a/src/components/hmi_message_handler/CMakeLists.txt
+++ b/src/components/hmi_message_handler/CMakeLists.txt
@@ -35,7 +35,6 @@ include_directories (
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/smart_objects/include/
${COMPONENTS_DIR}/formatters/include/
- ${COMPONENTS_DIR}/config_profile/include/
${COMPONENTS_DIR}/media_manager/include/
${COMPONENTS_DIR}/protocol_handler/include
${JSONCPP_INCLUDE_DIRECTORY}
@@ -55,7 +54,7 @@ ENDIF ()
set (SOURCES
${COMPONENTS_DIR}/hmi_message_handler/src/hmi_message_handler_impl.cc
${COMPONENTS_DIR}/hmi_message_handler/src/messagebroker_adapter.cc
- ${COMPONENTS_DIR}/hmi_message_handler/src/hmi_message_adapter.cc
+ ${COMPONENTS_DIR}/hmi_message_handler/src/hmi_message_adapter_impl.cc
${COMPONENTS_DIR}/hmi_message_handler/src/mqueue_adapter.cc
${DBUS_SOURCE}
)
@@ -76,6 +75,6 @@ endif()
# Tests temporary are inactivated. For details please check
# Readme.txt in test directory of hmi_message_handler
-#if(BUILD_TESTS)
-# add_subdirectory(test)
-#endif()
+if(BUILD_TESTS)
+ add_subdirectory(test)
+endif()
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h
index 7d33e93332..1d0793c0ad 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/dbus_message_adapter.h
@@ -34,7 +34,7 @@
#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_DBUS_MESSAGE_ADAPTER_H_
#include <string>
-#include "hmi_message_handler/hmi_message_adapter.h"
+#include "hmi_message_handler/hmi_message_adapter_impl.h"
#include "dbus/dbus_message_controller.h"
#include "smart_objects/smart_object.h"
@@ -46,7 +46,7 @@ namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
* \brief adapter for DBus
*/
class DBusMessageAdapter
- : public HMIMessageAdapter,
+ : public HMIMessageAdapterImpl,
public dbus::DBusMessageController {
public:
typedef utils::SharedPtr<application_manager::Message> MessageSharedPointer;
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h
index 5ed37031ea..d2a3a5b907 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_H_
#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_H_
-#include "hmi_message_handler/hmi_message_handler.h"
+#include "hmi_message_handler/hmi_message_sender.h"
namespace hmi_message_handler {
/**
@@ -43,37 +43,16 @@ namespace hmi_message_handler {
* SDL with HMI has to implement this interface.
*/
class HMIMessageAdapter : public HMIMessageSender {
- public:
- /**
- * \brief Constructor
- * \param handler Pointer to implementation of HMIMessageHandler abstract class
- * to notify it about receiving message or error on sending message.
- */
- explicit HMIMessageAdapter(HMIMessageHandler* handler);
-
- /**
- * \brief Destructor
- */
- virtual ~HMIMessageAdapter();
-
protected:
/**
* \brief Interface for subscriptions.
* Each class implementing interface should use it according to
* standarts of transport for which it is to be an adapter.
- * For example, Adapter for MessageBroker will use it to subscribe to notifications
+ * For example, Adapter for MessageBroker will use it to subscribe to
+ * notifications
* from HMI.
*/
virtual void SubscribeTo() = 0;
- inline virtual HMIMessageHandler* handler() const {
- return handler_;
- }
-
- private:
- /**
- *\brief Pointer on handler to notify it about receiving message/error.
- */
- mutable HMIMessageHandler* handler_;
};
} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h
new file mode 100644
index 0000000000..bd118032d6
--- /dev/null
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_adapter_impl.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_IMPL_H_
+#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_IMPL_H_
+
+#include "hmi_message_handler/hmi_message_adapter.h"
+#include "hmi_message_handler/hmi_message_handler.h"
+
+namespace hmi_message_handler {
+
+class HMIMessageAdapterImpl : public HMIMessageAdapter {
+ public:
+ /**
+ * \brief Constructor
+ * \param handler Pointer to implementation of HMIMessageHandler abstract
+ * class
+ * to notify it about receiving message or error on sending message.
+ */
+ explicit HMIMessageAdapterImpl(HMIMessageHandler* handler);
+
+ /**
+ * \brief Destructor
+ */
+ virtual ~HMIMessageAdapterImpl();
+
+ protected:
+ virtual HMIMessageHandler* handler() const {
+ return handler_;
+ }
+
+ private:
+ /**
+ *\brief Pointer on handler to notify it about receiving message/error.
+ */
+ HMIMessageHandler* handler_;
+};
+
+} // namespace hmi_message_handler
+
+#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_ADAPTER_IMPL_H_
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h
index 3e06c65085..217075e89f 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,7 @@
#include "hmi_message_handler/hmi_message_sender.h"
#include "hmi_message_handler/hmi_message_observer.h"
+#include "hmi_message_handler/hmi_message_handler_settings.h"
namespace hmi_message_handler {
@@ -49,6 +50,12 @@ class HMIMessageHandler : public HMIMessageObserver, public HMIMessageSender {
virtual ~HMIMessageHandler() {}
virtual void AddHMIMessageAdapter(HMIMessageAdapter* adapter) = 0;
virtual void RemoveHMIMessageAdapter(HMIMessageAdapter* adapter) = 0;
+
+ /**
+ * \brief Hmi message handler settings getter
+ * \return pointer to hmi message handler settings class
+ */
+ virtual const HMIMessageHandlerSettings& get_settings() const = 0;
};
} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h
index d638f370d8..2f235aa968 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/hmi_message_handler_impl.h
@@ -36,12 +36,12 @@
#include <set>
#include "hmi_message_handler/hmi_message_adapter.h"
#include "hmi_message_handler/hmi_message_handler.h"
+#include "hmi_message_handler/hmi_message_handler_settings.h"
#include "utils/macro.h"
#include "utils/message_queue.h"
#include "utils/prioritized_queue.h"
#include "utils/threads/message_loop_thread.h"
#include "utils/threads/thread.h"
-#include "utils/singleton.h"
namespace hmi_message_handler {
@@ -55,14 +55,16 @@ namespace impl {
* when we have them.
*/
struct MessageFromHmi: public MessageSharedPointer {
- MessageFromHmi(const MessageSharedPointer& message)
+ MessageFromHmi() {}
+ explicit MessageFromHmi(const MessageSharedPointer& message)
: MessageSharedPointer(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); }
};
struct MessageToHmi: public MessageSharedPointer {
- MessageToHmi(const MessageSharedPointer& message)
+ MessageToHmi() {}
+ explicit MessageToHmi(const MessageSharedPointer& message)
: MessageSharedPointer(message) {}
// PrioritizedQueue requres this method to decide which priority to assign
size_t PriorityOrder() const { return (*this)->Priority().OrderingValue(); }
@@ -80,9 +82,10 @@ class FromHMIThreadImpl;
class HMIMessageHandlerImpl
: public HMIMessageHandler,
public impl::FromHmiQueue::Handler,
- public impl::ToHmiQueue::Handler,
- public utils::Singleton<HMIMessageHandlerImpl> {
+ public impl::ToHmiQueue::Handler {
public:
+ explicit HMIMessageHandlerImpl(const HMIMessageHandlerSettings& settings);
+
~HMIMessageHandlerImpl();
void OnMessageReceived(MessageSharedPointer message);
void SendMessageToHMI(MessageSharedPointer message);
@@ -91,10 +94,19 @@ class HMIMessageHandlerImpl
void AddHMIMessageAdapter(HMIMessageAdapter* adapter);
void RemoveHMIMessageAdapter(HMIMessageAdapter* adapter);
- private:
- HMIMessageHandlerImpl();
+ virtual const HMIMessageHandlerSettings& get_settings() const OVERRIDE;
+
+#ifdef BUILD_TESTS
+ std::set<HMIMessageAdapter*> message_adapters() const {
+ return message_adapters_;
+ }
+ HMIMessageObserver* observer() const {
+ return observer_;
+ }
+#endif // BUILD_TESTS
+ private:
// threads::MessageLoopThread<*>::Handler implementations
// CALLED ON messages_from_hmi_ THREAD!
@@ -102,7 +114,7 @@ class HMIMessageHandlerImpl
// CALLED ON messages_to_hmi_ THREAD!
virtual void Handle(const impl::MessageToHmi message) OVERRIDE;
private:
-
+ const HMIMessageHandlerSettings& settings_;
HMIMessageObserver* observer_;
mutable sync_primitives::Lock observer_locker_;
std::set<HMIMessageAdapter*> message_adapters_;
@@ -115,7 +127,6 @@ class HMIMessageHandlerImpl
impl::FromHmiQueue messages_from_hmi_;
DISALLOW_COPY_AND_ASSIGN(HMIMessageHandlerImpl);
- FRIEND_BASE_SINGLETON_CLASS(HMIMessageHandlerImpl);
};
} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
index 4580b18ee1..74a6ed872c 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/messagebroker_adapter.h
@@ -36,12 +36,12 @@
#include <string>
#include "mb_controller.hpp"
-#include "hmi_message_handler/hmi_message_adapter.h"
+#include "hmi_message_handler/hmi_message_adapter_impl.h"
#include "utils/threads/thread_validator.h"
namespace hmi_message_handler {
-class MessageBrokerAdapter : public HMIMessageAdapter,
+class MessageBrokerAdapter : public HMIMessageAdapterImpl,
public NsMessageBroker::CMessageBrokerController,
public threads::SingleThreadValidator {
public:
diff --git a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h
index 126ea3a66e..69634ea00e 100644
--- a/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h
+++ b/src/components/hmi_message_handler/include/hmi_message_handler/mqueue_adapter.h
@@ -36,7 +36,7 @@
#include <memory>
#include <mqueue.h>
#include "utils/threads/thread.h"
-#include "hmi_message_handler/hmi_message_adapter.h"
+#include "hmi_message_handler/hmi_message_adapter_impl.h"
namespace hmi_message_handler {
@@ -45,7 +45,7 @@ class ReceiverThreadDelegate;
/**
* \brief HMI message adapter for mqueue
*/
-class MqueueAdapter : public HMIMessageAdapter {
+class MqueueAdapter : public HMIMessageAdapterImpl {
public:
MqueueAdapter(HMIMessageHandler* hmi_message_handler);
virtual ~MqueueAdapter();
diff --git a/src/components/hmi_message_handler/src/dbus_message_adapter.cc b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
index 7c540ad0c2..607cc64c51 100644
--- a/src/components/hmi_message_handler/src/dbus_message_adapter.cc
+++ b/src/components/hmi_message_handler/src/dbus_message_adapter.cc
@@ -33,7 +33,7 @@
#include "hmi_message_handler/dbus_message_adapter.h"
#include <sstream>
#include "utils/logger.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
namespace smart_objects = NsSmartDeviceLink::NsSmartObjects;
namespace sos = NsSmartDeviceLink::NsJSONHandler::strings;
@@ -58,7 +58,7 @@ std::vector<std::string> &split(const std::string &s, char delim,
}
DBusMessageAdapter::DBusMessageAdapter(HMIMessageHandler* hmi_msg_handler)
- : HMIMessageAdapter(hmi_msg_handler),
+ : HMIMessageAdapterImpl(hmi_msg_handler),
DBusMessageController(SDL_SERVICE_NAME, SDL_OBJECT_PATH,
HMI_SERVICE_NAME, HMI_OBJECT_PATH) {
LOG4CXX_INFO(logger_, "Created DBusMessageAdapter");
@@ -172,7 +172,7 @@ void DBusMessageAdapter::SendMessageToCore(const smart_objects::SmartObject& obj
}
void DBusMessageAdapter::Request(const smart_objects::SmartObject& obj) {
- LOG4CXX_DEBUG(logger_, "Request");
+ LOG4CXX_AUTO_TRACE(logger_);
dbus::MessageId func_id = static_cast<dbus::MessageId>(
obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt());
dbus::MessageName name = get_schema().getMessageName(func_id);
@@ -181,7 +181,7 @@ void DBusMessageAdapter::Request(const smart_objects::SmartObject& obj) {
}
void DBusMessageAdapter::Notification(const smart_objects::SmartObject &obj) {
- LOG4CXX_DEBUG(logger_, "Notification");
+ LOG4CXX_AUTO_TRACE(logger_);
dbus::MessageId func_id = static_cast<dbus::MessageId>(
obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt());
dbus::MessageName name = get_schema().getMessageName(func_id);
@@ -189,7 +189,7 @@ void DBusMessageAdapter::Notification(const smart_objects::SmartObject &obj) {
}
void DBusMessageAdapter::Response(const smart_objects::SmartObject& obj) {
- LOG4CXX_DEBUG(logger_, "Response");
+ LOG4CXX_AUTO_TRACE(logger_);
dbus::MessageId func_id = static_cast<dbus::MessageId>(
obj[sos::S_PARAMS][sos::S_FUNCTION_ID].asInt());
dbus::MessageName name = get_schema().getMessageName(func_id);
diff --git a/src/components/hmi_message_handler/src/hmi_message_adapter.cc b/src/components/hmi_message_handler/src/hmi_message_adapter_impl.cc
index d8c280bea7..a2b6eb21fa 100644
--- a/src/components/hmi_message_handler/src/hmi_message_adapter.cc
+++ b/src/components/hmi_message_handler/src/hmi_message_adapter_impl.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,15 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "hmi_message_handler/hmi_message_adapter.h"
+#include "hmi_message_handler/hmi_message_adapter_impl.h"
namespace hmi_message_handler {
-HMIMessageAdapter::HMIMessageAdapter(HMIMessageHandler* handler)
- : handler_(handler) {
-}
+HMIMessageAdapterImpl::HMIMessageAdapterImpl(HMIMessageHandler* handler)
+ : handler_(handler) {}
-HMIMessageAdapter::~HMIMessageAdapter() {
- handler_ = 0;
-}
+HMIMessageAdapterImpl::~HMIMessageAdapterImpl() { handler_ = 0; }
} // namespace hmi_message_handler
diff --git a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
index 887d145617..4081facb4e 100644
--- a/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
+++ b/src/components/hmi_message_handler/src/hmi_message_handler_impl.cc
@@ -31,35 +31,33 @@
*/
#include "hmi_message_handler/hmi_message_handler_impl.h"
-#include "config_profile/profile.h"
#include "utils/logger.h"
namespace hmi_message_handler {
CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler")
-HMIMessageHandlerImpl::HMIMessageHandlerImpl()
- : observer_(NULL),
- messages_to_hmi_("HMH ToHMI", this,
- threads::ThreadOptions(
- profile::Profile::instance()->thread_min_stack_size())),
- messages_from_hmi_("HMH FromHMI", this,
- threads::ThreadOptions(
- profile::Profile::instance()->thread_min_stack_size())) {
+HMIMessageHandlerImpl::HMIMessageHandlerImpl(
+ const HMIMessageHandlerSettings& settings)
+ : settings_(settings)
+ , observer_(NULL)
+ , messages_to_hmi_("HMH ToHMI", this,
+ threads::ThreadOptions(
+ get_settings().thread_min_stack_size()))
+ , messages_from_hmi_("HMH FromHMI", this,
+ threads::ThreadOptions(
+ get_settings().thread_min_stack_size())){
}
HMIMessageHandlerImpl::~HMIMessageHandlerImpl() {
- LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::~HMIMessageHandlerImpl()");
- sync_primitives::AutoLock lock(observer_locker_);
- observer_ = NULL;
- if (!message_adapters_.empty()) {
- LOG4CXX_WARN(logger_, "Not all HMIMessageAdapter have unsubscribed from"
- " HMIMessageHandlerImpl");
- }
+ LOG4CXX_AUTO_TRACE(logger_);
+ messages_to_hmi_.Shutdown();
+ messages_from_hmi_.Shutdown();
+ set_message_observer(NULL);
}
void HMIMessageHandlerImpl::OnMessageReceived(MessageSharedPointer message) {
- LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::OnMessageReceived()");
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(observer_locker_);
if (!observer_) {
LOG4CXX_WARN(logger_, "No HMI message observer set!");
@@ -74,12 +72,13 @@ void HMIMessageHandlerImpl::SendMessageToHMI(MessageSharedPointer message) {
}
void HMIMessageHandlerImpl::set_message_observer(HMIMessageObserver* observer) {
- LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::SetMessageObserver()");
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(observer_locker_);
observer_ = observer;
}
void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) {
- LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::OnErrorSending()");
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(observer_locker_);
if (!observer_) {
LOG4CXX_WARN(logger_, "No HMI message observer set!");
@@ -88,17 +87,28 @@ void HMIMessageHandlerImpl::OnErrorSending(MessageSharedPointer message) {
observer_->OnErrorSending(message);
}
-void HMIMessageHandlerImpl::AddHMIMessageAdapter(HMIMessageAdapter* adapter) {
- LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::AddHMIMessageAdapter()");
+void HMIMessageHandlerImpl::AddHMIMessageAdapter(
+ HMIMessageAdapter* adapter) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!adapter) {
+ LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!");
+ return;
+ }
message_adapters_.insert(adapter);
}
void HMIMessageHandlerImpl::RemoveHMIMessageAdapter(
HMIMessageAdapter* adapter) {
- LOG4CXX_INFO(logger_, "HMIMessageHandlerImpl::RemoveHMIMessageAdapter()");
- if (adapter != NULL) {
- message_adapters_.erase(adapter);
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!adapter) {
+ LOG4CXX_WARN(logger_, "HMIMessageAdapter is not valid!");
+ return;
}
+ message_adapters_.erase(adapter);
+}
+
+const HMIMessageHandlerSettings& HMIMessageHandlerImpl::get_settings() const {
+ return settings_;
}
void HMIMessageHandlerImpl::Handle(const impl::MessageFromHmi message) {
diff --git a/src/components/hmi_message_handler/src/messagebroker_adapter.cc b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
index 654fe747a6..260682101c 100644
--- a/src/components/hmi_message_handler/src/messagebroker_adapter.cc
+++ b/src/components/hmi_message_handler/src/messagebroker_adapter.cc
@@ -33,7 +33,6 @@
#include <string>
#include "hmi_message_handler/messagebroker_adapter.h"
-#include "config_profile/profile.h"
#include "utils/logger.h"
namespace hmi_message_handler {
@@ -43,29 +42,28 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "HMIMessageHandler")
typedef NsMessageBroker::CMessageBrokerController MessageBrokerController;
MessageBrokerAdapter::MessageBrokerAdapter(HMIMessageHandler* handler_param,
- const std::string& server_address,
- uint16_t port)
- : HMIMessageAdapter(handler_param),
- MessageBrokerController(server_address, port, "SDL") {
- LOG4CXX_INFO(logger_, "Created MessageBrokerAdapter");
+ const std::string& server_address,
+ uint16_t port)
+ : HMIMessageAdapterImpl(handler_param),
+ MessageBrokerController(server_address, port, "SDL") {
+ LOG4CXX_TRACE(logger_, "Created MessageBrokerAdapter");
}
-
-MessageBrokerAdapter::~MessageBrokerAdapter() {
-}
+MessageBrokerAdapter::~MessageBrokerAdapter() {}
void MessageBrokerAdapter::SendMessageToHMI(
- hmi_message_handler::MessageSharedPointer message) {
- LOG4CXX_INFO(logger_, "MessageBrokerAdapter::sendMessageToHMI");
- /*if (!message) {
- // TODO(PV): LOG
- return;
- }*/
+ hmi_message_handler::MessageSharedPointer message) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ if (!message.valid()) {
+ LOG4CXX_ERROR(logger_, "Can`t send not valid message");
+ return;
+ }
Json::Reader reader;
Json::Value json_value;
if (!reader.parse(message->json_message(), json_value, false)) {
- // TODO(PV): LOG4CXX_ERROR(mLogger, "Received invalid json string.");
+ LOG4CXX_ERROR(logger_, "Received invalid json string.");
return;
}
@@ -73,7 +71,7 @@ void MessageBrokerAdapter::SendMessageToHMI(
}
void MessageBrokerAdapter::processResponse(std::string method,
- Json::Value& root) {
+ Json::Value& root) {
LOG4CXX_AUTO_TRACE(logger_);
ProcessRecievedFromMB(root);
}
@@ -95,7 +93,8 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("UI.OnCommand");
MessageBrokerController::subscribeTo("VR.OnCommand");
MessageBrokerController::subscribeTo("BasicCommunication.OnReady");
- MessageBrokerController::subscribeTo("BasicCommunication.OnExitAllApplications");
+ MessageBrokerController::subscribeTo(
+ "BasicCommunication.OnExitAllApplications");
MessageBrokerController::subscribeTo("UI.OnDriverDistraction");
MessageBrokerController::subscribeTo("UI.OnSystemContext");
MessageBrokerController::subscribeTo("UI.OnAppActivated");
@@ -104,15 +103,15 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("UI.OnResetTimeout");
MessageBrokerController::subscribeTo("TTS.OnResetTimeout");
MessageBrokerController::subscribeTo("BasicCommunication.OnAppDeactivated");
- MessageBrokerController::subscribeTo("BasicCommunication.OnStartDeviceDiscovery");
+ MessageBrokerController::subscribeTo(
+ "BasicCommunication.OnStartDeviceDiscovery");
MessageBrokerController::subscribeTo("BasicCommunication.OnUpdateDeviceList");
MessageBrokerController::subscribeTo("BasicCommunication.OnFindApplications");
MessageBrokerController::subscribeTo("BasicCommunication.OnAppActivated");
MessageBrokerController::subscribeTo("BasicCommunication.OnExitApplication");
- MessageBrokerController::subscribeTo("BasicCommunication.OnExitAllApplications");
+ MessageBrokerController::subscribeTo(
+ "BasicCommunication.OnExitAllApplications");
MessageBrokerController::subscribeTo("BasicCommunication.OnDeviceChosen");
- MessageBrokerController::subscribeTo("BasicCommunication.OnPhoneCall");
- MessageBrokerController::subscribeTo("BasicCommunication.OnEmergencyEvent");
MessageBrokerController::subscribeTo("UI.OnLanguageChange");
MessageBrokerController::subscribeTo("VR.OnLanguageChange");
MessageBrokerController::subscribeTo("TTS.OnLanguageChange");
@@ -123,8 +122,10 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("VR.Started");
MessageBrokerController::subscribeTo("VR.Stopped");
MessageBrokerController::subscribeTo("BasicCommunication.OnSystemRequest");
- MessageBrokerController::subscribeTo("BasicCommunication.OnIgnitionCycleOver");
- MessageBrokerController::subscribeTo("BasicCommunication.OnSystemInfoChanged");
+ MessageBrokerController::subscribeTo(
+ "BasicCommunication.OnIgnitionCycleOver");
+ MessageBrokerController::subscribeTo(
+ "BasicCommunication.OnSystemInfoChanged");
MessageBrokerController::subscribeTo("SDL.OnAppPermissionConsent");
MessageBrokerController::subscribeTo("SDL.OnAllowSDLFunctionality");
MessageBrokerController::subscribeTo("SDL.OnReceivedPolicyUpdate");
@@ -132,6 +133,7 @@ void MessageBrokerAdapter::SubscribeTo() {
MessageBrokerController::subscribeTo("SDL.AddStatisticsInfo");
MessageBrokerController::subscribeTo("SDL.OnDeviceStateChanged");
MessageBrokerController::subscribeTo("SDL.OnPolicyUpdate");
+ MessageBrokerController::subscribeTo("BasicCommunication.OnEventChanged");
LOG4CXX_INFO(logger_, "Subscribed to notifications.");
}
@@ -162,8 +164,10 @@ void MessageBrokerAdapter::ProcessRecievedFromMB(Json::Value& root) {
// Messages from HMI (sent through message broker) have no priority so far
// assign default priority
- hmi_message_handler::MessageSharedPointer message = hmi_message_handler::MessageSharedPointer(new application_manager::Message(
- protocol_handler::MessagePriority::kDefault));
+ hmi_message_handler::MessageSharedPointer message =
+ hmi_message_handler::MessageSharedPointer(
+ new application_manager::Message(
+ protocol_handler::MessagePriority::kDefault));
// message->set_message_type()
message->set_json_message(message_string);
message->set_protocol_version(application_manager::ProtocolVersion::kHMI);
diff --git a/src/components/hmi_message_handler/src/mqueue_adapter.cc b/src/components/hmi_message_handler/src/mqueue_adapter.cc
index 825c27c048..ea11c597b3 100644
--- a/src/components/hmi_message_handler/src/mqueue_adapter.cc
+++ b/src/components/hmi_message_handler/src/mqueue_adapter.cc
@@ -75,7 +75,7 @@ class ReceiverThreadDelegate : public threads::ThreadDelegate {
};
MqueueAdapter::MqueueAdapter(HMIMessageHandler* hmi_message_handler)
- : HMIMessageAdapter(hmi_message_handler),
+ : HMIMessageAdapterImpl(hmi_message_handler),
sdl_to_hmi_mqueue_(-1),
hmi_to_sdl_mqueue_(-1),
receiver_thread_(NULL) {
diff --git a/src/components/hmi_message_handler/test/CMakeLists.txt b/src/components/hmi_message_handler/test/CMakeLists.txt
index 4a97e299f0..98e9fd5653 100644
--- a/src/components/hmi_message_handler/test/CMakeLists.txt
+++ b/src/components/hmi_message_handler/test/CMakeLists.txt
@@ -33,17 +33,23 @@ if(BUILD_TESTS)
include_directories (
${GMOCK_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/hmi_message_handler/include
+ ${COMPONENTS_DIR}/hmi_message_handler/test/include
)
set(LIBRARIES
gmock
ApplicationManager
HMIMessageHandler
+ jsoncpp
+ MessageBrokerClient
+ MessageBrokerServer
+ ConfigProfile
)
-set(SOURCES
- ${COMPONENTS_DIR}/hmi_message_handler/test/mqueue_adapter_test.cc
-)
+set(SOURCES
+${COMPONENTS_DIR}/hmi_message_handler/test/hmi_message_handler_impl_test.cc
+${COMPONENTS_DIR}/hmi_message_handler/test/hmi_message_adapter_test.cc
+)
if(${QT_HMI})
list (APPEND SOURCES
diff --git a/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc
new file mode 100644
index 0000000000..3130702559
--- /dev/null
+++ b/src/components/hmi_message_handler/test/hmi_message_adapter_test.cc
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include "utils/shared_ptr.h"
+#include "utils/make_shared.h"
+
+#include "hmi_message_handler/hmi_message_handler_impl.h"
+#include "hmi_message_handler/mock_hmi_message_adapter_impl.h"
+#include "hmi_message_handler/mock_hmi_message_handler_settings.h"
+
+namespace test {
+namespace components {
+namespace hmi_message_handler_test {
+
+using ::testing::ReturnRef;
+using hmi_message_handler::HMIMessageHandlerImpl;
+
+typedef utils::SharedPtr<MockHMIMessageAdapterImpl>
+ MockHMIMessageAdapterImplSPtr;
+
+TEST(HMIMessageAdapterImplTest, Handler_CorrectPointer_CorrectReturnedPointer) {
+ testing::NiceMock<MockHMIMessageHandlerSettings> mock_hmi_message_handler_settings;
+ const uint64_t stack_size =1000u;
+ ON_CALL(mock_hmi_message_handler_settings, thread_min_stack_size())
+ .WillByDefault(ReturnRef(stack_size));
+ HMIMessageHandler* message_handler = new hmi_message_handler::HMIMessageHandlerImpl(
+ mock_hmi_message_handler_settings);;
+
+ MockHMIMessageAdapterImplSPtr message_adapter_impl =
+ utils::MakeShared<MockHMIMessageAdapterImpl>(message_handler);
+
+ EXPECT_EQ(message_handler, message_adapter_impl->get_handler());
+
+ delete message_handler;
+ message_handler = NULL;
+}
+
+TEST(HMIMessageAdapterImplTest, Handler_NULLPointer_CorrectReturnedPointer) {
+ HMIMessageHandler* message_handler = NULL;
+ MockHMIMessageAdapterImplSPtr message_adapter_impl =
+ utils::MakeShared<MockHMIMessageAdapterImpl>(message_handler);
+
+ EXPECT_EQ(NULL, message_adapter_impl->get_handler());
+}
+
+} // namespace hmi_message_helper_test
+} // namespace components
+} // namespace test
diff --git a/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
new file mode 100644
index 0000000000..bf259f80e9
--- /dev/null
+++ b/src/components/hmi_message_handler/test/hmi_message_handler_impl_test.cc
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include "application_manager/message.h"
+#include "hmi_message_handler/hmi_message_handler_impl.h"
+#include "hmi_message_handler/messagebroker_adapter.h"
+#include "hmi_message_handler/mock_hmi_message_observer.h"
+#include "hmi_message_handler/mock_hmi_message_handler_settings.h"
+#include "utils/make_shared.h"
+
+namespace test {
+namespace components {
+namespace hmi_message_handler_test {
+
+using ::testing::ReturnRef;
+class HMIMessageHandlerImplTest : public ::testing::Test {
+ public:
+ HMIMessageHandlerImplTest()
+ : mb_adapter_(NULL),
+ hmi_handler_(NULL),
+ mock_hmi_message_observer_(NULL) {}
+
+ protected:
+ hmi_message_handler::MessageBrokerAdapter* mb_adapter_;
+ hmi_message_handler::HMIMessageHandlerImpl* hmi_handler_;
+ hmi_message_handler::MockHMIMessageObserver* mock_hmi_message_observer_;
+ testing::NiceMock<MockHMIMessageHandlerSettings> mock_hmi_message_handler_settings;
+ const uint64_t stack_size =1000u;
+
+ virtual void SetUp() OVERRIDE {
+ ON_CALL(mock_hmi_message_handler_settings, thread_min_stack_size())
+ .WillByDefault(ReturnRef(stack_size));
+ hmi_handler_ = new hmi_message_handler::HMIMessageHandlerImpl(
+ mock_hmi_message_handler_settings);
+ mb_adapter_ = new hmi_message_handler::MessageBrokerAdapter(
+ hmi_handler_, "localhost", 22);
+ mock_hmi_message_observer_ =
+ new hmi_message_handler::MockHMIMessageObserver();
+ hmi_handler_->set_message_observer(mock_hmi_message_observer_);
+ EXPECT_TRUE(NULL != hmi_handler_->observer());
+ }
+
+ virtual void TearDown() OVERRIDE {
+ hmi_handler_->set_message_observer(NULL);
+ delete mock_hmi_message_observer_;
+ delete hmi_handler_;
+ delete mb_adapter_;
+ }
+};
+
+TEST_F(HMIMessageHandlerImplTest,
+ OnErrorSending_EmptyMessage_OnErrorSendingProceeded) {
+ // Arrange
+ hmi_message_handler::MessageSharedPointer empty_message;
+ EXPECT_CALL(*mock_hmi_message_observer_, OnErrorSending(empty_message));
+ // Act
+ hmi_handler_->OnErrorSending(empty_message);
+}
+
+TEST_F(HMIMessageHandlerImplTest,
+ OnErrorSending_NotEmptyMessage_ExpectOnErrorSendingProceeded) {
+ // Arrange
+ utils::SharedPtr<application_manager::Message> message(
+ utils::MakeShared<application_manager::Message>(
+ protocol_handler::MessagePriority::FromServiceType(
+ protocol_handler::ServiceType::kControl)));
+
+ EXPECT_CALL(*mock_hmi_message_observer_, OnErrorSending(message));
+ // Act
+ hmi_handler_->OnErrorSending(message);
+}
+
+TEST_F(HMIMessageHandlerImplTest,
+ AddHMIMessageAdapter_AddExistedAdapter_ExpectAdded) {
+ // Check before action
+ EXPECT_TRUE(hmi_handler_->message_adapters().empty());
+ // Act
+ hmi_handler_->AddHMIMessageAdapter(mb_adapter_);
+ // Check after action
+ EXPECT_EQ(1u, hmi_handler_->message_adapters().size());
+}
+
+TEST_F(HMIMessageHandlerImplTest,
+ AddHMIMessageAdapter_AddUnexistedAdapter_ExpectNotAdded) {
+ // Check before action
+ EXPECT_TRUE(hmi_handler_->message_adapters().empty());
+ // Act
+ mb_adapter_ = NULL;
+ hmi_handler_->AddHMIMessageAdapter(mb_adapter_);
+ // Check adapter not added
+ EXPECT_TRUE(hmi_handler_->message_adapters().empty());
+}
+
+TEST_F(HMIMessageHandlerImplTest, RemoveHMIMessageAdapter_ExpectRemoved) {
+ // Arrange
+ hmi_handler_->AddHMIMessageAdapter(mb_adapter_);
+ // Act
+ hmi_handler_->RemoveHMIMessageAdapter(mb_adapter_);
+ // Check after action
+ EXPECT_TRUE(hmi_handler_->message_adapters().empty());
+}
+
+} // namespace hmi_message_handler_test
+} // namespace components
+} // namespace test
diff --git a/src/components/media_manager/test/media_adapter_impl_test.cc b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h
index f6a6ffa518..0ec82b7862 100644
--- a/src/components/media_manager/test/media_adapter_impl_test.cc
+++ b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_adapter_impl.h
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, Ford Motor Company
+* Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -31,7 +31,30 @@
*/
#include "gmock/gmock.h"
+#include "hmi_message_handler/hmi_message_adapter_impl.h"
+#include "hmi_message_handler/hmi_message_handler.h"
-TEST(MediaAdapterImplTest, DummyTest) {
- ASSERT_TRUE(true);
-}
+namespace test {
+namespace components {
+namespace hmi_message_handler_test {
+
+using hmi_message_handler::HMIMessageAdapterImpl;
+using hmi_message_handler::HMIMessageHandler;
+using hmi_message_handler::MessageSharedPointer;
+
+class MockHMIMessageAdapterImpl : public HMIMessageAdapterImpl {
+ public:
+ MockHMIMessageAdapterImpl(HMIMessageHandler* handler)
+ : HMIMessageAdapterImpl(handler) {}
+
+ MOCK_METHOD0(SubscribeTo, void());
+ MOCK_METHOD1(SendMessageToHMI, void(MessageSharedPointer SPtr));
+
+ HMIMessageHandler* get_handler() {
+ return HMIMessageAdapterImpl::handler();
+ }
+};
+
+} // namespace hmi_message_handler_test
+} // namespace components
+} // namespace test
diff --git a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_observer.h b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_observer.h
new file mode 100644
index 0000000000..cee922cdaa
--- /dev/null
+++ b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_hmi_message_observer.h
@@ -0,0 +1,58 @@
+/*
+* Copyright (c) 2015, Ford Motor Company
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of the Ford Motor Company nor the names of its contributors
+* may be used to endorse or promote products derived from this software
+* without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#ifndef SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
+#define SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include "utils/shared_ptr.h"
+#include "utils/singleton.h"
+#include "hmi_message_handler/hmi_message_observer.h"
+#include "application_manager/message.h"
+
+namespace hmi_message_handler {
+
+using ::hmi_message_handler::HMIMessageObserver;
+
+class MockHMIMessageObserver : public HMIMessageObserver,
+ public utils::Singleton<MockHMIMessageObserver> {
+ public:
+ MOCK_METHOD1(OnMessageReceived,
+ void(utils::SharedPtr<application_manager::Message> message));
+ MOCK_METHOD1(OnErrorSending,
+ void(utils::SharedPtr<application_manager::Message> message));
+ virtual ~MockHMIMessageObserver() {}
+};
+} // namespace hmi_message_handler
+
+
+#endif // SRC_COMPONENTS_HMI_MESSAGE_HANDLER_TEST_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_OBSERVER_H_
diff --git a/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.cc b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.cc
new file mode 100644
index 0000000000..3f1235bea9
--- /dev/null
+++ b/src/components/hmi_message_handler/test/include/hmi_message_handler/mock_subscriber.cc
@@ -0,0 +1,81 @@
+/**
+* Copyright (c) 2014, Ford Motor Company
+* All rights reserved.
+*
+* Redistribution and use in source and binary forms, with or without
+* modification, are permitted provided that the following conditions are met:
+*
+* Redistributions of source code must retain the above copyright notice, this
+* list of conditions and the following disclaimer.
+*
+* Redistributions in binary form must reproduce the above copyright notice,
+* this list of conditions and the following
+* disclaimer in the documentation and/or other materials provided with the
+* distribution.
+*
+* Neither the name of the Ford Motor Company nor the names of its contributors
+* may be used to endorse or promote products derived from this software
+* without specific prior written permission.
+*
+* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*/
+
+#include <dbus/dbus.h>
+#include "include/mock_subscriber.h"
+
+
+namespace test {
+namespace components {
+namespace hmi_message_handler {
+
+MockSubscriber::MockSubscriber(
+ const std::string & nameService, const std::string & path)
+ : nameService_(nameService),
+ path_(path),
+ conn_(NULL) {
+}
+
+MockSubscriber::~MockSubscriber() {
+}
+
+void MockSubscriber::Receive() {
+}
+
+bool MockSubscriber::Start() {
+ DBusError err;
+ //int ret;
+ dbus_error_init(&err);
+ conn_ = dbus_bus_get(DBUS_BUS_SESSION, &err);
+ if (dbus_error_is_set(&err)) {
+ dbus_error_free(&err);
+ return false;
+ }
+
+
+ std::string rule = "type='signal',interface='" + nameService_ + "'";
+ dbus_bus_add_match(conn_, rule.c_str(), &err);
+ dbus_connection_flush(conn_);
+ if (dbus_error_is_set(&err)) {
+ dbus_error_free(&err);
+ return false;
+ }
+ return true;
+}
+
+void MockSubscriber::Send(const std::string& message) {
+ // int a = message.length();
+}
+
+} // namespace hmi_message_handler
+} // namespace components
+} // namespace test
diff --git a/src/components/include/connection_handler/connection_handler_settings.h b/src/components/include/connection_handler/connection_handler_settings.h
new file mode 100644
index 0000000000..a0984b5320
--- /dev/null
+++ b/src/components/include/connection_handler/connection_handler_settings.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_SETTINGS_H_
+#include <stdint.h>
+#include <vector>
+
+namespace connection_handler {
+
+/**
+ * \class ConnectionHandlerSettings
+ * \brief Interface for connection handler component settings.
+ */
+class ConnectionHandlerSettings {
+ public:
+ virtual ~ConnectionHandlerSettings() {}
+
+ virtual uint32_t heart_beat_timeout() const = 0;
+#ifdef ENABLE_SECURITY
+ virtual const std::vector<int>& force_protected_service() const = 0;
+ virtual const std::vector<int>& force_unprotected_service() const = 0;
+#endif // ENABLE_SECURITY
+};
+
+} // namespace connection_handler
+#endif // SRC_COMPONENTS_INCLUDE_CONNECTION_HANDLER_CONNECTION_HANDLER_SETTINGS_H_
diff --git a/src/components/include/hmi_message_handler/hmi_message_handler_settings.h b/src/components/include/hmi_message_handler/hmi_message_handler_settings.h
new file mode 100644
index 0000000000..5386869555
--- /dev/null
+++ b/src/components/include/hmi_message_handler/hmi_message_handler_settings.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_SETTINGS_H_
+
+#include <stdint.h>
+
+namespace hmi_message_handler {
+/**
+ * \class HMIMessageHandlerSettings
+ * \brief Interface for hmi message handler component settings.
+ */
+class HMIMessageHandlerSettings {
+ public:
+ virtual ~HMIMessageHandlerSettings() {}
+
+ virtual const uint64_t& thread_min_stack_size() const = 0;
+};
+} // namespace hmi_message_handler
+#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_HMI_MESSAGE_HANDLER_SETTINGS_H_
diff --git a/src/components/include/protocol_handler/protocol_handler.h b/src/components/include/protocol_handler/protocol_handler.h
index 9bb77ae483..d124f5ab8f 100644
--- a/src/components/include/protocol_handler/protocol_handler.h
+++ b/src/components/include/protocol_handler/protocol_handler.h
@@ -33,6 +33,7 @@
#define SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_H_
#include "protocol/common.h"
+#include "protocol_handler/protocol_handler_settings.h"
/**
*\namespace protocol_handlerHandler
@@ -100,6 +101,11 @@ class ProtocolHandler {
virtual void SendEndService(int32_t connection_id,
uint8_t session_id,
uint8_t service_type) = 0;
+ /**
+ * \brief Protocol handler settings getter
+ * \return pointer to protocol handler settings class
+ */
+ virtual const ProtocolHandlerSettings& get_settings() const = 0;
protected:
/**
diff --git a/src/components/include/protocol_handler/protocol_handler_settings.h b/src/components/include/protocol_handler/protocol_handler_settings.h
new file mode 100644
index 0000000000..987b0ac449
--- /dev/null
+++ b/src/components/include/protocol_handler/protocol_handler_settings.h
@@ -0,0 +1,47 @@
+#ifndef SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_SETTINGS_H_
+
+#include <cstdint>
+#include <string>
+#include <vector>
+
+namespace protocol_handler {
+/**
+ * \class ProtocolHandlerSettings
+ * \brief Interface for protocol handler component settings.
+ */
+class ProtocolHandlerSettings {
+ public:
+ virtual ~ProtocolHandlerSettings() {}
+
+ virtual size_t maximum_payload_size() const = 0;
+ virtual size_t message_frequency_count() const = 0;
+ virtual size_t message_frequency_time() const = 0;
+ virtual bool malformed_message_filtering() const = 0;
+ virtual size_t malformed_frequency_count() const = 0;
+ virtual size_t malformed_frequency_time() const = 0;
+ /*
+ * @brief Heartbeat timeout before closing connection
+ */
+ virtual uint32_t heart_beat_timeout() const = 0;
+
+ virtual uint16_t max_supported_protocol_version() const = 0;
+ /*
+ * @brief Protocol version, from .ini file.
+ */
+ virtual bool enable_protocol_4() const = 0;
+
+ virtual uint32_t multiframe_waiting_timeout() const = 0;
+#ifdef ENABLE_SECURITY
+ /**
+ * @brief Returns force protected services
+ */
+ virtual const std::vector<int>& force_protected_service() const = 0;
+ /**
+ * @brief Returns force unprotected services
+ */
+ virtual const std::vector<int>& force_unprotected_service() const = 0;
+#endif // ENABLE_SECURITY
+};
+} // namespace protocol_handler
+#endif // SRC_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_SETTINGS_H_
diff --git a/src/components/include/protocol_handler/session_observer.h b/src/components/include/protocol_handler/session_observer.h
index 355c62e646..cbc0555425 100644
--- a/src/components/include/protocol_handler/session_observer.h
+++ b/src/components/include/protocol_handler/session_observer.h
@@ -53,6 +53,7 @@ enum {
HASH_ID_NOT_SUPPORTED = 0,
HASH_ID_WRONG = 0xFFFF0000
};
+
/**
* \class SessionObserver
* \brief Interface for making a bridge between ProtocolHandler and
@@ -75,10 +76,11 @@ class SessionObserver {
* \return uint32_t Id (number) of new session if successful, otherwise 0.
*/
virtual uint32_t OnSessionStartedCallback(
- const transport_manager::ConnectionUID &connection_handle,
+ const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const protocol_handler::ServiceType &service_type,
const bool is_protected, uint32_t* hash_id) = 0;
+
/**
* \brief Callback function used by ProtocolHandler
* when Mobile Application initiates session ending.
@@ -90,7 +92,7 @@ class SessionObserver {
* \return uint32_t 0 if operation fails, session key otherwise
*/
virtual uint32_t OnSessionEndedCallback(
- const transport_manager::ConnectionUID &connection_handle,
+ const transport_manager::ConnectionUID connection_handle,
const uint8_t sessionId,
const uint32_t &hashCode,
const protocol_handler::ServiceType &service_type) = 0;
@@ -119,7 +121,7 @@ class SessionObserver {
*/
virtual uint32_t KeyFromPair(
transport_manager::ConnectionUID connection_handle,
- uint8_t session_id) = 0;
+ uint8_t session_id) const = 0;
/**
* \brief Returns connection identifier and session number from given
@@ -131,7 +133,7 @@ class SessionObserver {
virtual void PairFromKey(
uint32_t key,
transport_manager::ConnectionUID *connection_handle,
- uint8_t *sessionId) = 0;
+ uint8_t *sessionId) const = 0;
/**
* \brief information about given Connection Key.
@@ -144,7 +146,7 @@ class SessionObserver {
virtual int32_t GetDataOnSessionKey(uint32_t key,
uint32_t *app_id,
std::list<int32_t> *sessions_list,
- uint32_t *device_id) = 0;
+ uint32_t *device_id) const = 0;
/**
* \brief information about device
@@ -155,11 +157,12 @@ class SessionObserver {
* \param connection_type Returned: type of connection (USB, BT, etc.)
* \return int32_t -1 in case of error or 0 in case of success
*/
- virtual int32_t GetDataOnDeviceID(uint32_t device_handle,
- std::string *device_name,
- std::list<uint32_t> *applications_list,
- std::string *mac_address,
- std::string *connection_type) = 0;
+ virtual int32_t GetDataOnDeviceID(
+ transport_manager::DeviceHandle device_handle,
+ std::string *device_name = NULL,
+ std::list<uint32_t> *applications_list = NULL,
+ std::string *mac_address = NULL,
+ std::string *connection_type = NULL) const = 0;
/**
* \brief returns TRUE if session supports sending HEARTBEAT ACK to mobile side
@@ -169,7 +172,7 @@ class SessionObserver {
*/
virtual bool IsHeartBeatSupported(
transport_manager::ConnectionUID connection_handle,
- uint8_t session_id) = 0;
+ uint8_t session_id) const = 0;
/**
* @brief returns protocol version which application supports
@@ -179,7 +182,7 @@ class SessionObserver {
* @return TRUE if session and connection exist otherwise returns FALSE
*/
virtual bool ProtocolVersionUsed(uint32_t connection_id,
- uint8_t session_id, uint8_t& protocol_version) = 0;
+ uint8_t session_id, uint8_t& protocol_version) const = 0;
#ifdef ENABLE_SECURITY
@@ -212,6 +215,9 @@ class SessionObserver {
virtual void SetProtectionFlag(
const uint32_t &key,
const protocol_handler::ServiceType &service_type) = 0;
+
+ virtual security_manager::SSLContext::HandshakeContext
+ GetHandshakeContext(uint32_t key) const = 0;
#endif // ENABLE_SECURITY
protected:
diff --git a/src/components/include/security_manager/crypto_manager.h b/src/components/include/security_manager/crypto_manager.h
index 00c3833e62..ed0db50f36 100644
--- a/src/components/include/security_manager/crypto_manager.h
+++ b/src/components/include/security_manager/crypto_manager.h
@@ -30,10 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
-#define SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
-#include <string>
+#include "application_manager/policies/policy_handler_observer.h"
+#include "security_manager/security_manager_settings.h"
/**
* \class security_manager::CryptoManager
@@ -49,23 +50,27 @@
namespace security_manager {
class SSLContext;
-enum Mode { CLIENT, SERVER };
-enum Protocol { SSLv3, TLSv1, TLSv1_1, TLSv1_2};
-
-class CryptoManager {
+class CryptoManager: public policy::PolicyHandlerObserver{
public:
- virtual bool Init(Mode mode,
- Protocol protocol,
- const std::string &cert_filename,
- const std::string &key_filename,
- const std::string &ciphers_list,
- bool verify_peer) = 0;
- virtual void Finish() = 0;
+ /**
+ * @brief Init allows to initialize cryptomanager with certain values.
+ *
+ * @return true in case initialization was succesfull, false otherwise.
+ */
+ virtual bool Init() = 0;
virtual SSLContext *CreateSSLContext() = 0;
+ virtual bool OnCertificateUpdated(const std::string& data) = 0;
virtual void ReleaseSSLContext(SSLContext *context) = 0;
virtual std::string LastError() const = 0;
+
+ virtual bool IsCertificateUpdateRequired() const = 0;
+ /**
+ * \brief Crypto manager settings getter
+ * \return pointer to crypto manager settings class
+ */
+ virtual const CryptoManagerSettings& get_settings() const = 0;
virtual ~CryptoManager() { }
};
} // namespace security_manager
-#endif // SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
+#endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_H_
diff --git a/src/components/include/security_manager/security_manager.h b/src/components/include/security_manager/security_manager.h
index 252ec610a8..97b1ffc065 100644
--- a/src/components/include/security_manager/security_manager.h
+++ b/src/components/include/security_manager/security_manager.h
@@ -40,10 +40,11 @@
#include "protocol_handler/protocol_observer.h"
#include "protocol_handler/session_observer.h"
-#include "security_manager/crypto_manager.h"
#include "security_manager/security_manager_listener.h"
namespace security_manager {
+
+class CryptoManager;
/**
* \brief SecurityManager interface implements protocol_handler::ProtocolObserver
* and provide interface for handling Security queries from mobile side
@@ -67,7 +68,7 @@ class SecurityManager
ERROR_ENCRYPTION_FAILED = 0x07,
ERROR_SSL_INVALID_DATA = 0x08,
ERROR_INTERNAL = 0xFF,
- ERROR_UNKWOWN_INTERNAL_ERROR = 0xFE // error valeu for testing
+ ERROR_UNKNOWN_INTERNAL_ERROR = 0xFE // error value for testing
};
/**
* \brief Sets pointer for Connection Handler layer for managing sessions
diff --git a/src/components/include/security_manager/security_manager_listener.h b/src/components/include/security_manager/security_manager_listener.h
index 14a5dc3281..6cf6e8f7ed 100644
--- a/src/components/include/security_manager/security_manager_listener.h
+++ b/src/components/include/security_manager/security_manager_listener.h
@@ -42,7 +42,11 @@ class SecurityManagerListener {
* \return \c true on success notification or \c false otherwise
*/
virtual bool OnHandshakeDone(uint32_t connection_key,
- bool success) = 0;
+ SSLContext::HandshakeResult result) = 0;
+ /**
+ * @brief Notify listeners that certificate update is required.
+ */
+ virtual void OnCertificateUpdateRequired() = 0;
virtual ~SecurityManagerListener() {}
};
} // namespace security_manager
diff --git a/src/components/include/security_manager/security_manager_settings.h b/src/components/include/security_manager/security_manager_settings.h
new file mode 100644
index 0000000000..70f0452ef2
--- /dev/null
+++ b/src/components/include/security_manager/security_manager_settings.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_SUCURITY_MANAGER_SUCURITY_MANAGER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_SUCURITY_MANAGER_SUCURITY_MANAGER_SETTINGS_H_
+
+namespace security_manager {
+enum Mode { CLIENT, SERVER };
+enum Protocol { SSLv3, TLSv1, TLSv1_1, TLSv1_2 };
+/**
+ * \class ConnectionHandlerSettings
+ * \brief Interface for connection handler component settings.
+ */
+class CryptoManagerSettings {
+ public:
+ virtual ~CryptoManagerSettings() {}
+
+ virtual Mode security_manager_mode() const = 0;
+ virtual Protocol security_manager_protocol_name() const = 0;
+ virtual bool verify_peer() const = 0;
+ virtual const std::string& certificate_data() const = 0;
+ virtual const std::string& ciphers_list() const = 0;
+ virtual const std::string& ca_cert_path() const = 0;
+ virtual size_t update_before_hours() const = 0;
+ virtual size_t maximum_payload_size() const = 0;
+};
+
+} // namespace security_manager
+#endif // SRC_COMPONENTS_INCLUDE_SUCURITY_MANAGER_SUCURITY_MANAGER_SETTINGS_H_
diff --git a/src/components/include/security_manager/ssl_context.h b/src/components/include/security_manager/ssl_context.h
index e3f1dadc4f..1149accaed 100644
--- a/src/components/include/security_manager/ssl_context.h
+++ b/src/components/include/security_manager/ssl_context.h
@@ -35,6 +35,9 @@
#include <cstddef> // for size_t typedef
#include <string>
+#include <ctype.h>
+#include <algorithm>
+#include "utils/custom_string.h"
// TODO(EZamakhov): update brief info
/**
@@ -53,33 +56,60 @@
*
* \param in_data [in] data sent by other side
* \param in_data_size [in] size of data in \ref in_data buffer
- * \param out_data [out] response of SSL context if there is one. If not, equals NULL
+ * \param out_data [out] response of SSL context if there is one. If not,
+ * equals NULL
* \param out_data_size [out] length of response. On no response, equals 0
*/
namespace security_manager {
+namespace custom_str = utils::custom_string;
class SSLContext {
public:
enum HandshakeResult {
- Handshake_Result_Success = 0x0,
- Handshake_Result_Fail = 0x1,
- Handshake_Result_AbnormalFail = 0x2
+ Handshake_Result_Success,
+ Handshake_Result_Fail,
+ Handshake_Result_AbnormalFail,
+ Handshake_Result_CertExpired,
+ Handshake_Result_NotYetValid,
+ Handshake_Result_CertNotSigned,
+ Handshake_Result_AppIDMismatch,
+ Handshake_Result_AppNameMismatch,
};
+
+ struct HandshakeContext {
+ custom_str::CustomString expected_sn;
+ custom_str::CustomString expected_cn;
+
+ HandshakeContext& make_context(const custom_str::CustomString& sn,
+ const custom_str::CustomString& cn) {
+ expected_sn = sn;
+ expected_cn = cn;
+ return *this;
+ }
+ };
+
virtual HandshakeResult StartHandshake(const uint8_t** const out_data,
- size_t *out_data_size) = 0;
- virtual HandshakeResult DoHandshakeStep(const uint8_t *const in_data,
+ size_t* out_data_size) = 0;
+ virtual HandshakeResult DoHandshakeStep(const uint8_t* const in_data,
size_t in_data_size,
const uint8_t** const out_data,
- size_t *out_data_size) = 0;
- virtual bool Encrypt(const uint8_t *const in_data, size_t in_data_size,
- const uint8_t ** const out_data, size_t *out_data_size) = 0;
- virtual bool Decrypt(const uint8_t *const in_data, size_t in_data_size,
- const uint8_t ** const out_data, size_t *out_data_size) = 0;
- virtual bool IsInitCompleted() const = 0;
- virtual bool IsHandshakePending() const = 0;
+ size_t* out_data_size) = 0;
+ virtual bool Encrypt(const uint8_t* const in_data,
+ size_t in_data_size,
+ const uint8_t** const out_data,
+ size_t* out_data_size) = 0;
+ virtual bool Decrypt(const uint8_t* const in_data,
+ size_t in_data_size,
+ const uint8_t** const out_data,
+ size_t* out_data_size) = 0;
+ virtual bool IsInitCompleted() const = 0;
+ virtual bool IsHandshakePending() const = 0;
virtual size_t get_max_block_size(size_t mtu) const = 0;
virtual std::string LastError() const = 0;
- virtual ~SSLContext() { }
+
+ virtual void ResetConnection() = 0;
+ virtual void SetHandshakeContext(const HandshakeContext& hsh_ctx) = 0;
+ virtual ~SSLContext() {}
};
} // namespace security_manager
#endif // SRC_COMPONENTS_INCLUDE_SECURITY_MANAGER_SSL_CONTEXT_H_
diff --git a/src/components/include/telemetry_monitor/telemetry_observable.h b/src/components/include/telemetry_monitor/telemetry_observable.h
new file mode 100644
index 0000000000..eb3ff94212
--- /dev/null
+++ b/src/components/include/telemetry_monitor/telemetry_observable.h
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_RESOURCE_OBSERVEABLE_H
+#define SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_RESOURCE_OBSERVEABLE_H
+namespace telemetry_monitor {
+
+template <class TelemetryObserver>
+class TelemetryObservable {
+public:
+ virtual void SetTelemetryObserver(TelemetryObserver* observer) = 0;
+};
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_RESOURCE_OBSERVEABLE_H
diff --git a/src/components/include/test/connection_handler/mock_connection_handler.h b/src/components/include/test/connection_handler/mock_connection_handler.h
new file mode 100644
index 0000000000..e96825d9a8
--- /dev/null
+++ b/src/components/include/test/connection_handler/mock_connection_handler.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_H_
+
+#include <string>
+#include <list>
+#include <vector>
+
+#include "gmock/gmock.h"
+#include "connection_handler/connection_handler.h"
+#include "connection_handler/connection_handler_observer.h"
+#include "connection_handler/devices_discovery_starter.h"
+#include "connection_handler/connection_handler_settings.h"
+
+namespace test {
+namespace components {
+namespace connection_handler_test {
+
+using connection_handler::ConnectionHandle;
+using connection_handler::DeviceHandle;
+using connection_handler::CloseSessionReason;
+using connection_handler::DevicesDiscoveryStarter;
+
+
+class MockConnectionHandler : public connection_handler::ConnectionHandler {
+ public:
+ MOCK_METHOD1(set_connection_handler_observer,
+ void(connection_handler::ConnectionHandlerObserver* observer));
+ MOCK_METHOD0(StartTransportManager,
+ void());
+ MOCK_METHOD1(ConnectToDevice,
+ void(connection_handler::DeviceHandle device_handle));
+ MOCK_METHOD0(ConnectToAllDevices,
+ void());
+ MOCK_METHOD1(CloseRevokedConnection,
+ void(uint32_t connection_key));
+ MOCK_METHOD1(CloseConnection,
+ void(ConnectionHandle connection_handle));
+ MOCK_METHOD1(GetConnectionSessionsCount,
+ uint32_t(uint32_t connection_key));
+ MOCK_METHOD2(GetDeviceID,
+ bool(const std::string& mac_address, DeviceHandle* device_handle));
+ MOCK_METHOD2(CloseSession,
+ void(uint32_t key, CloseSessionReason close_reason));
+ MOCK_METHOD3(CloseSession,
+ void(ConnectionHandle connection_handle,
+ uint8_t session_id,
+ CloseSessionReason close_reason));
+ MOCK_METHOD2(SendEndService,
+ void(uint32_t key, uint8_t service_type));
+ MOCK_METHOD1(StartSessionHeartBeat,
+ void(uint32_t connection_key));
+ MOCK_METHOD2(SendHeartBeat,
+ void(ConnectionHandle connection_handle, uint8_t session_id));
+ MOCK_METHOD2(SetHeartBeatTimeout,
+ void(uint32_t connection_key, uint32_t timeout));
+ MOCK_METHOD2(KeepConnectionAlive,
+ void(uint32_t connection_key, uint8_t session_id));
+ MOCK_METHOD2(BindProtocolVersionWithSession,
+ void(uint32_t connection_key, uint8_t protocol_version));
+ MOCK_CONST_METHOD4(GetDataOnSessionKey,
+ int32_t(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id));
+ MOCK_CONST_METHOD0(get_settings,
+ const connection_handler::ConnectionHandlerSettings&());
+ MOCK_METHOD0(get_session_observer,
+ const protocol_handler::SessionObserver&());
+ MOCK_METHOD0(get_device_discovery_starter,
+ DevicesDiscoveryStarter&());
+ MOCK_CONST_METHOD1(GetConnectedDevicesMAC,
+ void(std::vector<std::string>& macs));
+};
+
+
+} // namespace connection_handler_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_H_
diff --git a/src/components/transport_manager/test/include/mock_transport_adapter.h b/src/components/include/test/connection_handler/mock_connection_handler_settings.h
index 85f0da76dc..6f4b86f5cc 100644
--- a/src/components/transport_manager/test/include/mock_transport_adapter.h
+++ b/src/components/include/test/connection_handler/mock_connection_handler_settings.h
@@ -1,8 +1,5 @@
/*
- * \file mock_transport_adapter.h
- * \brief
- *
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,30 +30,30 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICEADAPTER_H_
-#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICEADAPTER_H_
-
-#include "transport_manager/transport_adapter/transport_adapter_impl.h"
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_SETTINGS_H_
-using ::transport_manager::transport_adapter::TransportAdapterImpl;
-using ::transport_manager::transport_adapter::DeviceType;
+#include <vector>
+#include "gmock/gmock.h"
+#include "connection_handler/connection_handler_settings.h"
namespace test {
namespace components {
-namespace transport_manager {
-
-class MockDeviceScanner;
+namespace connection_handler_test {
-class MockTransportAdapter : public TransportAdapterImpl {
+class MockConnectionHandlerSettings
+ : public connection_handler::ConnectionHandlerSettings {
public:
- MockTransportAdapter();
- MockDeviceScanner* get_device_scanner() const;
- DeviceType GetDeviceType() const { return DeviceType::UNKNOWN; }
- void reset();
+ MOCK_CONST_METHOD0(heart_beat_timeout,
+ uint32_t());
+ MOCK_CONST_METHOD0(force_protected_service,
+ const std::vector<int>&());
+ MOCK_CONST_METHOD0(force_unprotected_service,
+ const std::vector<int>&());
};
-} // namespace transport_manager
+} // namespace connection_handler_test
} // namespace components
} // namespace test
-#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICEADAPTER_H_ */
+#endif // SRC_COMPONENTS_INCLUDE_TEST_CONNECTION_HANDLER_MOCK_CONNECTION_HANDLER_SETTINGS_H_
diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h
new file mode 100644
index 0000000000..9c5ed916ac
--- /dev/null
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_H_
+
+#include "gmock/gmock.h"
+#include "hmi_message_handler/hmi_message_handler.h"
+
+namespace test {
+namespace components {
+namespace hmi_message_handler_test {
+
+using hmi_message_handler::HMIMessageAdapter;
+
+class MockHMIMessageHandler : public ::hmi_message_handler::HMIMessageHandler {
+ public:
+ MOCK_METHOD1(AddHMIMessageAdapter, void(HMIMessageAdapter* adapter));
+ MOCK_METHOD1(RemoveHMIMessageAdapter, void(HMIMessageAdapter* adapter));
+};
+} // namespace hmi_message_handler_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_H_
diff --git a/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h
new file mode 100644
index 0000000000..a3f73ac965
--- /dev/null
+++ b/src/components/include/test/hmi_message_handler/mock_hmi_message_handler_settings.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
+
+#include <stdint.h>
+#include "gmock/gmock.h"
+#include "hmi_message_handler/hmi_message_handler_settings.h"
+
+namespace test {
+namespace components {
+namespace hmi_message_handler_test {
+
+class MockHMIMessageHandlerSettings
+ : public ::hmi_message_handler::HMIMessageHandlerSettings {
+ public:
+ MOCK_CONST_METHOD0(thread_min_stack_size, const uint64_t&());
+};
+} // namespace hmi_message_handler_test
+} // namespace components
+} // namespace test
+#endif // SRC_COMPONENTS_INCLUDE_HMI_MESSAGE_HANDLER_MOCK_HMI_MESSAGE_HANDLER_SETTINGS_H_
diff --git a/src/components/include/test/protocol_handler/mock_protocol_handler.h b/src/components/include/test/protocol_handler/mock_protocol_handler.h
new file mode 100644
index 0000000000..36dd61baa8
--- /dev/null
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_H_
+
+#include "gmock/gmock.h"
+#include "protocol_handler/protocol_packet.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/protocol_handler_settings.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+class MockProtocolHandler : public ::protocol_handler::ProtocolHandler {
+ public:
+ MOCK_METHOD2(SendMessageToMobileApp,
+ void(const ::protocol_handler::RawMessagePtr message,
+ bool final_message));
+ MOCK_METHOD1(AddProtocolObserver,
+ void(::protocol_handler::ProtocolObserver* observer));
+ MOCK_METHOD1(RemoveProtocolObserver,
+ void(::protocol_handler::ProtocolObserver* observer));
+ MOCK_METHOD2(SendFramesNumber,
+ void(uint32_t connection_key, int32_t number_of_frames));
+ MOCK_METHOD2(SendHeartBeat, void(int32_t connection_id, uint8_t session_id));
+ MOCK_METHOD2(SendEndSession, void(int32_t connection_id, uint8_t session_id));
+ MOCK_METHOD3(SendEndService, void(int32_t connection_id, uint8_t session_id,
+ uint8_t service_type));
+ MOCK_CONST_METHOD0(get_settings,
+ protocol_handler::ProtocolHandlerSettings &());
+};
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_H_
diff --git a/src/components/transport_manager/test/include/mock_connection_factory.h b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
index afead19cb6..c3e4ec1ddd 100644
--- a/src/components/transport_manager/test/include/mock_connection_factory.h
+++ b/src/components/include/test/protocol_handler/mock_protocol_handler_settings.h
@@ -1,8 +1,5 @@
/*
- * \file mock_connection_factory.h
- * \brief
- *
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,38 +29,48 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_SETTINGS_H_
-#ifndef APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTIONFACTORY_H_
-#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTIONFACTORY_H_
-
-#include "transport_manager/transport_adapter/server_connection_factory.h"
-
-using ::transport_manager::ApplicationHandle;
-using ::transport_manager::DeviceHandle;
-using ::transport_manager::transport_adapter::TransportAdapter;
-using ::transport_manager::transport_adapter::ServerConnectionFactory;
+#include "gmock/gmock.h"
+#include "protocol_handler/protocol_handler_settings.h"
namespace test {
namespace components {
-namespace transport_manager {
+namespace protocol_handler_test {
-class MockTransportAdapter;
-
-class MockConnectionFactory : public ServerConnectionFactory {
+class MockProtocolHandlerSettings : public protocol_handler::ProtocolHandlerSettings {
public:
- MockConnectionFactory(MockTransportAdapter *adapter);
- TransportAdapter::Error Init() { return TransportAdapter::OK; }
- TransportAdapter::Error CreateConnection(const ::transport_manager::DeviceUID& device_handle,
- const ApplicationHandle& app_handle);
- void Terminate() {}
- bool IsInitialised() const { return true; }
-
- private:
- MockTransportAdapter *controller_;
+ MOCK_CONST_METHOD0(maximum_payload_size,
+ size_t());
+ MOCK_CONST_METHOD0(message_frequency_count,
+ size_t());
+ MOCK_CONST_METHOD0(message_frequency_time,
+ size_t());
+ MOCK_CONST_METHOD0(malformed_message_filtering,
+ bool());
+ MOCK_CONST_METHOD0(malformed_frequency_count,
+ size_t());
+ MOCK_CONST_METHOD0(malformed_frequency_time,
+ size_t());
+ MOCK_CONST_METHOD0(heart_beat_timeout,
+ uint32_t());
+ MOCK_CONST_METHOD0(max_supported_protocol_version,
+ uint16_t());
+ MOCK_CONST_METHOD0(enable_protocol_4,
+ bool());
+ MOCK_CONST_METHOD0(multiframe_waiting_timeout,
+ uint32_t());
+#ifdef ENABLE_SECURITY
+ MOCK_CONST_METHOD0(force_protected_service,
+ const std::vector<int>&());
+ MOCK_CONST_METHOD0(force_unprotected_service,
+ const std::vector<int>&());
+#endif
};
-} // namespace transport_manager
+} // namespace protocol_handler_test
} // namespace components
} // namespace test
-#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTIONFACTORY_H_ */
+#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_PROTOCOL_HANDLER_SETTINGS_H_
diff --git a/src/components/include/test/protocol_handler/mock_session_observer.h b/src/components/include/test/protocol_handler/mock_session_observer.h
new file mode 100644
index 0000000000..994c78b961
--- /dev/null
+++ b/src/components/include/test/protocol_handler/mock_session_observer.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
+#define TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
+
+#include <gmock/gmock.h>
+#include <string>
+#include <list>
+#include "protocol_handler/session_observer.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+/*
+ * MOCK implementation of ::protocol_handler::SessionObserver interface
+ */
+class MockSessionObserver : public ::protocol_handler::SessionObserver {
+ public:
+ MOCK_METHOD5(
+ OnSessionStartedCallback,
+ uint32_t(const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ const protocol_handler::ServiceType& service_type,
+ const bool is_protected,
+ uint32_t* hash_id));
+ MOCK_METHOD4(
+ OnSessionEndedCallback,
+ uint32_t(const transport_manager::ConnectionUID connection_handle,
+ const uint8_t sessionId,
+ const uint32_t& hashCode,
+ const protocol_handler::ServiceType& service_type));
+ MOCK_METHOD1(OnApplicationFloodCallBack,
+ void(const uint32_t& connection_key));
+ MOCK_METHOD1(OnMalformedMessageCallback,
+ void(const uint32_t& connection_key));
+ MOCK_CONST_METHOD2(
+ KeyFromPair,
+ uint32_t(transport_manager::ConnectionUID connection_handle,
+ uint8_t session_id));
+ MOCK_CONST_METHOD3(PairFromKey,
+ void(uint32_t key,
+ transport_manager::ConnectionUID* connection_handle,
+ uint8_t* sessionId));
+ MOCK_CONST_METHOD4(GetDataOnSessionKey,
+ int32_t(uint32_t key,
+ uint32_t* app_id,
+ std::list<int32_t>* sessions_list,
+ uint32_t* device_id));
+ MOCK_CONST_METHOD5(GetDataOnDeviceID,
+ int32_t(uint32_t device_handle,
+ std::string* device_name,
+ std::list<uint32_t>* applications_list,
+ std::string* mac_address,
+ std::string* connection_type));
+ MOCK_CONST_METHOD2(IsHeartBeatSupported,
+ bool(transport_manager::ConnectionUID connection_handle,
+ uint8_t session_id));
+ MOCK_CONST_METHOD3(ProtocolVersionUsed,
+ bool(uint32_t connection_id,
+ uint8_t session_id,
+ uint8_t& protocol_version));
+
+#ifdef ENABLE_SECURITY
+ MOCK_METHOD2(SetSSLContext,
+ int(const uint32_t& key, security_manager::SSLContext* context));
+ MOCK_METHOD2(GetSSLContext,
+ security_manager::SSLContext*(
+ const uint32_t& key,
+ const protocol_handler::ServiceType& service_type));
+ MOCK_METHOD2(SetProtectionFlag,
+ void(const uint32_t& key,
+ const protocol_handler::ServiceType& service_type));
+ MOCK_CONST_METHOD1(
+ GetHandshakeContext,
+ security_manager::SSLContext::HandshakeContext(uint32_t key));
+#endif // ENABLE_SECURITY
+};
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
+#endif // TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
diff --git a/src/components/transport_manager/test/include/mock_application.h b/src/components/include/test/security_manager/mock_crypto_manager.h
index 7ec71ebb1e..55c364bd89 100644
--- a/src/components/transport_manager/test/include/mock_application.h
+++ b/src/components/include/test/security_manager/mock_crypto_manager.h
@@ -1,7 +1,5 @@
/*
- * mock_application.h
- *
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,49 +30,32 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef MOCK_APPLICATION_H_
-#define MOCK_APPLICATION_H_
-
-#include <pthread.h>
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_CRYPTO_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_CRYPTO_MANAGER_H_
-#include <sstream>
#include <string>
-#include <transport_manager/common.h>
-#include <transport_manager/transport_manager.h>
-#include <transport_manager/transport_adapter/transport_adapter_impl.h>
-#include <transport_manager/transport_manager_impl.h>
-#include "mock_device_scanner.h"
+#include "gmock/gmock.h"
+#include "security_manager/crypto_manager.h"
namespace test {
namespace components {
-namespace transport_manager {
-
-class MockDevice;
-using ::transport_manager::ApplicationHandle;
+namespace security_manager_test {
-class MockApplication {
+class MockCryptoManager : public ::security_manager::CryptoManager {
public:
- const MockDevice *device;
- ApplicationHandle handle;
- pthread_t workerThread;
- pthread_cond_t ready_cond;
- pthread_mutex_t ready_mutex;
- int sockfd;
- bool active;
- private:
- std::string socket_name_;
- public:
- MockApplication(const MockDevice* device, ApplicationHandle id);
- void Start();
- void Stop();
- const std::string &socket_name() const {
- return socket_name_;
- }
+ MOCK_METHOD0(Init, bool());
+ MOCK_CONST_METHOD0(is_initialized, bool());
+ MOCK_CONST_METHOD0(get_settings,
+ const ::security_manager::CryptoManagerSettings&());
+ MOCK_METHOD1(OnCertificateUpdated, bool(const std::string&));
+ MOCK_METHOD0(CreateSSLContext, ::security_manager::SSLContext*());
+ MOCK_METHOD1(ReleaseSSLContext, void(::security_manager::SSLContext*));
+ MOCK_CONST_METHOD0(LastError, std::string());
+ MOCK_CONST_METHOD0(IsCertificateUpdateRequired, bool());
};
-
-} // namespace transport_manager
+} // namespace security_manager_test
} // namespace components
} // namespace test
-#endif /* MOCK_APPLICATION_H_ */
+#endif // SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_CRYPTO_MANAGER_H_
diff --git a/src/components/include/test/security_manager/mock_security_manager.h b/src/components/include/test/security_manager/mock_security_manager.h
new file mode 100644
index 0000000000..baea4ab803
--- /dev/null
+++ b/src/components/include/test/security_manager/mock_security_manager.h
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_H_
+
+#include <string>
+#include <list>
+#include "gmock/gmock.h"
+#include "utils/byte_order.h"
+#include "security_manager/security_manager.h"
+#include "security_manager/security_query.h"
+
+namespace test {
+namespace components {
+namespace security_manager_test {
+
+class MockSecurityManager : public ::security_manager::SecurityManager {
+ public:
+ MOCK_METHOD1(set_session_observer,
+ void(::protocol_handler::SessionObserver*));
+ MOCK_METHOD1(set_protocol_handler,
+ void(::protocol_handler::ProtocolHandler*));
+ MOCK_METHOD1(set_crypto_manager, void(::security_manager::CryptoManager*));
+ MOCK_METHOD4(SendInternalError, void(const uint32_t, const uint8_t&,
+ const std::string&, const uint32_t));
+ MOCK_METHOD1(CreateSSLContext,
+ ::security_manager::SSLContext*(const uint32_t&));
+ MOCK_METHOD1(StartHandshake, void(uint32_t));
+ MOCK_METHOD1(AddListener, void(::security_manager::SecurityManagerListener*));
+ MOCK_METHOD1(RemoveListener,
+ void(::security_manager::SecurityManagerListener*));
+ // protocol_handler::ProtocolObserver part
+ MOCK_METHOD1(OnMessageReceived,
+ void(const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD1(OnMobileMessageSent,
+ void(const ::protocol_handler::RawMessagePtr));
+};
+
+/*
+ * Matcher for RawMessages
+ * Check binary data of RawMessages
+ */
+MATCHER_P(RawMessageEqSize, exp_data_size,
+ std::string(negation ? "is not" : "is") + " RawMessages ") {
+ const size_t arg_data_size = arg->data_size();
+ if (arg_data_size != exp_data_size) {
+ *result_listener << "Got " << arg_data_size << " bytes "
+ << " expected " << exp_data_size << " bytes";
+ return false;
+ }
+ return true;
+}
+MATCHER_P2(RawMessageEq, exp_data, exp_data_size,
+ std::string(negation ? "is not" : "is") + " RawMessages ") {
+ const size_t arg_data_size = arg->data_size();
+ if (arg_data_size != exp_data_size) {
+ *result_listener << "Got " << arg_data_size << " bytes "
+ << " expected " << exp_data_size << " bytes";
+ return false;
+ }
+ const uint8_t* arg_data = arg->data();
+ for (uint32_t i = 0; i < arg_data_size; ++i) {
+ if (arg_data[i] != exp_data[i]) {
+ *result_listener << "Fail in " << i << " byte";
+ return false;
+ }
+ }
+ return true;
+}
+
+/*
+ * Matcher for Handshake data
+ */
+MATCHER_P2(HandshakeStepEq, exp_data, exp_data_size,
+ std::string(negation ? "is not" : "is") + " Handshake ") {
+ const uint8_t* arg_data = arg;
+ for (uint32_t i = 0; i < exp_data_size; ++i) {
+ if (arg_data[i] != exp_data[i]) {
+ *result_listener << "Fail in " << i << " byte";
+ return false;
+ }
+ }
+ return true;
+}
+
+/*
+ * Matcher for checking RawMessage with InternalError Query
+ * Check error id
+ */
+MATCHER_P(InternalErrorWithErrId, expectedErrorId,
+ std::string(negation ? "is not" : "is") +
+ " InternalError with selected error") {
+ const size_t header_size =
+ sizeof(security_manager::SecurityQuery::QueryHeader);
+ if (arg->data_size() <= header_size) {
+ *result_listener << "Size " << arg->data_size()
+ << " bytes less or equal sizeof(QueryHeader)="
+ << header_size;
+ return false;
+ }
+ const uint8_t* data = arg->data();
+ const uint8_t query_type = data[0];
+ if (security_manager::SecurityQuery::NOTIFICATION != query_type) {
+ *result_listener << "RawMessage is not notification, type=0x" << std::hex
+ << static_cast<int>(query_type);
+ return false;
+ }
+ // Read Big-Endian number
+ const uint32_t query_id = data[1] << 16 | data[2] << 8 | data[3];
+ if (security_manager::SecurityQuery::SEND_INTERNAL_ERROR != query_id) {
+ *result_listener << "Notification is not InternalError, id=0x" << std::hex
+ << query_id;
+ return false;
+ }
+ const uint32_t json_size =
+ data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11];
+ if (header_size + json_size >= arg->data_size()) {
+ *result_listener << "InternalError contains only JSON data.";
+ return false;
+ }
+ // Read err_id as bin data number
+ const uint8_t* err_id =
+ reinterpret_cast<const uint8_t*>(data + header_size + json_size);
+ if (expectedErrorId != *err_id) {
+ *result_listener << "InternalError id " << static_cast<int>(*err_id)
+ << " and not equal error " << expectedErrorId;
+ return false;
+ }
+ return true;
+}
+
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
+ /*
+ * Matcher for checking QueryHeader equal in GTests
+ */
+::testing::AssertionResult QueryHeader_EQ(
+ const char* m_expr, const char* n_expr,
+ const ::security_manager::SecurityQuery::QueryHeader& q1,
+ const ::security_manager::SecurityQuery::QueryHeader& q2);
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_H_
diff --git a/src/components/include/test/security_manager/mock_security_manager_listener.h b/src/components/include/test/security_manager/mock_security_manager_listener.h
new file mode 100644
index 0000000000..9e5dd03698
--- /dev/null
+++ b/src/components/include/test/security_manager/mock_security_manager_listener.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_LISTENER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_LISTENER_H_
+
+#include "gmock/gmock.h"
+#include "security_manager/security_manager_listener.h"
+#include "security_manager/ssl_context.h"
+
+namespace test {
+namespace components {
+namespace security_manager_test {
+
+class MockSecurityManagerListener
+ : public ::security_manager::SecurityManagerListener {
+ public:
+ MOCK_METHOD2(OnHandshakeDone,
+ bool(uint32_t connection_key,
+ ::security_manager::SSLContext::HandshakeResult result));
+ MOCK_METHOD0(OnCertificateUpdateRequired, void());
+};
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_LISTENER_H_
diff --git a/src/components/include/test/security_manager/mock_security_manager_settings.h b/src/components/include/test/security_manager/mock_security_manager_settings.h
new file mode 100644
index 0000000000..6ac194ced4
--- /dev/null
+++ b/src/components/include/test/security_manager/mock_security_manager_settings.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_SETTINGS_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_SETTINGS_H_
+
+#include "gmock/gmock.h"
+#include "security_manager/security_manager_settings.h"
+
+namespace test {
+namespace components {
+namespace security_manager_test {
+
+class MockCryptoManagerSettings
+ : public ::security_manager::CryptoManagerSettings {
+ public:
+ MOCK_CONST_METHOD0(security_manager_mode, ::security_manager::Mode());
+ MOCK_CONST_METHOD0(security_manager_protocol_name,
+ ::security_manager::Protocol());
+ MOCK_CONST_METHOD0(verify_peer, bool());
+ MOCK_CONST_METHOD0(certificate_data, const std::string&());
+ MOCK_CONST_METHOD0(ciphers_list, const std::string&());
+ MOCK_CONST_METHOD0(ca_cert_path, const std::string&());
+ MOCK_CONST_METHOD0(update_before_hours, size_t());
+ MOCK_CONST_METHOD0(maximum_payload_size, size_t());
+};
+
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
+#endif // SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SECURITY_MANAGER_SETTINGS_H_
diff --git a/src/components/include/test/security_manager/mock_ssl_context.h b/src/components/include/test/security_manager/mock_ssl_context.h
new file mode 100644
index 0000000000..4716ef8371
--- /dev/null
+++ b/src/components/include/test/security_manager/mock_ssl_context.h
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SSL_CONTEXT_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SSL_CONTEXT_H_
+
+#include <string>
+
+#include "gmock/gmock.h"
+#include "security_manager/ssl_context.h"
+
+namespace test {
+namespace components {
+namespace security_manager_test {
+
+class MockSSLContext : public ::security_manager::SSLContext {
+ public:
+ MOCK_METHOD2(StartHandshake, HandshakeResult(const uint8_t** const out_data,
+ size_t* out_data_size));
+ MOCK_METHOD4(DoHandshakeStep, HandshakeResult(const uint8_t* const in_data,
+ size_t in_data_size,
+ const uint8_t** const out_data,
+ size_t* out_data_size));
+ MOCK_METHOD4(Encrypt,
+ bool(const uint8_t* const in_data, size_t in_data_size,
+ const uint8_t** const out_data, size_t* out_data_size));
+ MOCK_METHOD4(Decrypt,
+ bool(const uint8_t* const in_data, size_t in_data_size,
+ const uint8_t** const out_data, size_t* out_data_size));
+ MOCK_CONST_METHOD0(IsInitCompleted, bool());
+ MOCK_CONST_METHOD0(IsHandshakePending, bool());
+ MOCK_CONST_METHOD1(get_max_block_size, size_t(size_t mtu));
+ MOCK_CONST_METHOD0(LastError, std::string());
+ MOCK_METHOD0(ResetConnection, void());
+ MOCK_METHOD1(SetHandshakeContext, void(const HandshakeContext& hsh_ctx));
+};
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_SECURITY_MANAGER_MOCK_SSL_CONTEXT_H_
diff --git a/src/components/transport_manager/test/mock_connection_factory.cc b/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
index 392ad79511..3b3a1b43f7 100644
--- a/src/components/transport_manager/test/mock_connection_factory.cc
+++ b/src/components/include/test/telemetry_monitor/mock_telemetry_observable.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,34 +30,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#ifndef SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TEST_MOCK_TELEMETRY_OBSERVEABLE_H
+#define SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TEST_MOCK_TELEMETRY_OBSERVEABLE_H
-#include "include/mock_connection.h"
-#include "include/mock_connection_factory.h"
-
-#include <algorithm>
-
-#include "include/mock_device.h"
-#include "include/mock_transport_adapter.h"
-
-using ::transport_manager::transport_adapter::DeviceSptr;
-using ::transport_manager::ConnectError;
+#include "gmock/gmock.h"
+#include "telemetry_monitor/telemetry_observable.h"
+#include "application_manager/telemetry_observer.h"
namespace test {
namespace components {
-namespace transport_manager {
+namespace telemetry_monitor_test {
-MockConnectionFactory::MockConnectionFactory(MockTransportAdapter *controller)
- : controller_(controller) {}
+class MockTelemetryObservable :
+ public telemetry_monitor::TelemetryObservable<
+ application_manager::AMTelemetryObserver> {
+ public:
+ MOCK_METHOD1(SetTelemetryObserver, void(application_manager::AMTelemetryObserver* observer));
+};
-TransportAdapter::Error MockConnectionFactory::CreateConnection(
- const ::transport_manager::DeviceUID& device_handle,
- const ApplicationHandle& app_handle) {
-
- MockConnection *conn = new MockConnection(device_handle, app_handle, controller_);
- conn->Start();
- return TransportAdapter::OK;
-}
-
-} // namespace transport_manager
+} // namespace telemetry_monitor_test
} // namespace components
} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TELEMETRY_MONITOR_TEST_MOCK_TELEMETRY_OBSERVEABLE_H
diff --git a/src/components/transport_manager/test/include/time_metric_observer_mock.h b/src/components/include/test/telemetry_monitor/mock_telemetry_observer.h
index 5936f8c655..e638048126 100644
--- a/src/components/transport_manager/test/include/time_metric_observer_mock.h
+++ b/src/components/include/test/telemetry_monitor/mock_telemetry_observer.h
@@ -30,26 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TIME_METRIC_OBSERVER_MOCK_H_
-#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TIME_METRIC_OBSERVER_MOCK_H_
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
#include <string>
#include "gmock/gmock.h"
-#include "transport_manager/time_metric_observer.h"
+#include "transport_manager/telemetry_observer.h"
#include "protocol/raw_message.h"
-
namespace test {
namespace components {
namespace transport_manager_test {
-class TMMetricObserverMock: public ::transport_manager::TMMetricObserver {
+class TMTelemetryObserverMock
+ : public ::transport_manager::TMTelemetryObserver {
public:
- MOCK_METHOD1(StartRawMsg,
- void(const protocol_handler::RawMessage* ptr));
- MOCK_METHOD1(StopRawMsg,
- void(const protocol_handler::RawMessage* ptr));
+ MOCK_METHOD1(StartRawMsg, void(const protocol_handler::RawMessage* ptr));
+ MOCK_METHOD1(StopRawMsg, void(const protocol_handler::RawMessage* ptr));
};
} // namespace transport_manager_test
} // namespace components
} // namespace test
-#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TIME_METRIC_OBSERVER_MOCK_H_
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TIME_METRIC_OBSERVER_H_
diff --git a/src/components/transport_manager/test/include/transport_manager_mock.h b/src/components/include/test/transport_manager/transport_manager_mock.h
index 6593f992de..bf20038345 100644
--- a/src/components/transport_manager/test/include/transport_manager_mock.h
+++ b/src/components/include/test/transport_manager/transport_manager_mock.h
@@ -37,6 +37,7 @@
#include <string>
#include "transport_manager/transport_manager.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
+#include "telemetry_monitor/telemetry_observable.h"
namespace test {
namespace components {
@@ -50,37 +51,32 @@ using ::transport_manager::TransportManagerListener;
/*
* MOCK implementation of ::transport_manager::TransportManager interface
*/
-class TransportManagerMock: public ::transport_manager::TransportManager {
+class MockTransportManager
+ : public ::transport_manager::TransportManager,
+ public ::telemetry_monitor::TelemetryObservable<
+ transport_manager::TMTelemetryObserver>{
+
public:
- MOCK_METHOD0(Init,
- int());
- MOCK_METHOD0(Reinit,
- int());
- MOCK_METHOD0(SearchDevices,
- int());
- MOCK_METHOD1(ConnectDevice,
- int(const DeviceHandle &));
- MOCK_METHOD1(DisconnectDevice,
- int(const DeviceHandle &));
- MOCK_METHOD1(Disconnect,
- int(const ConnectionUID &));
- MOCK_METHOD1(DisconnectForce,
- int(const ConnectionUID &));
- MOCK_METHOD1(SendMessageToDevice,
- int(const ::protocol_handler::RawMessagePtr));
- MOCK_METHOD1(ReceiveEventFromDevice,
- int(const TransportAdapterEvent&));
- MOCK_METHOD1(AddTransportAdapter,
- int(TransportAdapter *));
- MOCK_METHOD1(AddEventListener,
- int(TransportManagerListener *));
- MOCK_METHOD0(Stop,
- int());
- MOCK_METHOD1(RemoveDevice,
- int(const DeviceHandle &));
- MOCK_CONST_METHOD1(Visibility,
- int(const bool &));
+ MOCK_METHOD0(Init, int());
+ MOCK_METHOD0(Reinit, int());
+ MOCK_METHOD0(SearchDevices, int());
+ MOCK_METHOD1(ConnectDevice, int(const DeviceHandle));
+ MOCK_METHOD1(DisconnectDevice, int(const DeviceHandle));
+ MOCK_METHOD1(Disconnect, int(const ConnectionUID));
+ MOCK_METHOD1(DisconnectForce, int(const ConnectionUID));
+ MOCK_METHOD1(SendMessageToDevice,
+ int(const ::protocol_handler::RawMessagePtr));
+ MOCK_METHOD1(ReceiveEventFromDevice, int(const TransportAdapterEvent&));
+ MOCK_METHOD1(AddTransportAdapter, int(TransportAdapter* adapter));
+ MOCK_METHOD1(AddEventListener, int(TransportManagerListener* listener));
+ MOCK_METHOD0(Stop, int());
+ MOCK_METHOD1(RemoveDevice, int(const DeviceHandle));
+ MOCK_CONST_METHOD1(Visibility, int(const bool&));
+ MOCK_METHOD1(SetTelemetryObserver,
+ void(transport_manager::TMTelemetryObserver* observer));
+
};
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter.h b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
index 9a820f4cf9..a4ba20e567 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter.h
@@ -50,7 +50,7 @@
namespace transport_manager {
-class TMMetricObserver;
+class TMTelemetryObserver;
namespace transport_adapter {
@@ -272,14 +272,14 @@ class TransportAdapter {
*/
virtual std::string DeviceName(const DeviceUID& device_id) const = 0;
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
/**
* @brief Return Time metric observer
*
* @param return pointer to Time metric observer
*/
- virtual TMMetricObserver* GetTimeMetricObserver() = 0;
-#endif // TIME_TESTER
+ virtual TMTelemetryObserver* GetTelemetryObserver() = 0;
+#endif // TELEMETRY_MONITOR
};
} // namespace transport_adapter
} // namespace transport_manager
diff --git a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
index 525a69fbb7..cb29edbbfe 100644
--- a/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
+++ b/src/components/include/transport_manager/transport_adapter/transport_adapter_event.h
@@ -41,6 +41,7 @@ namespace transport_manager {
class TransportAdapterEvent {
public:
+ TransportAdapterEvent() {}
/**
* @brief Constructor.
*
diff --git a/src/components/include/transport_manager/transport_manager.h b/src/components/include/transport_manager/transport_manager.h
index 25745e7485..f1c8ec0c98 100644
--- a/src/components/include/transport_manager/transport_manager.h
+++ b/src/components/include/transport_manager/transport_manager.h
@@ -78,7 +78,7 @@ class TransportManager {
*
* @return Code error.
**/
- virtual int ConnectDevice(const DeviceHandle& device_id) = 0;
+ virtual int ConnectDevice(const DeviceHandle device_id) = 0;
/**
* @brief Disconnect from all applications connected on device.
@@ -87,7 +87,7 @@ class TransportManager {
*
* @return Code error.
**/
- virtual int DisconnectDevice(const DeviceHandle& device_id) = 0;
+ virtual int DisconnectDevice(const DeviceHandle device_id) = 0;
/**
* @brief Disconnect from applications connected on device by connection
@@ -97,14 +97,14 @@ class TransportManager {
*
* @return Code error.
**/
- virtual int Disconnect(const ConnectionUID& connection_id) = 0;
+ virtual int Disconnect(const ConnectionUID connection_id) = 0;
/**
* @brief Disconnect and clear all unprocessed data.
*
* @param connection Connection unique identifier.
*/
- virtual int DisconnectForce(const ConnectionUID& connection_id) = 0;
+ virtual int DisconnectForce(const ConnectionUID connection_id) = 0;
/**
* @brief Post new message in queue for massages destined to device.
@@ -157,7 +157,7 @@ class TransportManager {
*
* @return Code error.
**/
- virtual int RemoveDevice(const DeviceHandle& device_handle) = 0;
+ virtual int RemoveDevice(const DeviceHandle device_handle) = 0;
/**
* @brief Turns on or off visibility of SDL to mobile devices
diff --git a/src/components/include/transport_manager/transport_manager_listener.h b/src/components/include/transport_manager/transport_manager_listener.h
index 0684e8f22f..d020e508fb 100644
--- a/src/components/include/transport_manager/transport_manager_listener.h
+++ b/src/components/include/transport_manager/transport_manager_listener.h
@@ -89,7 +89,7 @@ class TransportManagerListener {
* @param connection_id connection unique identifier.
*/
virtual void OnConnectionEstablished(const DeviceInfo& device_info,
- const ConnectionUID& connection_id) = 0;
+ const ConnectionUID connection_id) = 0;
/**
* @brief Reaction to the event, when connection to the device is failed.
@@ -105,7 +105,7 @@ class TransportManagerListener {
*
* @param connection_id Connection unique identifier.
*/
- virtual void OnConnectionClosed(ConnectionUID connection_id) = 0;
+ virtual void OnConnectionClosed(const ConnectionUID connection_id) = 0;
/**
* @brief Called when connection is closed unexpectedly, i.e. disconnect was not requested
@@ -113,7 +113,7 @@ class TransportManagerListener {
* @param connection_id Connection ID.
* @param error Error information.
*/
- virtual void OnUnexpectedDisconnect(ConnectionUID connection_id,
+ virtual void OnUnexpectedDisconnect(const ConnectionUID connection_id,
const CommunicationError& error) = 0;
/**
@@ -122,7 +122,7 @@ class TransportManagerListener {
* @param connection_id Connection unique identifier.
* @param error Error information about possible reason of failure.
*/
- virtual void OnConnectionClosedFailure(ConnectionUID connection_id,
+ virtual void OnConnectionClosedFailure(const ConnectionUID connection_id,
const DisconnectError& error) = 0;
/**
@@ -153,8 +153,7 @@ class TransportManagerListener {
* @param connection_id connection unique identifier.
* @param error Error information about possible reason of failure.
*/
- virtual void OnTMMessageReceiveFailed(ConnectionUID connection_id,
- const DataReceiveError& error) = 0;
+ virtual void OnTMMessageReceiveFailed(const DataReceiveError& error) = 0;
/**
* @brief Reaction to the event, when transport manager sent a massage.
diff --git a/src/components/include/transport_manager/transport_manager_listener_empty.h b/src/components/include/transport_manager/transport_manager_listener_empty.h
index f481f57ff5..5150e54eba 100644
--- a/src/components/include/transport_manager/transport_manager_listener_empty.h
+++ b/src/components/include/transport_manager/transport_manager_listener_empty.h
@@ -48,17 +48,17 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
/**
* @Destructor.
*/
- virtual ~TransportManagerListenerEmpty() {}
+ ~TransportManagerListenerEmpty() {}
/**
* @brief Reaction to the event, when the list of devices is updated.
*
* @param Container that holds information about devices.
*/
- virtual void OnDeviceListUpdated(const std::vector<DeviceInfo>&) {
+ void OnDeviceListUpdated(const std::vector<DeviceInfo>&) OVERRIDE {
}
- virtual void OnFindNewApplicationsRequest() {
+ void OnFindNewApplicationsRequest() OVERRIDE {
}
/**
@@ -66,17 +66,17 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
*
* @param device_info Variable that hold information about device.
*/
- virtual void OnDeviceFound(const DeviceInfo& device_info) {
+ void OnDeviceFound(const DeviceInfo& device_info) OVERRIDE {
}
- virtual void OnDeviceAdded(const DeviceInfo& device_info) {
+ void OnDeviceAdded(const DeviceInfo& device_info) OVERRIDE {
}
- virtual void OnDeviceRemoved(const DeviceInfo& device_info) {
+ void OnDeviceRemoved(const DeviceInfo& device_info) OVERRIDE {
}
/**
* @brief Reaction to the event, when scanning of devices is finished.
*/
- virtual void OnScanDevicesFinished() {
+ void OnScanDevicesFinished() OVERRIDE {
}
/**
@@ -84,7 +84,7 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
*
* @param error Error information about possible reason of scanning of devices failure.
*/
- virtual void OnScanDevicesFailed(const SearchDeviceError& error) {
+ void OnScanDevicesFailed(const SearchDeviceError& error) OVERRIDE {
}
/**
@@ -93,8 +93,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param devcie_info Variable that hold information about device.
* @param connection_id connection unique identifier.
*/
- virtual void OnConnectionEstablished(const DeviceInfo& device_info,
- const ConnectionUID& connection_id) {
+ void OnConnectionEstablished(const DeviceInfo& device_info,
+ const ConnectionUID connection_id) OVERRIDE {
}
/**
@@ -103,8 +103,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param device_info Variable that hold information about device.
* @param error Error information about possible reason of connect failure.
*/
- virtual void OnConnectionFailed(const DeviceInfo& device_info,
- const ConnectError& error) {
+ void OnConnectionFailed(const DeviceInfo& device_info,
+ const ConnectError& error) OVERRIDE {
}
/**
@@ -112,11 +112,11 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
*
* @param connection_id Connection unique identifier.
*/
- virtual void OnConnectionClosed(ConnectionUID connection_id) {
+ void OnConnectionClosed(ConnectionUID connection_id) OVERRIDE {
}
- virtual void OnUnexpectedDisconnect(ConnectionUID connection_id,
- const CommunicationError& error) {
+ void OnUnexpectedDisconnect(ConnectionUID connection_id,
+ const CommunicationError& error) OVERRIDE {
}
/**
@@ -125,8 +125,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param connection_id Connection unique identifier.
* @param error Error information about possible reason of failure.
*/
- virtual void OnConnectionClosedFailure(ConnectionUID connection_id,
- const DisconnectError& error) {
+ void OnConnectionClosedFailure(ConnectionUID connection_id,
+ const DisconnectError& error) OVERRIDE {
}
/**
@@ -135,8 +135,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param device Handle of device.
* @param error Error information about possible reason of lost connection.
*/
- virtual void OnDeviceConnectionLost(const DeviceHandle& device,
- const DisconnectDeviceError& error) {
+ void OnDeviceConnectionLost(const DeviceHandle& device,
+ const DisconnectDeviceError& error) OVERRIDE {
}
/**
@@ -145,8 +145,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param device Handle of device.
* @param error Error information about possible reason of Disconnect failure.
*/
- virtual void OnDisconnectFailed(const DeviceHandle& device,
- const DisconnectDeviceError& error) {
+ void OnDisconnectFailed(const DeviceHandle& device,
+ const DisconnectDeviceError& error) OVERRIDE {
}
/**
@@ -155,7 +155,7 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param message Smart pointer to the raw massage.
* @param connection_id Connection unique identifier.
*/
- virtual void OnTMMessageReceived(const ::protocol_handler::RawMessagePtr message) {
+ void OnTMMessageReceived(const ::protocol_handler::RawMessagePtr message) OVERRIDE {
}
/**
@@ -164,14 +164,13 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param connection_id connection unique identifier.
* @param error Error information about possible reason of failure.
*/
- virtual void OnTMMessageReceiveFailed(ConnectionUID connection_id,
- const DataReceiveError& error) {
+ void OnTMMessageReceiveFailed(const DataReceiveError& error) OVERRIDE {
}
/**
* @brief Reaction to the event, when transport manager sent a massage.
*/
- virtual void OnTMMessageSend(const ::protocol_handler::RawMessagePtr message) {
+ void OnTMMessageSend(const ::protocol_handler::RawMessagePtr message) OVERRIDE {
}
/**
@@ -180,8 +179,8 @@ class TransportManagerListenerEmpty : public TransportManagerListener {
* @param error Error information about possible reason of failure.
* @param message Smart pointer to the raw massage.
*/
- virtual void OnTMMessageSendFailed(const DataSendError& error,
- const ::protocol_handler::RawMessagePtr message) {
+ void OnTMMessageSendFailed(const DataSendError& error,
+ const ::protocol_handler::RawMessagePtr message) OVERRIDE {
}
};
} // namespace transport_manager
diff --git a/src/components/include/utils/atomic_object.h b/src/components/include/utils/atomic_object.h
new file mode 100644
index 0000000000..257fcfbe3a
--- /dev/null
+++ b/src/components/include/utils/atomic_object.h
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_OBJECT_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_OBJECT_H_
+
+#include "utils/rwlock.h"
+#include "utils/conditional_variable.h"
+#include "utils/macro.h"
+
+namespace sync_primitives {
+
+/**
+ * @brief Allows to safely change stored value from different threads.
+ *
+ * The usage example:
+ *
+ * threads::Atomic<int> i;
+ *
+ * i = 5; // here SDL is able to guarantee that this value will be safely
+ * // assigned even in multi threaded environment.
+ */
+template <typename T>
+class Atomic {
+ public:
+ /**
+ * @brief Atomic allows to construct atomic object.
+ * The operation is not atomic.
+ *
+ * @param value the value to initialize object with.
+ */
+ Atomic(const T& value) : value_(value) {}
+
+ /**
+ * @brief operator = thread safe setter for stored value.
+ *
+ * @param val value to assign.
+ *
+ * @return mofified value.
+ */
+ T& operator=(const T& val) {
+ sync_primitives::AutoWriteLock lock(rw_lock_);
+ value_ = val;
+ return value_;
+ }
+
+ /**
+ * @brief operator T thread safe getter
+ *
+ * return stored value.
+ */
+ operator T() const {
+ sync_primitives::AutoReadLock lock(rw_lock_);
+ return value_;
+ }
+
+ /**
+ * @brief operator T thread safe getter
+ *
+ * return stored value.
+ */
+ template <typename U>
+ operator U() const {
+ sync_primitives::AutoReadLock lock(rw_lock_);
+ return static_cast<U>(value_);
+ }
+
+ private:
+ T value_;
+ mutable sync_primitives::RWLock rw_lock_;
+};
+
+typedef Atomic<int> atomic_int;
+typedef Atomic<int32_t> atomic_int32;
+typedef Atomic<uint32_t> atomic_uint32;
+typedef Atomic<int64_t> atomic_int64;
+typedef Atomic<uint64_t> atomic_uint64;
+typedef Atomic<size_t> atomic_size_t;
+typedef Atomic<bool> atomic_bool;
+
+} // namespace sync_primitives
+
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_ATOMIC_OBJECT_H_
diff --git a/src/components/include/utils/custom_string.h b/src/components/include/utils/custom_string.h
new file mode 100644
index 0000000000..182c983a54
--- /dev/null
+++ b/src/components/include/utils/custom_string.h
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_CUSTOM_STRING_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_CUSTOM_STRING_H_
+
+#include <string>
+
+namespace utils {
+namespace custom_string {
+/* UTF8 formats:
+ * UTF8 1 byte consists from one-byte sequence
+ * bit representation of one character: 0xxxxxxx
+ * UTF8 2 bytes consists from two-byte sequence
+ * bit representation of one character: 110xxxxx 10xxxxxx
+ * UTF8 3 bytes consists from three-byte sequence
+ * bit representation of one character: 1110xxxx 10xxxxxx 10xxxxxx
+ * UTF8 4 bytes consists from four-byte sequence
+ * bit representation of one character: 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx
+ */
+enum UTFFormat {
+ kByteOfUTF8 = 0x80, //10xxxxxx
+ kHigestByteOfUTF8Byte2 = 0xc0, //110xxxxx
+ kHigestByteOfUTF8Byte3 = 0xe0, //1110xxxx
+ kHigestByteOfUTF8Byte4 = 0xf0 //11110xxx
+};
+
+class CustomString {
+ public:
+ /**
+ * @brief Constructs empty object.
+ */
+ CustomString();
+
+ /**
+ * @brief Constructs object with copy of str.
+ * @param Contains string for new object.
+ */
+ explicit CustomString(const std::string& str);
+
+ /**
+ * @brief Constructs object with copy of str.
+ * @param Contains pointer to string for new object.
+ */
+ explicit CustomString(const char* str);
+
+ /**
+ * @brief Constructs object with n consecutive copies of character c.
+ * @param Contains amount of copies of character for new object.
+ * @param Contains character for new object.
+ */
+ CustomString(size_t n, char c);
+
+ /**
+ * @brief Returns the length of the string, in terms of characters.
+ */
+ size_t size() const;
+
+ /**
+ * @brief Returns the length of the string, in terms of characters.
+ */
+ size_t length() const;
+
+ /**
+ * @brief Returns the length of the string, in terms of bytes.
+ */
+ size_t length_bytes() const;
+
+ /**
+ * @brief Returns TRUE if CustomString contains ASCII string
+ * otherwise returns FALSE.
+ */
+ bool is_ascii_string() const;
+
+ /**
+ * @brief Returns TRUE if CustomString contains empty string
+ * otherwise returns FALSE.
+ */
+ bool empty() const;
+
+ /**
+ * @brief Compares the value of the string (case sensitive).
+ * @param Contains string for comparing
+ * @return Returns TRUE if strings is equal otherwise returns FALSE.
+ */
+ bool operator==(const CustomString& str) const;
+
+ /**
+ * @brief Compares the value of the string (case sensitive).
+ * @param Contains string for comparing
+ * @return Returns TRUE if strings is equal otherwise returns FALSE.
+ */
+ bool operator==(const std::string& str) const;
+
+ /**
+ * @brief Assigns a new value to the string
+ * @param Contains string for assignment
+ * @return Returns result of assignment
+ */
+ CustomString& operator=(const char* str);
+
+ /**
+ * @brief Concatenates string from CustomString with string from argument.
+ * @param Contains string for concatenation.
+ * @return Returns result of concatenation.
+ */
+ CustomString operator+(const CustomString& str) const;
+
+ /**
+ * @brief Concatenates string from CustomString with string from argument.
+ * @param Contains string for concatenation.
+ * @return Returns result of concatenation.
+ */
+ CustomString operator+(const std::string& str) const;
+
+ /**
+ * @brief Returns the character at position pos in the string.
+ * Need to use with ASCII string.
+ * @param pos value with the position of a character within the string.
+ */
+ char at(size_t pos) const;
+
+ /**
+ * @brief Compares the value of the string (case sensitive).
+ * @param Contains string for comparing
+ * @return Returns 0 if strings is equal otherwise
+ * returns "<0" or ">0".
+ */
+ int compare(const char* str) const;
+
+ /**
+ * @brief Compares the value of the string (case sensitive).
+ * @param Contains string for comparing
+ * @return Returns 0 if strings is equal otherwise
+ * returns "<0" or ">0".
+ */
+ int compare(const std::string& str) const;
+
+ /**
+ * @brief Compares the value of the string (case insensitive).
+ * @param Contains string for comparing
+ * @return Returns TRUE if strings is equal otherwise returns FALSE.
+ */
+ bool CompareIgnoreCase(const CustomString& str) const;
+
+ /**
+ * @brief Compares the value of the string (case insensitive).
+ * @param Contains string for comparing
+ * @return Returns TRUE if strings is equal otherwise returns FALSE.
+ */
+ bool CompareIgnoreCase(const char* str) const;
+
+ /**
+ * @brief Returns a pointer to string from CustomString.
+ */
+ const char* c_str() const;
+
+ /**
+ * @brief Converts string to unicode string.
+ * @return Returns unicode string.
+ */
+ std::wstring ToWString() const;
+
+ /**
+ * @brief Returns copy of string as multibyte string.
+ */
+ std::string AsMBString() const;
+
+ /**
+ * @brief Converts string to lower case unicode string.
+ * @return Returns unicode string.
+ */
+ std::wstring ToWStringLowerCase() const;
+
+ private:
+
+ /**
+ * @brief Initiates members of CustomString
+ */
+ void InitData();
+
+ std::string mb_string_;
+ size_t amount_characters_;
+ bool is_ascii_string_;
+};
+
+} // namespace custom_string
+} // namespace utils
+
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_CUSTOM_STRING_H_
diff --git a/src/components/include/utils/date_time.h b/src/components/include/utils/date_time.h
index c8cef32ef4..4f44442783 100644
--- a/src/components/include/utils/date_time.h
+++ b/src/components/include/utils/date_time.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -49,8 +49,12 @@ enum TimeCompare {
class DateTime {
public:
static const int32_t MILLISECONDS_IN_SECOND = 1000;
- static const int32_t MICROSECONDS_IN_MILLISECONDS = 1000;
- static const int32_t MICROSECONDS_IN_SECOND = 1000 * 1000;
+ static const int32_t MICROSECONDS_IN_MILLISECOND = 1000;
+ static const int32_t NANOSECONDS_IN_MICROSECOND = 1000;
+ static const int32_t MICROSECONDS_IN_SECOND =
+ MILLISECONDS_IN_SECOND * MICROSECONDS_IN_MILLISECOND;
+ static const int32_t NANOSECONDS_IN_MILLISECOND =
+ MICROSECONDS_IN_MILLISECOND * NANOSECONDS_IN_MICROSECOND;
static TimevalStruct getCurrentTime();
@@ -69,6 +73,15 @@ class DateTime {
static int64_t calculateTimeDiff(const TimevalStruct& time1,
const TimevalStruct& time2);
+ /**
+ * @brief Adds milliseconds to time struct
+ * @param time contains time struct
+ * @param milliseconds contains value which need to
+ * add to time struct
+ **/
+ static void AddMilliseconds(TimevalStruct& time,
+ uint32_t milliseconds);
+
static TimevalStruct Sub(const TimevalStruct& time1,
const TimevalStruct& time2);
@@ -78,9 +91,12 @@ class DateTime {
static bool Greater(const TimevalStruct& time1, const TimevalStruct& time2);
static bool Less(const TimevalStruct& time1, const TimevalStruct& time2);
static bool Equal(const TimevalStruct& time1, const TimevalStruct& time2);
+ private:
+ static TimevalStruct ConvertionUsecs(const TimevalStruct &time);
};
} // namespace date_time
bool operator<(const TimevalStruct& time1, const TimevalStruct& time2);
bool operator==(const TimevalStruct& time1, const TimevalStruct& time2);
+const TimevalStruct operator-(const TimevalStruct& time1, const TimevalStruct& time2);
#endif // SRC_COMPONENTS_INCLUDE_UTILS_DATE_TIME_H_
diff --git a/src/components/include/utils/lock.h b/src/components/include/utils/lock.h
index 29bd467143..be86274db3 100644
--- a/src/components/include/utils/lock.h
+++ b/src/components/include/utils/lock.h
@@ -57,11 +57,15 @@ class SpinMutex {
SpinMutex()
: state_(0) { }
void Lock() {
+ // Comment below add exception for lint error
+ // Reason: FlexeLint doesn't know about compiler's built-in instructions
+ /*lint -e1055*/
if (atomic_post_set(&state_) == 0) {
return;
}
for(;;) {
sched_yield();
+ /*lint -e1055*/
if (state_ == 0 && atomic_post_set(&state_) == 0) {
return;
}
@@ -92,7 +96,7 @@ class SpinMutex {
class Lock {
public:
Lock();
- Lock(bool is_mutex_recursive);
+ Lock(bool is_recursive);
~Lock();
// Ackquire the lock. Must be called only once on a thread.
@@ -130,6 +134,7 @@ class Lock {
void AssertTakenAndMarkFree() {}
#endif
+ void Init(bool is_recursive);
friend class ConditionalVariable;
DISALLOW_COPY_AND_ASSIGN(Lock);
diff --git a/src/components/include/utils/logger.h b/src/components/include/utils/logger.h
index 50d194245c..67bb6ad772 100644
--- a/src/components/include/utils/logger.h
+++ b/src/components/include/utils/logger.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,10 +30,8 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-
-
-#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_H_
-#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_
#ifdef ENABLE_LOG
#include <errno.h>
@@ -56,76 +54,66 @@
#define CREATE_LOGGERPTR_LOCAL(logger_var, logger_name) \
log4cxx::LoggerPtr logger_var = log4cxx::LoggerPtr(log4cxx::Logger::getLogger(logger_name));
- #define INIT_LOGGER(file_name) \
- log4cxx::PropertyConfigurator::configure(file_name);
+ #define INIT_LOGGER(file_name, logs_enabled) \
+ log4cxx::PropertyConfigurator::configure(file_name); \
+ logger::set_logs_enabled(logs_enabled);
// Logger deinitilization function and macro, need to stop log4cxx writing
// without this deinitilization log4cxx threads continue using some instances destroyed by exit()
- void deinit_logger ();
+ void deinit_logger();
#define DEINIT_LOGGER() deinit_logger()
+ // special macros to dump logs from queue
+ // it's need, for example, when crash happend
+ #define FLUSH_LOGGER() logger::flush_logger()
+
#define LOG4CXX_IS_TRACE_ENABLED(logger) logger->isTraceEnabled()
log4cxx_time_t time_now();
#define LOG_WITH_LEVEL(loggerPtr, logLevel, logEvent) \
do { \
- if (logger::logger_status != logger::DeletingLoggerThread) { \
- if (loggerPtr->isEnabledFor(logLevel)) { \
- std::stringstream accumulator; \
- accumulator << logEvent; \
- logger::push_log(loggerPtr, logLevel, accumulator.str(), time_now(), \
- LOG4CXX_LOCATION, ::log4cxx::spi::LoggingEvent::getCurrentThreadName()); \
+ if (logger::logs_enabled()) { \
+ if (logger::logger_status != logger::DeletingLoggerThread) { \
+ if (loggerPtr->isEnabledFor(logLevel)) { \
+ std::stringstream accumulator; \
+ accumulator << logEvent; \
+ logger::push_log(loggerPtr, logLevel, accumulator.str(), time_now(), \
+ LOG4CXX_LOCATION, ::log4cxx::spi::LoggingEvent::getCurrentThreadName()); \
+ } \
} \
} \
} while (false)
- #undef LOG4CXX_INFO
- #define LOG4CXX_INFO(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getInfo(), logEvent)
-
- #define LOG4CXX_INFO_EXT(logger, logEvent) LOG4CXX_INFO(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
- #define LOG4CXX_INFO_STR_EXT(logger, logEvent) LOG4CXX_INFO_STR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
+ #undef LOG4CXX_TRACE
+ #define LOG4CXX_TRACE(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getTrace(), logEvent)
- #define LOG4CXX_TRACE_EXT(logger, logEvent) LOG4CXX_TRACE(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
- #define LOG4CXX_TRACE_STR_EXT(logger, logEvent) LOG4CXX_TRACE_STR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
+ #define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace) \
+ logger::AutoTrace auto_trace(loggerPtr, LOG4CXX_LOCATION)
+ #define LOG4CXX_AUTO_TRACE(loggerPtr) LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, SDL_local_auto_trace_object)
#undef LOG4CXX_DEBUG
#define LOG4CXX_DEBUG(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getDebug(), logEvent)
- #define LOG4CXX_DEBUG_EXT(logger, logEvent) LOG4CXX_DEBUG(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
- #define LOG4CXX_DEBUG_STR_EXT(logger, logEvent) LOG4CXX_DEBUG_STR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
+ #undef LOG4CXX_INFO
+ #define LOG4CXX_INFO(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getInfo(), logEvent)
#undef LOG4CXX_WARN
#define LOG4CXX_WARN(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getWarn(), logEvent)
- #define LOG4CXX_WARN_EXT(logger, logEvent) LOG4CXX_WARN(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
- #define LOG4CXX_WARN_STR_EXT(logger, logEvent) LOG4CXX_WARN_STR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
-
#undef LOG4CXX_ERROR
#define LOG4CXX_ERROR(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getError(), logEvent)
- #define LOG4CXX_ERROR_EXT(logger, logEvent) LOG4CXX_ERROR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
- #define LOG4CXX_ERROR_STR_EXT(logger, logEvent) LOG4CXX_ERROR_STR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
-
#undef LOG4CXX_FATAL
#define LOG4CXX_FATAL(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getFatal(), logEvent)
- #define LOG4CXX_FATAL_EXT(logger, logEvent) LOG4CXX_FATAL(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
- #define LOG4CXX_FATAL_STR_EXT(logger, logEvent) LOG4CXX_FATAL_STR(logger, __PRETTY_FUNCTION__ << ": " << logEvent)
-
- #undef LOG4CXX_TRACE
- #define LOG4CXX_TRACE(loggerPtr, logEvent) LOG_WITH_LEVEL(loggerPtr, ::log4cxx::Level::getTrace(), logEvent)
-
- #define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace) logger::AutoTrace auto_trace(loggerPtr, LOG4CXX_LOCATION)
- #define LOG4CXX_AUTO_TRACE(loggerPtr) LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, SDL_local_auto_trace_object)
+ #define LOG4CXX_ERROR_WITH_ERRNO(loggerPtr, message) \
+ LOG4CXX_ERROR(loggerPtr, message << ", error code " << errno << " (" << strerror(errno) << ")")
- #define LOG4CXX_ERROR_WITH_ERRNO(logger, message) \
- LOG4CXX_ERROR(logger, message << ", error code " << errno << " (" << strerror(errno) << ")")
+ #define LOG4CXX_WARN_WITH_ERRNO(loggerPtr, message) \
+ LOG4CXX_WARN(loggerPtr, message << ", error code " << errno << " (" << strerror(errno) << ")")
- #define LOG4CXX_WARN_WITH_ERRNO(logger, message) \
- LOG4CXX_WARN(logger, message << ", error code " << errno << " (" << strerror(errno) << ")")
-
-#else // ENABLE_LOG is OFF
+#else // ENABLE_LOG is OFF
#define CREATE_LOGGERPTR_GLOBAL(logger_var, logger_name)
@@ -137,50 +125,32 @@
#define LOG4CXX_IS_TRACE_ENABLED(logger) false
+ #undef LOG4CXX_TRACE
+ #define LOG4CXX_TRACE(x, y)
+
+ #define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace)
+ #define LOG4CXX_AUTO_TRACE(loggerPtr)
+
+ #undef LOG4CXX_DEBUG
+ #define LOG4CXX_DEBUG(x, y)
+
#undef LOG4CXX_INFO
- #define LOG4CXX_INFO(x,y)
+ #define LOG4CXX_INFO(x, y)
#undef LOG4CXX_WARN
- #define LOG4CXX_WARN(x,y)
+ #define LOG4CXX_WARN(x, y)
#undef LOG4CXX_ERROR
- #define LOG4CXX_ERROR(x,y)
+ #define LOG4CXX_ERROR(x, y)
#undef LOG4CXX_ERROR_WITH_ERRNO
- #define LOG4CXX_ERROR_WITH_ERRNO(x,y)
+ #define LOG4CXX_ERROR_WITH_ERRNO(x, y)
#undef LOG4CXX_WARN_WITH_ERRNO
- #define LOG4CXX_WARN_WITH_ERRNO(x,y)
-
- #undef LOG4CXX_TRACE
- #define LOG4CXX_TRACE(x,y)
-
- #undef LOG4CXX_DEBUG
- #define LOG4CXX_DEBUG(x,y)
+ #define LOG4CXX_WARN_WITH_ERRNO(x, y)
#undef LOG4CXX_FATAL
- #define LOG4CXX_FATAL(x,y)
-
- #define LOG4CXX_INFO_EXT(logger, logEvent)
- #define LOG4CXX_INFO_STR_EXT(logger, logEvent)
-
- #define LOG4CXX_TRACE_EXT(logger, logEvent)
- #define LOG4CXX_TRACE_STR_EXT(logger, logEvent)
-
- #define LOG4CXX_DEBUG_EXT(logger, logEvent)
- #define LOG4CXX_DEBUG_STR_EXT(logger, logEvent)
-
- #define LOG4CXX_WARN_EXT(logger, logEvent)
- #define LOG4CXX_WARN_STR_EXT(logger, logEvent)
-
- #define LOG4CXX_ERROR_EXT(logger, logEvent)
- #define LOG4CXX_ERROR_STR_EXT(logger, logEvent)
-
- #define LOG4CXX_FATAL_EXT(logger, logEvent)
- #define LOG4CXX_FATAL_STR_EXT(logger, logEvent)
-
- #define LOG4CXX_AUTO_TRACE_WITH_NAME_SPECIFIED(loggerPtr, auto_trace)
- #define LOG4CXX_AUTO_TRACE(loggerPtr)
+ #define LOG4CXX_FATAL(x, y)
#endif // ENABLE_LOG
-#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_LOGGER_H_
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_LOGGER_H_
diff --git a/src/components/include/utils/macro.h b/src/components/include/utils/macro.h
index bfd13411f4..19575354ca 100644
--- a/src/components/include/utils/macro.h
+++ b/src/components/include/utils/macro.h
@@ -39,8 +39,8 @@
#endif
#include "logger.h"
-
-
+// A macro to set some action for variable to avoid "unused variable" warning
+#define UNUSED(x) (void)x;
// A macro to disallow the copy constructor and operator= functions
// This should be used in the private: declarations for a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
@@ -60,6 +60,7 @@
#ifdef DEBUG
#define ASSERT(condition) \
+ FLUSH_LOGGER(); \
do { \
DEINIT_LOGGER(); \
assert(condition); \
@@ -72,7 +73,7 @@
#define DCHECK(condition) \
if (!(condition)) { \
- CREATE_LOGGERPTR_LOCAL(logger_, "assert"); \
+ CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \
LOG4CXX_FATAL(logger_, "DCHECK failed with \"" << #condition \
<< "\" [" << __FUNCTION__ << "][" << __FILE__ << ':' << __LINE__ << ']'); \
ASSERT((condition)); \
@@ -84,9 +85,9 @@
*/
#define DCHECK_OR_RETURN(condition, return_value) \
if (!(condition)) { \
- CREATE_LOGGERPTR_LOCAL(logger_, "assert"); \
+ CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \
LOG4CXX_FATAL(logger_, "DCHECK failed with \"" << #condition \
- << "\" [" << __FUNCTION__ << "][" << __FILE__ << ':' << __LINE__ << ']' ); \
+ << "\" [" << __FUNCTION__ << "][" << __FILE__ << ':' << __LINE__ << ']'); \
ASSERT((condition)); \
return (return_value); \
}
@@ -96,9 +97,9 @@
*/
#define DCHECK_OR_RETURN_VOID(condition) \
if (!(condition)) { \
- CREATE_LOGGERPTR_LOCAL(logger_, "assert"); \
+ CREATE_LOGGERPTR_LOCAL(logger_, "Utils"); \
LOG4CXX_FATAL(logger_, "DCHECK failed with \"" << #condition \
- << "\" [" << __FUNCTION__ << "][" << __FILE__ << ':' << __LINE__ << ']' ); \
+ << "\" [" << __FUNCTION__ << "][" << __FILE__ << ':' << __LINE__ << ']'); \
ASSERT((condition)); \
return ; \
}
diff --git a/src/components/include/utils/message_queue.h b/src/components/include/utils/message_queue.h
index e0b3336728..d163ed0886 100644
--- a/src/components/include/utils/message_queue.h
+++ b/src/components/include/utils/message_queue.h
@@ -34,10 +34,10 @@
#define SRC_COMPONENTS_INCLUDE_UTILS_MESSAGE_QUEUE_H_
#include <queue>
+#include <algorithm>
#include "utils/conditional_variable.h"
#include "utils/lock.h"
-#include "utils/logger.h"
#include "utils/prioritized_queue.h"
/**
@@ -84,10 +84,11 @@ template<typename T, class Q = std::queue<T> > class MessageQueue {
void push(const T& element);
/**
- * \brief Removes element from the queue and returns it.
- * \return To element of the queue.
+ * \brief Removes element from the queue and returns it
+ * \param element Element to be returned
+ * \return True on success, false if queue is empty
*/
- T pop();
+ bool pop(T& element);
/**
* \brief Conditional wait.
@@ -95,6 +96,12 @@ template<typename T, class Q = std::queue<T> > class MessageQueue {
void wait();
/**
+ * \brief waitUntilEmpty message queue
+ * Wait until message queue is empty
+ */
+ void WaitUntilEmpty();
+
+ /**
* \brief Shutdown the queue.
* This leads to waking up everyone waiting on the queue
* Queue being shut down can be drained ( with pop() )
@@ -127,10 +134,6 @@ template<typename T, class Q> MessageQueue<T, Q>::MessageQueue()
}
template<typename T, class Q> MessageQueue<T, Q>::~MessageQueue() {
- if (!queue_.empty()) {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_ERROR(logger_, "Destruction of non-drained queue");
- }
}
template<typename T, class Q> void MessageQueue<T, Q>::wait() {
@@ -140,6 +143,13 @@ template<typename T, class Q> void MessageQueue<T, Q>::wait() {
}
}
+template<typename T, class Q> void MessageQueue<T, Q>::WaitUntilEmpty() {
+ sync_primitives::AutoLock auto_lock(queue_lock_);
+ while ((!shutting_down_) && !queue_.empty()) {
+ queue_new_items_.Wait(auto_lock);
+ }
+}
+
template<typename T, class Q> size_t MessageQueue<T, Q>::size() const {
sync_primitives::AutoLock auto_lock(queue_lock_);
return queue_.size();
@@ -158,31 +168,31 @@ template<typename T, class Q> void MessageQueue<T, Q>::push(const T& element) {
{
sync_primitives::AutoLock auto_lock(queue_lock_);
if (shutting_down_) {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_ERROR(logger_, "Runtime error, pushing into queue"
- " that is being shut down");
- return;
+ return;
}
- queue_.push(element);
+ queue_.push(element);
}
queue_new_items_.Broadcast();
}
-template<typename T, class Q> T MessageQueue<T, Q>::pop() {
+template<typename T, class Q> bool MessageQueue<T, Q>::pop(T& element) {
sync_primitives::AutoLock auto_lock(queue_lock_);
if (queue_.empty()) {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_ERROR(logger_, "Runtime error, popping out of empty queue");
- NOTREACHED();
+ return false;
}
- T result = queue_.front();
+ element = queue_.front();
queue_.pop();
- return result;
+ queue_new_items_.NotifyOne();
+ return true;
}
template<typename T, class Q> void MessageQueue<T, Q>::Shutdown() {
sync_primitives::AutoLock auto_lock(queue_lock_);
shutting_down_ = true;
+ if (!queue_.empty()) {
+ Queue empty_queue;
+ std::swap(queue_, empty_queue);
+ }
queue_new_items_.Broadcast();
}
@@ -191,7 +201,7 @@ template<typename T, class Q> void MessageQueue<T, Q>::Reset() {
shutting_down_ = false;
if (!queue_.empty()) {
Queue empty_queue;
- queue_.swap(empty_queue);
+ std::swap(queue_, empty_queue);
}
}
diff --git a/src/components/include/utils/messagemeter.h b/src/components/include/utils/messagemeter.h
index a5d9968d81..5f7237b4a0 100644
--- a/src/components/include/utils/messagemeter.h
+++ b/src/components/include/utils/messagemeter.h
@@ -152,7 +152,7 @@ void MessageMeter<Id>::set_time_range(const size_t time_range_msecs) {
const size_t mSecs =
time_range_msecs % date_time::DateTime::MILLISECONDS_IN_SECOND;
time_range_.tv_usec =
- mSecs * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ mSecs * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
}
template <class Id>
void MessageMeter<Id>::set_time_range(const TimevalStruct& time_range) {
diff --git a/src/components/include/utils/prioritized_queue.h b/src/components/include/utils/prioritized_queue.h
index 2a8ebf0a7b..3f9b293b9a 100644
--- a/src/components/include/utils/prioritized_queue.h
+++ b/src/components/include/utils/prioritized_queue.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
-#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
+#define SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
#include <queue>
#include <map>
-#include <iostream>
+#include <algorithm>
#include "utils/macro.h"
@@ -50,7 +50,7 @@ class PrioritizedQueue {
public:
typedef M value_type;
// std::map guarantees it's contents is sorted by key
- typedef std::map<size_t, std::queue<value_type> > QueuesMap;
+ typedef std::map<size_t, std::queue<value_type> > QueuesMap;
PrioritizedQueue()
: total_size_(0) {
}
@@ -66,6 +66,10 @@ class PrioritizedQueue {
bool empty() const {
return queues_.empty();
}
+ void swap(PrioritizedQueue<M>& x) {
+ std::swap(queues_, x.queues_);
+ std::swap(total_size_, x.total_size_);
+ }
value_type front() {
DCHECK(!queues_.empty() && !queues_.rbegin()->second.empty());
return queues_.rbegin()->second.front();
@@ -79,11 +83,12 @@ class PrioritizedQueue {
queues_.erase(last);
}
}
+
private:
QueuesMap queues_;
size_t total_size_;
};
-}
+} // namespace utils
-#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_PRIORITIZED_QUEUE_H_
diff --git a/src/components/include/utils/push_log.h b/src/components/include/utils/push_log.h
index 01389fb736..a96e484812 100644
--- a/src/components/include/utils/push_log.h
+++ b/src/components/include/utils/push_log.h
@@ -47,6 +47,13 @@ bool push_log(
const log4cxx::LogString& threadName
);
+void flush_logger();
+
+bool logs_enabled();
+void set_logs_enabled(bool state);
+
+void create_log_message_loop_thread();
+void delete_log_message_loop_thread();
} // namespace logger
#endif // SRC_COMPONENTS_INCLUDE_UTILS_PUSH_LOG_H_
diff --git a/src/components/include/utils/scope_guard.h b/src/components/include/utils/scope_guard.h
new file mode 100644
index 0000000000..c2accdba59
--- /dev/null
+++ b/src/components/include/utils/scope_guard.h
@@ -0,0 +1,332 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H
+#define SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H
+
+namespace utils {
+
+/**
+ * @brief The ScopeGuardImplBase class the class which allows to keep safety
+ * raw pointer within local scope. The same ScopeGuard has been provided by
+ * Andrej Alexandresku in the Loki library.
+ *
+ * The usage area example:
+ *
+ * Suppose user have to create some pointer in function call Init(). And in case
+ * of some fail condition this pointer has to be freed. So in order to avoid
+ * code duplicate as follows:
+ *
+ * bool SomeClass::Init() {
+ * memberObject_ = custom_allocate() // initialize member object with some value
+ * if(!some_condition) {
+ * custom_release(memberObject();
+ * return false;
+ * }
+ *
+ * if(!other_condition) {
+ * custom_release(memberObject)
+ * return false;
+ * }
+ * return true;
+ * }
+ *
+ * The user is able to use ScopeGuard, where possible to automatically call
+ * custom release function. See example bellow:
+ *
+ * bool SomeClass::Init() {
+ * memberObject_ = custom_allocate() // initialize member object with some value
+ * // The guard will call custom release function when it goes out of scope.
+ * ScopeGaurd guard = MakeGuard(custom_release, memberObject);
+ * if(!some_condition) {
+ * return false;
+ * }
+ *
+ * if(!other_condition) {
+ * return false;
+ * }
+ * // Here to avoid object releasing the user has to call Dismiss method.
+ * // So no custom release function will be called after return statement.
+ * guard.Dismiss();
+ * return true;
+ * }
+ */
+class ScopeGuardImplBase {
+ public:
+ /**
+ * @brief ScopeGuardImplBase the ScopeGuards constructor.
+ */
+ ScopeGuardImplBase(): dismissed_(false) {}
+
+
+
+ /**
+ * @brief Dismiss function which allows to dismiss releasing of stored object.
+ */
+ void Dismiss() const {
+ dismissed_ = true;
+ }
+
+ protected:
+ /**
+ * @brief ScopeGuardImplBase the copy constructor
+ *
+ * @param other the object that should be copied.
+ */
+ ScopeGuardImplBase(const ScopeGuardImplBase& other)
+ : dismissed_(other.dismissed_) {
+ other.Dismiss();
+ }
+
+ /**
+ * Allows to safely execute release function(i.e. it will be called only
+ * in case of releasing wasn't dismiss.)
+ */
+ template<typename T>
+ void SafeExecute(T& t) {
+ if (!t.dismissed_) {
+ t.Execute();
+ }
+ }
+
+ ~ScopeGuardImplBase() {}
+
+ mutable bool dismissed_;
+
+ private:
+ // Disallow copying via assign operator.
+ ScopeGuardImplBase& operator=(const ScopeGuardImplBase&);
+};
+
+/**
+ * The class which allows to bind some parameter with free function.
+ * I.E.
+ * void release(char* p){delete p;}
+ *
+ * ScopeGuard guard = MakeGuard(release, p);
+ *
+ * So the parameter p will be passed to the specified function.
+ */
+template<typename Function, typename Parameter1>
+class ScopeGuardImpl1: public ScopeGuardImplBase {
+ public:
+ /**
+ * @brief MakeGuard allows to create ScopeGuard object.
+ *
+ * @param fun function to call, when out of scope.
+ *
+ * @param p1 parameter which will be passed to the certain function.
+ *
+ * @return ScopeGuard object.
+ */
+ static ScopeGuardImpl1<Function, Parameter1> MakeGuard(
+ Function fun, const Parameter1& p1) {
+ return ScopeGuardImpl1<Function, Parameter1>(fun, p1);
+ }
+
+ /**
+ Execute the SafeExecute function in destructor.
+ */
+ ~ScopeGuardImpl1() {
+ SafeExecute(*this);
+ }
+
+ protected:
+
+ /**
+ * @brief Execute allows to execute certain function with certain parameter.
+ */
+ void Execute() {
+ fun_(p1_);
+ }
+
+ /**
+ * @brief ScopeGuardImpl1 create ScopeGuard object.
+ *
+ * @param f function object.
+ *
+ * @param p1 parameter to to pass to the function object.
+ */
+ ScopeGuardImpl1(const Function& f, const Parameter1& p1)
+ : fun_(f), p1_(p1) {}
+
+ private:
+ Function fun_;
+ const Parameter1 p1_;
+
+ friend class ScopeGuardImplBase;
+};
+
+/**
+ * The class which allows to call some member function in case of
+ * ScopeGuard object out of scope.
+ * I.E.
+ * vector<int> vec;
+ *
+ * // When function returns, the pop_back method for vector will be called.
+ * void foo() {
+ * ScopeGuard guard = MakeObjGuard(vec, &vector::pop_back);
+ * vec.push_back(5);
+ * }
+ */
+template<typename Obj, typename MemFun>
+class ObjScopeGuardImpl0: public ScopeGuardImplBase {
+ public:
+ /**
+ * @brief MakeObjGuard creates ScopeGuard object.
+ *
+ * @param obj object whose method will be called.
+ *
+ * @param memFun the method to call.
+ *
+ * @return ScopeGuard object.
+ */
+ static ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(
+ Obj& obj, MemFun memFun) {
+ return ObjScopeGuardImpl0<Obj, MemFun>(obj, memFun);
+ }
+
+ /**
+ Execute the SafeExecute function in destructor.
+ */
+ ~ObjScopeGuardImpl0() {
+ SafeExecute(*this);
+ }
+
+ protected:
+
+ /**
+ * @brief Execute allows to execute certain function with certain parameter.
+ */
+ void Execute() {
+ (obj_.*memFun_)();
+ }
+
+ /**
+ * @brief ObjScopeGuardImpl0 Create ScopeGuard object.
+ *
+ * @param obj object whose method will be called.
+ *
+ * @param memFun the method to call.
+ *
+ * @return ScopeGuard object.
+ */
+ ObjScopeGuardImpl0(Obj& obj, MemFun memFun) : obj_(obj), memFun_(memFun) {}
+
+ private:
+ Obj& obj_;
+ MemFun memFun_;
+ friend class ScopeGuardImplBase;
+};
+
+/**
+ * The class which allows to call some member function with certain parameter
+ * in case of ScopeGuard object out of scope.
+
+ */
+template<typename Obj, typename MemFun, typename Parameter1>
+class ObjScopeGuardImpl1: public ScopeGuardImplBase {
+ public:
+ /**
+ * @brief MakeObjGuard creates ScopeGuard object.
+ *
+ * @param obj object whose method will be called.
+ *
+ * @param memFun the method to call.
+ *
+ * @param p1 the parameter to pass to the member function.
+ *
+ * @return ScopeGuard object.
+ */
+ static ObjScopeGuardImpl1<Obj, MemFun, Parameter1> MakeObjGuard(
+ Obj& obj, MemFun memFun, const Parameter1& p1) {
+ return ObjScopeGuardImpl1<Obj, MemFun, Parameter1>(obj, memFun, p1);
+ }
+
+ /**
+ Execute the SafeExecute function in destructor.
+ */
+ ~ObjScopeGuardImpl1() {
+ SafeExecute(*this);
+ }
+
+ protected:
+ /**
+ * @brief Execute allows to execute certain function with certain parameter.
+ */
+ void Execute() {
+ (obj_.*memFun_)(p1_);
+ }
+
+ /**
+ * @brief MakeObjGuard creates ScopeGuard object.
+ *
+ * @param obj object whose method will be called.
+ *
+ * @param memFun the method to call.
+ *
+ * @param p1 the parameter to pass to the member function.
+ *
+ * @return ScopeGuard object.
+ */
+ ObjScopeGuardImpl1(Obj& obj, MemFun memFun, const Parameter1& p1)
+ : obj_(obj),
+ memFun_(memFun),
+ p1_(p1) {}
+
+ private:
+ Obj& obj_;
+ MemFun memFun_;
+ const Parameter1 p1_;
+ friend class ScopeGuardImplBase;
+};
+
+typedef const ScopeGuardImplBase& ScopeGuard;
+
+template <typename F, typename P1>
+ScopeGuardImpl1<F, P1> MakeGuard(F fun, P1 p1) {
+ return ScopeGuardImpl1<F, P1>::MakeGuard(fun, p1);
+}
+
+template <typename Obj, typename MemFun>
+ObjScopeGuardImpl0<Obj, MemFun> MakeObjGuard(Obj& obj, MemFun memFun) {
+ return ObjScopeGuardImpl0<Obj, MemFun>::MakeObjGuard(obj, memFun);
+}
+
+template <typename Obj, typename MemFun, typename P1>
+ObjScopeGuardImpl1<Obj, MemFun, P1> MakeObjGuard(
+ Obj& obj, MemFun memFun, const P1& p1) {
+ return ObjScopeGuardImpl1<Obj, MemFun, P1>::MakeObjGuard(obj, memFun, p1);
+}
+
+}
+#endif // SRC_COMPONENTS_INCLUDE_UTILS_SCOPE_GUARD_H
diff --git a/src/components/include/utils/shared_ptr.h b/src/components/include/utils/shared_ptr.h
index f506c6018e..d8701eb1f3 100644
--- a/src/components/include/utils/shared_ptr.h
+++ b/src/components/include/utils/shared_ptr.h
@@ -53,7 +53,7 @@ namespace utils {
template<typename ObjectType>
class SharedPtr {
public:
- //std smart pointer compability
+ //std smart pointer compatibility
typedef ObjectType element_type;
/**
* @brief Constructor.
@@ -120,7 +120,7 @@ class SharedPtr {
bool operator ==(const SharedPtr<ObjectType>& Other) const;
- bool operator< (const SharedPtr<ObjectType>& other) const;
+ bool operator <(const SharedPtr<ObjectType>& other) const;
/**
* @brief Assignment operator.
@@ -166,6 +166,12 @@ class SharedPtr {
void reset(ObjectType* other);
ObjectType* get() const;
+#ifdef BUILD_TESTS
+ inline const uint32_t* get_ReferenceCounter() const {
+ return mReferenceCounter;
+ }
+#endif // BUILD_TESTS
+
/**
* @return true if mObject not NULL
*/
@@ -249,7 +255,7 @@ inline bool utils::SharedPtr<ObjectType>::operator ==(
}
template<typename ObjectType>
-inline bool utils::SharedPtr<ObjectType>::operator< (
+inline bool utils::SharedPtr<ObjectType>::operator <(
const SharedPtr<ObjectType>& other) const {
return (mObject < other.mObject);
}
diff --git a/src/components/include/utils/threads/message_loop_thread.h b/src/components/include/utils/threads/message_loop_thread.h
index 6f90df209c..51fcfd8aba 100644
--- a/src/components/include/utils/threads/message_loop_thread.h
+++ b/src/components/include/utils/threads/message_loop_thread.h
@@ -41,6 +41,7 @@
#include "utils/message_queue.h"
#include "utils/threads/thread.h"
#include "utils/shared_ptr.h"
+#include "utils/lock.h"
namespace threads {
@@ -67,7 +68,8 @@ class MessageLoopThread {
* Method called by MessageLoopThread to process single message
* from it's queue. After calling this method message is discarded.
*/
- virtual void Handle(const Message message) = 0; // TODO(dchmerev): Use reference?
+ // TODO (AKozoriz) : change to const reference (APPLINK-20235)
+ virtual void Handle(const Message message) = 0;
virtual ~Handler() {}
};
@@ -86,12 +88,22 @@ class MessageLoopThread {
// Process already posted messages and stop thread processing. Thread-safe.
void Shutdown();
+ // Added for utils/test/auto_trace_test.cc
+ size_t GetMessageQueueSize() const;
+
+ /*
+ * Wait until message queue will be empty
+ */
+ void WaitDumpQueue();
+
private:
/*
* Implementation of ThreadDelegate that actually pumps the queue and is
* able to correctly shut it down
*/
- struct LoopThreadDelegate : public threads::ThreadDelegate {
+ class LoopThreadDelegate : public threads::ThreadDelegate {
+
+ public:
LoopThreadDelegate(MessageQueue<Message, Queue>* message_queue,
Handler* handler);
@@ -117,6 +129,11 @@ class MessageLoopThread {
///////// Implementation
template<class Q>
+size_t MessageLoopThread<Q>::GetMessageQueueSize() const {
+ return message_queue_.size();
+}
+
+template<class Q>
MessageLoopThread<Q>::MessageLoopThread(const std::string& name,
Handler* handler,
const ThreadOptions& thread_opts)
@@ -133,7 +150,6 @@ MessageLoopThread<Q>::MessageLoopThread(const std::string& name,
template<class Q>
MessageLoopThread<Q>::~MessageLoopThread() {
Shutdown();
- thread_->join();
delete thread_delegate_;
threads::DeleteThread(thread_);
}
@@ -145,7 +161,12 @@ void MessageLoopThread<Q>::PostMessage(const Message& message) {
template <class Q>
void MessageLoopThread<Q>::Shutdown() {
- thread_->stop();
+ thread_->join();
+}
+
+template<class Q>
+void MessageLoopThread<Q>::WaitDumpQueue() {
+ message_queue_.WaitUntilEmpty();
}
//////////
@@ -172,16 +193,18 @@ void MessageLoopThread<Q>::LoopThreadDelegate::threadMain() {
template<class Q>
void MessageLoopThread<Q>::LoopThreadDelegate::exitThreadMain() {
- CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
- LOG4CXX_AUTO_TRACE(logger_);
message_queue_.Shutdown();
}
template<class Q>
void MessageLoopThread<Q>::LoopThreadDelegate::DrainQue() {
while (!message_queue_.empty()) {
- handler_.Handle(message_queue_.pop());
+ Message msg;
+ if (message_queue_.pop(msg)) {
+ handler_.Handle(msg);
+ }
}
}
+
} // namespace threads
#endif // SRC_COMPONENTS_INCLUDE_UTILS_THREADS_MESSAGE_LOOP_THREAD_H_
diff --git a/src/components/include/utils/threads/thread.h b/src/components/include/utils/threads/thread.h
index fd2b5e9fd9..7791a4f754 100644
--- a/src/components/include/utils/threads/thread.h
+++ b/src/components/include/utils/threads/thread.h
@@ -124,7 +124,6 @@ class Thread {
}
void set_delegate(ThreadDelegate *delegate) {
- DCHECK(!isThreadRunning_);
delegate_ = delegate;
}
@@ -132,6 +131,10 @@ class Thread {
friend void DeleteThread(Thread* thread);
public:
+
+ // Yield current thread
+ static void yield();
+
// Get unique ID of currently executing thread
static PlatformThreadHandle CurrentId();
diff --git a/src/components/include/utils/timer_thread.h b/src/components/include/utils/timer_thread.h
deleted file mode 100644
index 4236c4e46f..0000000000
--- a/src/components/include/utils/timer_thread.h
+++ /dev/null
@@ -1,449 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_INCLUDE_UTILS_TIMER_THREAD_H_
-#define SRC_COMPONENTS_INCLUDE_UTILS_TIMER_THREAD_H_
-
-#include <time.h>
-#include <inttypes.h>
-#include <cstdint>
-#include <limits>
-#include <string>
-
-#include "utils/conditional_variable.h"
-#include "utils/lock.h"
-#include "utils/logger.h"
-#include "utils/macro.h"
-#include "utils/timer_thread.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
-
-namespace timer {
-// TODO(AKutsan): Remove this logger after bugfix
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
-
-class TimerDelegate;
-
-/**
- * \class TimerThread
- * \brief TimerThread class provide possibility to run timer in a separate thread.
- * The client should specify callee and const callback function.
- * Example usage:
- *
- * Create timer in mobile request
- *
- * timer::TimerThread<MobileRequest> timer(this, &MobileRequest::onTimeOut);
- * timer.start(10);
- *
- * some actions
- *
- * To stop timer call timer.stop();
- *
- */
-template<class T>
-class TimerThread {
- public:
- friend class TimerDelegate;
- friend class TimerLooperDelegate;
-
- /**
- * @brief Default constructor
- *
- * @param name - display string to identify the thread.
- * @param callee A class that use timer
- * @param f CallBackFunction which will be called on timeout
- * Attention! "f()" will be called not in main thread but in timer thread
- * Never use stop() and start() methods inside f
- * @param is_looper Define this timer as looper,
- * if true, TimerThread will call "f()" function every time out
- * until stop()
- */
- TimerThread(const char* name, T* callee, void (T::*f)(), bool is_looper =
- false);
-
- /**
- * @brief Destructor
- */
- virtual ~TimerThread();
-
- /**
- * @brief Starts timer for specified timeout.
- * Previously started timeout will be set to new value.
- * On timeout TimerThread::onTimeOut interface will be called.
- * Must not be used in callback function!
- *
- * @param timeout_seconds Timeout in seconds to be set
- */
- virtual void start(uint32_t timeout_seconds);
-
- /**
- * @brief Starts timer for specified timeout.
- * Previously started timeout will be set to new value.
- * On timeout TimerThread::onTimeOut interface will be called.
- * Must not be used in callback function!
- *
- * @param timeout_seconds Timeout in seconds to be set
- *
- * @param callee A class that use timer
- *
- * @param allBackFunction which will be called on timeout
- * Attention! "f()" will be called not in main thread but in timer thread
- * Never use stop() and start() methods inside f
- */
- virtual void start(uint32_t timeout_seconds, T* callee, void (T::*f)());
-
- /**
- * @brief Stops timer execution
- * Must not be used in callback function!
- */
- virtual void stop();
-
- /**
- * @brief Tell timer status
- * @return true if timer is currently running, otherwise return false
- */
- virtual bool isRunning();
-
- /**
- * @brief Suspends timer execution after next loop.
- */
- virtual void suspend();
-
- /**
- * @brief Stop timer update timeout and start timer again
- * Note that it cancel thread of timer, If you use it from callback,
- * it probably will stop execution of callback function
- * @param timeout_seconds new timeout value
- *
- */
- virtual void updateTimeOut(const uint32_t timeout_seconds);
-
- protected:
- /**
- * @brief Interface called by delegator on timeout
- */
- void onTimeOut() const;
-
- private:
- /**
- * @brief Delegate release timer, will call callback function one time
- */
- class TimerDelegate : public threads::ThreadDelegate {
- public:
- /**
- * @brief Default constructor
- *
- * @param timer_thread The Timer_thread pointer
- */
- explicit TimerDelegate(TimerThread* timer_thread);
-
- /**
- * @brief Destructor
- */
- virtual ~TimerDelegate();
-
- /**
- * @brief Thread main function.
- */
- virtual void threadMain();
-
- /**
- * @brief Called by thread::thread to free all allocated resources.
- */
- virtual void exitThreadMain();
-
- /**
- * @brief Set new Timeout
- * @param timeout_seconds New timeout to be set
- */
- virtual void setTimeOut(const uint32_t timeout_seconds);
-
- /**
- * @brief Quits threadMain function after next loop.
- */
- virtual void shouldBeStoped();
-
- /**
- * @brief Restarts non-loop timer after current iteration.
- */
- virtual void shouldBeRestarted();
-
- protected:
- TimerThread* timer_thread_;
- uint32_t timeout_seconds_;
- sync_primitives::Lock state_lock_;
- sync_primitives::ConditionalVariable termination_condition_;
- volatile bool stop_flag_;
- sync_primitives::Lock restart_flag_lock_;
- volatile bool restart_flag_;
- int32_t calculateMillisecondsLeft();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TimerDelegate);
- };
-
- /**
- * @brief Delegate release looper timer.
- * Will call delegate every timeout function while stop()
- * won't be called
- */
- class TimerLooperDelegate : public TimerDelegate {
- public:
- /**
- * @brief Default constructor
- *
- * @param timer_thread The Timer_thread pointer
- * @param timeout Timeout to be set
- */
- explicit TimerLooperDelegate(TimerThread* timer_thread);
-
- /**
- * @brief Thread main function.
- */
- virtual void threadMain();
-
- private:
- DISALLOW_COPY_AND_ASSIGN(TimerLooperDelegate);
- };
- threads::Thread* thread_;
- void (T::*callback_)();
- T* callee_;
- TimerDelegate* delegate_;
- std::string name_;
- volatile bool is_looper_;
-
- DISALLOW_COPY_AND_ASSIGN(TimerThread);
-};
-
-template<class T>
-TimerThread<T>::TimerThread(const char* name, T* callee, void (T::*f)(),
- bool is_looper)
- : thread_(NULL),
- callback_(f),
- callee_(callee),
- delegate_(NULL),
- name_(name),
- is_looper_(is_looper) {
- delegate_ =
- is_looper_ ? new TimerLooperDelegate(this) : new TimerDelegate(this);
-
- thread_ = threads::CreateThread(name_.c_str(), delegate_);
-}
-
-template<class T>
-TimerThread<T>::~TimerThread() {
- LOG4CXX_DEBUG(logger_, "TimerThread is to be destroyed " << name_);
- thread_->join();
- delete delegate_;
- threads::DeleteThread(thread_);
- callback_ = NULL;
- callee_ = NULL;
-}
-
-template<class T>
-void TimerThread<T>::start(uint32_t timeout_seconds) {
- LOG4CXX_AUTO_TRACE(logger_);
- if (isRunning()) {
- LOG4CXX_INFO(logger_, "Restart timer in thread " << name_);
- delegate_->shouldBeRestarted();
- updateTimeOut(timeout_seconds);
- } else {
- updateTimeOut(timeout_seconds);
- thread_->start();
- }
-}
-
-template<class T>
-void TimerThread<T>::start(uint32_t timeout_seconds, T* callee,
- void (T::*f)()) {
- callee_ = callee;
- callback_ = f;
- start(timeout_seconds);
-}
-
-template<class T>
-void TimerThread<T>::stop() {
- LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(thread_);
- LOG4CXX_DEBUG(logger_, "Stopping timer " << name_);
- thread_->join();
-}
-
-template<class T>
-bool TimerThread<T>::isRunning() {
- DCHECK(thread_);
- return thread_->is_running();
-}
-
-template<class T>
-void TimerThread<T>::suspend() {
- LOG4CXX_DEBUG(logger_, "Suspend timer " << name_ << " after next loop");
- delegate_->shouldBeStoped();
-}
-
-template<class T>
-void TimerThread<T>::updateTimeOut(const uint32_t timeout_seconds) {
- delegate_->setTimeOut(timeout_seconds);
-}
-
-template<class T> void TimerThread<T>::onTimeOut() const {
- if (callee_ && callback_) {
- (callee_->*callback_)();
- }
-}
-
-template<class T>
-TimerThread<T>::TimerDelegate::TimerDelegate(TimerThread* timer_thread)
- : timer_thread_(timer_thread),
- timeout_seconds_(0),
- state_lock_(true),
- stop_flag_(false),
- restart_flag_(false) {
- DCHECK(timer_thread_);
-}
-
-template<class T>
-TimerThread<T>::TimerLooperDelegate::TimerLooperDelegate(
- TimerThread* timer_thread)
- : TimerDelegate(timer_thread) {
-}
-
-template<class T>
-TimerThread<T>::TimerDelegate::~TimerDelegate() {
- timer_thread_ = NULL;
-}
-
-template<class T>
-void TimerThread<T>::TimerDelegate::threadMain() {
- using sync_primitives::ConditionalVariable;
- sync_primitives::AutoLock auto_lock(state_lock_);
- stop_flag_ = false;
- while (!stop_flag_) {
- // Sleep
- int32_t wait_milliseconds_left = TimerDelegate::calculateMillisecondsLeft();
- ConditionalVariable::WaitStatus wait_status =
- termination_condition_.WaitFor(auto_lock, wait_milliseconds_left);
- // Quit sleeping or continue sleeping in case of spurious wake up
- if (ConditionalVariable::kTimeout == wait_status
- || wait_milliseconds_left <= 0) {
- LOG4CXX_TRACE(logger_,
- "Timer timeout " << wait_milliseconds_left << " ms");
- timer_thread_->onTimeOut();
- } else {
- LOG4CXX_DEBUG(logger_,
- "Timeout reset force: " << TimerDelegate::timeout_seconds_);
- }
- {
- sync_primitives::AutoLock auto_lock(restart_flag_lock_);
- if (!restart_flag_) {
- return;
- }
- restart_flag_ = false;
- }
- }
-}
-
-template<class T>
-void TimerThread<T>::TimerLooperDelegate::threadMain() {
- using sync_primitives::ConditionalVariable;
- sync_primitives::AutoLock auto_lock(TimerDelegate::state_lock_);
- TimerDelegate::stop_flag_ = false;
- while (!TimerDelegate::stop_flag_) {
- int32_t wait_milliseconds_left = TimerDelegate::calculateMillisecondsLeft();
- ConditionalVariable::WaitStatus wait_status =
- TimerDelegate::termination_condition_.WaitFor(auto_lock,
- wait_milliseconds_left);
- // Quit sleeping or continue sleeping in case of spurious wake up
- if (ConditionalVariable::kTimeout == wait_status
- || wait_milliseconds_left <= 0) {
- LOG4CXX_TRACE(logger_,
- "Timer timeout " << wait_milliseconds_left << " ms");
- TimerDelegate::timer_thread_->onTimeOut();
- } else {
- LOG4CXX_DEBUG(logger_,
- "Timeout reset force: " << TimerDelegate::timeout_seconds_);
- }
- }
-}
-
-template<class T>
-void TimerThread<T>::TimerDelegate::exitThreadMain() {
- shouldBeStoped();
- termination_condition_.NotifyOne();
-}
-
-template<class T>
-void TimerThread<T>::TimerDelegate::setTimeOut(const uint32_t timeout_seconds) {
- timeout_seconds_ = timeout_seconds;
- termination_condition_.NotifyOne();
-}
-
-template<class T>
-void TimerThread<T>::TimerDelegate::shouldBeStoped() {
- {
- sync_primitives::AutoLock auto_lock(state_lock_);
- stop_flag_ = true;
- }
- {
- sync_primitives::AutoLock auto_lock(restart_flag_lock_);
- restart_flag_ = false;
- }
-}
-
-template<class T>
-void TimerThread<T>::TimerDelegate::shouldBeRestarted() {
- sync_primitives::AutoLock auto_lock(restart_flag_lock_);
- restart_flag_ = true;
-}
-
-template<class T>
-int32_t TimerThread<T>::TimerThread::TimerDelegate::calculateMillisecondsLeft() {
- time_t cur_time = time(NULL);
- time_t end_time = std::numeric_limits<time_t>::max();
- if (TimerDelegate::timeout_seconds_ + cur_time
- > TimerDelegate::timeout_seconds_) { // no overflow occurred
- end_time = cur_time + TimerDelegate::timeout_seconds_;
- }
-
- int64_t wait_seconds_left = static_cast<int64_t>(difftime(end_time, cur_time));
- int32_t wait_milliseconds_left = std::numeric_limits<int32_t>::max();
- const int32_t milliseconds_in_second = 1000;
- if (wait_seconds_left
- < std::numeric_limits<int32_t>::max() / milliseconds_in_second) {
- wait_milliseconds_left = milliseconds_in_second * wait_seconds_left;
- }
- return wait_milliseconds_left;
-}
-
-} // namespace timer
-
-#endif // SRC_COMPONENTS_INCLUDE_UTILS_TIMER_THREAD_H_
diff --git a/src/components/interfaces/HMI_API.xml b/src/components/interfaces/HMI_API.xml
index 62f3d2a10f..f16dc972dc 100644
--- a/src/components/interfaces/HMI_API.xml
+++ b/src/components/interfaces/HMI_API.xml
@@ -65,12 +65,11 @@
</enum>
<enum name="TransportType">
- <description>
- Lists of the transport types used for device connection to HU.
- </description>
- <element name="BLUETOOTH"/>
- <element name="USB"/>
- <element name="WIFI"/>
+ <description>Lists of the transport types used for device connection to HU.</description>
+ <element name="BLUETOOTH"/>
+ <element name="USB_IOS"/>
+ <element name="USB_AOA"/>
+ <element name="WIFI"/>
</enum>
<enum name="ButtonName">
@@ -185,6 +184,21 @@
<element name="NO-NO" internal_name="NO_NO">
<description>Norwegian - Norway</description>
</element>
+ <element name="NL-BE" internal_name="NL_BE">
+ <description>Dutch (Flemish) - Belgium</description>
+ </element>
+ <element name="EL-GR" internal_name="EL_GR">
+ <description>Greek - Greece</description>
+ </element>
+ <element name="HU-HU" internal_name="HU_HU">
+ <description>Hungarian - Hungary</description>
+ </element>
+ <element name="FI-FI" internal_name="FI_FI">
+ <description>Finnish - Finland</description>
+ </element>
+ <element name="SK-SK" internal_name="SK_SK">
+ <description>Slovak - Slovakia</description>
+ </element>
</enum>
<enum name="SoftButtonType">
@@ -235,28 +249,6 @@
<description>This mode causes the interaction to immediately display a keyboard entry through the HMI.</description>
</enum>
-<enum name="DeactivateReason">
- <description>Specifies the functionality the User has switched to.</description>
- <element name="AUDIO">
- <description>Navigated to audio(radio, etc)</description>
- </element>
- <element name="PHONECALL">
- <description>Navigated to make a call.</description>
- </element>
- <element name="NAVIGATIONMAP">
- <description>Navigated to navigation screen.</description>
- </element>
- <element name="PHONEMENU">
- <description>Navigated to phone menu.</description>
- </element>
- <element name="SYNCSETTINGS">
- <description>Navigated to settings menu.</description>
- </element>
- <element name="GENERAL">
- <description>Other screens navigation apart from other mobile app.</description>
- </element>
-</enum>
-
<enum name="ClockUpdateMode">
<description>Describes how the media clock timer should behave on the platform</description>
<element name="COUNTUP" />
@@ -382,10 +374,19 @@
<element name="DYNAMIC" />
</enum>
-<enum name="ApplicationToNONEReason">
- <description>Describes the reasons of moving the app to NONE.</description>
- <element name="DRIVER_DISTRACTION_VIOLATION" />
- <element name="USER_EXIT" />
+<enum name="ApplicationExitReason">
+ <element name="DRIVER_DISTRACTION_VIOLATION" >
+ <description>By getting this value, SDL puts the named app to NONE HMILevel</description>
+ </element>
+ <element name="USER_EXIT" >
+ <description>By getting this value, SDL puts the named app to NONE HMILevel</description>
+ </element>
+ <element name="UNAUTHORIZED_TRANSPORT_REGISTRATION">
+ <description>By getting this value, SDL unregisters the named application</description>
+ </element>
+ <element name="UNSUPPORTED_HMI_RESOURCE">
+ <description>By getting this value, SDL unregisters the named application</description>
+ </element>
</enum>
<enum name="TextFieldName">
@@ -1162,6 +1163,25 @@
<element name="NONE"/>
</enum>
+<enum name="EventTypes">
+ <description>Reflects the current active event</description>
+ <element name="AUDIO_SOURCE">
+ <description>Navigated to audio(radio, etc)</description>
+ </element>
+ <element name="EMBEDDED_NAVI">
+ <description>Navigated to navigation screen</description>
+ </element>
+ <element name="PHONE_CALL">
+ <description>Phone call is active</description>
+ </element>
+ <element name="EMERGENCY_EVENT">
+ <description>Active emergency event, active parking event</description>
+ </element>
+ <element name="DEACTIVATE_HMI">
+ <description> GAL/DIO is active </description>
+ </element>
+</enum>
+
<!-- Policies -->
<enum name="UpdateResult">
<element name="UP_TO_DATE"/>
@@ -1303,7 +1323,7 @@
<description>The name of the device connected.</description>
</param>
<param name="id" type="String" mandatory="true">
- <description>The ID of the device connected</description>
+ <description>The ID of the device connectedi: either hash of device's USB serial number(in case of USB connection) or has of device's MAC address(in case of BlueTooth or WIFI connection</description>
</param>
<param name="transportType" type="Common.TransportType" mandatory="false">
<description>The transport type the named-app's-device is connected over HU(BlueTooth, USB or WiFi). It must be provided in OnAppRegistered and in UpdateDeviceList</description>
@@ -1393,7 +1413,7 @@
</param>
<param name="greyOut" type="Boolean" mandatory="false">
<description>Indicates whether application should be dimmed on the screen.</description>
- <description>In case app is not in foreground SDL must notify HMI to grey out the corresponding apps-available-for-launching and currently not registered</description>
+ <description>Applicable only for apps received through QueryApps and still not registered.</description>
</param>
<param name="requestType" type="Common.RequestType" minsize="0" maxsize="100" array="true" mandatory="false">
<description>The list of SystemRequest's RequestTypes allowed by policies for the named application</description>
@@ -1438,7 +1458,7 @@
<param name="tertiaryText" maxlength="500" type="String" mandatory="false">
<description>Optional tertiary text to display; e.g. distance to POI for a search result entry</description>
</param>
- <param name="secondaryImage" type="Image" mandatory="false">
+ <param name="secondaryImage" type="Common.Image" mandatory="false">
<description>Optional secondary image struct for choice</description>
</param>
</struct>
@@ -2104,9 +2124,6 @@
<param name="appID" type="Integer" mandatory="true">
<description>ID of deactivated application.</description>
</param>
- <param name="reason" type="Common.DeactivateReason" mandatory="true">
- <description>Specifies the functionality the user has switched to.</description>
- </param>
</function>
<function name="OnAppRegistered" messagetype="notification">
<description>Issued by SDL to notify HMI about new application registered.</description>
@@ -2152,7 +2169,7 @@
</function>
<function name="OnExitApplication" messagetype="notification">
<description>Must be sent by HMI when the User chooses to exit the application..</description>
- <param name="reason" type="Common.ApplicationToNONEReason" mandatory="true">
+ <param name="reason" type="Common.ApplicationExitReason" mandatory="true">
<description>Specifies reason of moving the app to NONE</description>
</param>
<param name="appID" type="Integer" mandatory="true">
@@ -2179,15 +2196,19 @@
<description>Must be true if supported</description>
</param>
</function>
- <function name="PlayTone" messagetype="notification">
- <description>Sent by SDL to HMI to notify that the tone should be played.</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of the application that invoked this notification</description>
+ <function name="DialNumber" messagetype="request">
+ <description>Request from SDL to call a specific number.</description>
+ <param name="number" type="String" maxlength="40">
+ <description>The number to dial. Only the character + and numbers are allowed.</description>
</param>
- <param name="methodName" type="Common.MethodName" mandatory="true">
- <description>Defines the name of app's request that initiates playing a tone</description>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application that concerns this RPC.</description>
</param>
</function>
+
+ <function name="DialNumber" messagetype="response">
+ </function>
+
<!-- Policies -->
<!-- SyncP RPC-->
@@ -2328,6 +2349,25 @@
<description>Notification from system to SDL to let it know that ignition cycle is over.</description>
</function>
<!-- End of Policies -->
+ <function name="OnDeactivateHMI" messagetype="notification">
+ <description>
+ Sender: HMI->SDL. When: in case GAL/DIO is active or disabling
+ </description>
+ <param name="isDeactivated" type="Boolean" mandatory="true">
+ <description>
+ Must be 'true' - GAL/DIO is active. Must be 'false' when GAL/DIO is disabling
+ </description>
+ </param>
+ </function>
+ <function name="OnEventChanged" messagetype="notification">
+ <description>Sender: HMI->SDL. When event is become active</description>
+ <param name="eventName" type="Common.EventTypes" mandatory="true">
+ <description>Specifies the types of active events.</description>
+ </param>
+ <param name="isActive" type="Boolean" mandatory="true">
+ <description>Must be 'true' - when the event is started on HMI. Must be 'false' when the event is ended on HMI</description>
+ </param>
+ </function>
</interface>
<interface name="VR" version="1.0" date="2013-04-17">
@@ -2411,6 +2451,9 @@
IDs of the specific compiled grammars for this voice interaction.
</description>
</param>
+ <param name="appID" type="Integer" mandatory="true">
+ <description>ID of application related to this RPC.</description>
+ </param>
</function>
<function name="PerformInteraction" messagetype="response">
<param name="choiceID" type="Integer" minvalue="0" maxvalue="2000000000" mandatory="false">
@@ -2514,6 +2557,9 @@
<param name="speakType" type="Common.MethodName" mandatory="false">
<description>Defines the type of the request which causes text-to-speech</description>
</param>
+ <param name="playTone" type="Boolean" mandatory="false">
+ <description>Defines that the tone should be played</description>
+ </param>
</function>
<function name="Speak" messagetype="response">
<description>Provides information about success of operation.</description>
@@ -2758,14 +2804,14 @@
<function name="SetMediaClockTimer" messagetype="request">
<description>Sets the initial media clock value and automatic update method.</description>
<param name="startTime" type="Common.TimeFormat" mandatory="false">
- <description>startTime should be ignored for "PAUSE", "RESUME", and "CLEAR"</description>
+ <description>SDL transfers startTime together with modes: "COUNTUP", "COUNTDOWN", "PAUSE" to HMI.
+ SDL ignores startTime for modes: "RESUME", and "CLEAR"</description>
</param>
<param name="endTime" type="Common.TimeFormat" mandatory="false">
<description>
See TimeFormat.
- endTime can be provided for "COUNTUP" and "COUNTDOWN"; to be used to calculate any visual progress bar (if not provided, this feature is ignored)
- If endTime is greater then startTime for COUNTDOWN or less than startTime for COUNTUP, then the request will return an INVALID_DATA.
- endTime will be ignored for "PAUSE", "RESUME", and "CLEAR"
+ SDL transfers endTime together with modes: "COUNTUP", "COUNTDOWN", "PAUSE" to HMI. To be used to calculate any visual progress bar (if not provided, this feature is ignored).
+ SDL ignores endTime for modes: "RESUME", and "CLEAR"
</description>
</param>
<param name="updateMode" type="Common.ClockUpdateMode" mandatory="true">
@@ -2832,7 +2878,7 @@
</param>
<param name="audioPassThruCapabilities" type="Common.AudioPassThruCapabilities" mandatory="true"/>
<param name="hmiZoneCapabilities" type="Common.HmiZoneCapabilities" mandatory="true"/>
- <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" mandatory="false">
+ <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>Must be returned if the platform supports on-screen SoftButtons.</description>
</param>
<param name="hmiCapabilities" type="Common.HMICapabilities" mandatory="false">
@@ -3196,7 +3242,7 @@
</param>
</function>
<function name="StartStream" messagetype="request">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
<param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
<description>URL that HMI start playing.</description>
</param>
@@ -3207,7 +3253,7 @@
<function name="StartStream" messagetype="response">
</function>
<function name="StopStream" messagetype="request">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to stop playing video streaming.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application related to this RPC.</description>
</param>
@@ -3215,7 +3261,7 @@
<function name="StopStream" messagetype="response">
</function>
<function name="StartAudioStream" messagetype="request">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
<param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
<description>URL that HMI start playing.</description>
</param>
@@ -3226,7 +3272,7 @@
<function name="StartAudioStream" messagetype="response">
</function>
<function name="StopAudioStream" messagetype="request">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to stop playing audio streaming.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application related to this RPC.</description>
</param>
@@ -3335,9 +3381,6 @@
The application will be notified by the onVehicleData notification whenever new data is available.
To unsubscribe the notifications, use unsubscribe with the same subscriptionType.
</description>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application that requested this RPC.</description>
- </param>
<param name="gps" type="Boolean" mandatory="false">
<description>See GPSData</description>
</param>
@@ -3724,9 +3767,6 @@
<param name="myKey" type="Boolean" mandatory="false">
<description>Information related to the MyKey feature</description>
</param>
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="GetVehicleData" messagetype="response">
<param name="gps" type="Common.GPSData" mandatory="false">
diff --git a/src/components/interfaces/MOBILE_API.xml b/src/components/interfaces/MOBILE_API.xml
index 5430aedbf1..1892df6da1 100644
--- a/src/components/interfaces/MOBILE_API.xml
+++ b/src/components/interfaces/MOBILE_API.xml
@@ -231,6 +231,21 @@
<element name="NO-NO" internal_name="NO_NO">
<description>Norwegian - Norway</description>
</element>
+ <element name="NL-BE" internal_name="NL_BE">
+ <description>Dutch (Flemish) - Belgium</description>
+ </element>
+ <element name="EL-GR" internal_name="EL_GR">
+ <description>Greek - Greece</description>
+ </element>
+ <element name="HU-HU" internal_name="HU_HU">
+ <description>Hungarian - Hungary</description>
+ </element>
+ <element name="FI-FI" internal_name="FI_FI">
+ <description>Finnish - Finland</description>
+ </element>
+ <element name="SK-SK" internal_name="SK_SK">
+ <description>Slovak - Slovakia</description>
+ </element>
</enum>
<enum name="UpdateMode">
@@ -370,6 +385,7 @@
<element name="FACTORY_DEFAULTS" />
<element name="APP_UNAUTHORIZED" />
<element name="PROTOCOL_VIOLATION" />
+ <element name="UNSUPPORTED_HMI_RESOURCE" />
</enum>
<enum name="TriggerSource">
@@ -4960,7 +4976,7 @@
<param name="url" type="String" maxlength="1000" minsize="1" maxsize="100" array="true" mandatory="false">
<description>
Optional URL for HTTP requests.
- If blank, the binary data shall be forwarded to the app.
+ If blank, the binary data shall be forwarded to the app.
If not blank, the binary data shall be forwarded to the url with a provided timeout in seconds.
</description>
</param>
diff --git a/src/components/interfaces/QT_HMI_API.xml b/src/components/interfaces/QT_HMI_API.xml
index eab9edb864..85a4d4143f 100644
--- a/src/components/interfaces/QT_HMI_API.xml
+++ b/src/components/interfaces/QT_HMI_API.xml
@@ -63,7 +63,8 @@
Lists of the transport types used for device connection to HU.
</description>
<element name="BLUETOOTH"/>
- <element name="USB"/>
+ <element name="USB_IOS"/>
+ <element name="USB_AOA"/>
<element name="WIFI"/>
</enum>
<enum name="ButtonName">
@@ -175,6 +176,21 @@
<element name="NO-NO" internal_name="NO_NO">
<description>Norwegian - Norway</description>
</element>
+ <element name="NL-BE" internal_name="NL_BE">
+ <description>Dutch (Flemish) - Belgium</description>
+ </element>
+ <element name="EL-GR" internal_name="EL_GR">
+ <description>Greek - Greece</description>
+ </element>
+ <element name="HU-HU" internal_name="HU_HU">
+ <description>Hungarian - Hungary</description>
+ </element>
+ <element name="FI-FI" internal_name="FI_FI">
+ <description>Finnish - Finland</description>
+ </element>
+ <element name="SK-SK" internal_name="SK_SK">
+ <description>Slovak - Slovakia</description>
+ </element>
</enum>
<enum name="SoftButtonType">
<description>Contains information about the SoftButton capabilities.</description>
@@ -356,10 +372,16 @@
<element name="STATIC"/>
<element name="DYNAMIC"/>
</enum>
- <enum name="ApplicationToNONEReason">
- <description>Describes the reasons of moving the app to NONE.</description>
- <element name="DRIVER_DISTRACTION_VIOLATION" />
- <element name="USER_EXIT" />
+ <enum name="ApplicationExitReason">
+ <element name="DRIVER_DISTRACTION_VIOLATION" >
+ <description>By getting this value, SDL puts the named app to NONE HMILevel</description>
+ </element>
+ <element name="USER_EXIT" >
+ <description>By getting this value, SDL puts the named app to NONE HMILevel</description>
+ </element>
+ <element name="UNAUTHORIZED_TRANSPORT_REGISTRATION">
+ <description>By getting this value, SDL unregisters the named application</description>
+ </element>
</enum>
<enum name="TextFieldName">
<element name="mainField1">
@@ -1190,6 +1212,20 @@
<description>Published data result code.</description>
</param>
</struct>
+ <struct name="DeviceInfo">
+ <param name="name" type="String" mandatory="true">
+ <description>The name of the device connected.</description>
+ </param>
+ <param name="id" type="String" mandatory="true">
+ <description>The ID of the device connected: either hash of device's USB serial number(in case of USB connection) or hash of device's MAC address(in case of BlueTooth or WIFI connection).</description>
+ </param>
+ <param name="transportType" type="Common.TransportType" mandatory="false">
+ <description>The transport type the named-app's-device is connected over HU(BlueTooth, USB or WiFi). It must be provided in OnAppRegistered and in UpdateDeviceList</description>
+ </param>
+ <param name="isSDLAllowed" type="Boolean" mandatory="false">
+ <description>Sent by SDL in UpdateDeviceList. ’true’ – if device is allowed for PolicyTable Exchange; ‘false’ – if device is NOT allowed for PolicyTable Exchange </description>
+ </param>
+ </struct>
<struct name="TouchCoord">
<param name="x" type="Integer" mandatory="true" minvalue="0" maxvalue="10000">
<description>The x coordinate of the touch.</description>
@@ -2036,7 +2072,7 @@
</function>
<function name="OnExitApplication" messagetype="notification" provider="hmi">
<description>Must be sent by HMI when the User chooses to exit the application..</description>
- <param name="reason" type="Common.ApplicationToNONEReason" mandatory="true">
+ <param name="reason" type="Common.ApplicationExitReason" mandatory="true">
<description>Specifies reason of moving the app to NONE</description>
</param>
<param name="appID" type="Integer" mandatory="true">
@@ -2704,7 +2740,7 @@
</param>
<param name="audioPassThruCapabilities" type="Common.AudioPassThruCapabilities" mandatory="true"/>
<param name="hmiZoneCapabilities" type="Common.HmiZoneCapabilities" mandatory="true"/>
- <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" mandatory="false">
+ <param name="softButtonCapabilities" type="Common.SoftButtonCapabilities" minsize="1" maxsize="100" array="true" mandatory="false">
<description>Must be returned if the platform supports on-screen SoftButtons.</description>
</param>
<param name="hmiCapabilities" type="Common.HMICapabilities" mandatory="false">
@@ -2999,6 +3035,34 @@
</function>
<function name="SendLocation" messagetype="response" >
</function>
+
+ <function name="DialNumber" functionID="DialNumberID" messagetype="request">
+ <description>Dials a phone number and switches to phone application.</description>
+ <param name="number" type="String" maxlength="40">
+ <description>Phone number is a string, which can be up to 40 chars.</description>
+ </param>
+ </function>
+
+ <function name="DialNumber" functionID="DialNumberID" messagetype="response">
+ <param name="success" type="Boolean" platform="documentation">
+ <description>true, if successful</description>
+ <description>false, if failed</description>
+ </param>
+ <param name="resultCode" type="Result" platform="documentation">
+ <description>See Result</description>
+ <element name="SUCCESS"/>
+ <element name="INVALID_DATA"/>
+ <element name="OUT_OF_MEMORY"/>
+ <element name="TOO_MANY_PENDING_REQUESTS"/>
+ <element name="APPLICATION_NOT_REGISTERED"/>
+ <element name="GENERIC_ERROR"/>
+ <element name="REJECTED"/>
+ </param>
+ <param name="info" type="String" maxlength="1000" mandatory="false" platform="documentation">
+ <description>Provides additional human readable info regarding the result.</description>
+ </param>
+ </function>
+
<function name="ShowConstantTBT" messagetype="request" provider="hmi">
<description>Request from SmartDeviceLinkCore to HMI to show info about navigation.</description>
<param name="navigationTexts" type="Common.TextFieldStruct" mandatory="true" array="true" minsize="0" maxsize="5">
@@ -3067,7 +3131,7 @@
</param>
</function>
<function name="StartStream" messagetype="request" provider="hmi">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
<param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
<description>URL that HMI start playing.</description>
</param>
@@ -3078,7 +3142,7 @@
<function name="StartStream" messagetype="response">
</function>
<function name="StopStream" messagetype="request" provider="hmi">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing video streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to stop playing video streaming.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application related to this RPC.</description>
</param>
@@ -3086,7 +3150,7 @@
<function name="StopStream" messagetype="response">
</function>
<function name="StartAudioStream" messagetype="request" provider="hmi">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
<param name="url" type="String" minlength="21" maxlength="500" mandatory="true">
<description>URL that HMI start playing.</description>
</param>
@@ -3097,7 +3161,7 @@
<function name="StartAudioStream" messagetype="response">
</function>
<function name="StopAudioStream" messagetype="request" provider="hmi">
- <description>Notification from SmartDeviceLinkCore to HMI to start playing audio streaming.</description>
+ <description>Request from SmartDeviceLinkCore to HMI to stop playing audio streaming.</description>
<param name="appID" type="Integer" mandatory="true">
<description>ID of application related to this RPC.</description>
</param>
@@ -3580,9 +3644,6 @@
<!--end Qt HMI version of OnVehicleData-->
<!--Qt HMI version of SubscribeVehicleData/UnsubscribeVehicleData-->
<function name="SubscribeGps" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeGps" messagetype="response">
<param name="gps" type="Common.VehicleDataResult" mandatory="true">
@@ -3590,9 +3651,6 @@
</param>
</function>
<function name="UnsubscribeGps" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeGps" messagetype="response">
<param name="gps" type="Common.VehicleDataResult" mandatory="true">
@@ -3600,9 +3658,6 @@
</param>
</function>
<function name="SubscribeSpeed" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeSpeed" messagetype="response">
<param name="speed" type="Common.VehicleDataResult" mandatory="true">
@@ -3610,9 +3665,6 @@
</param>
</function>
<function name="UnsubscribeSpeed" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeSpeed" messagetype="response">
<param name="speed" type="Common.VehicleDataResult" mandatory="true">
@@ -3620,9 +3672,6 @@
</param>
</function>
<function name="SubscribeRpm" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeRpm" messagetype="response">
<param name="rpm" type="Common.VehicleDataResult" mandatory="true">
@@ -3630,9 +3679,6 @@
</param>
</function>
<function name="UnsubscribeRpm" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeRpm" messagetype="response">
<param name="rpm" type="Common.VehicleDataResult" mandatory="true">
@@ -3640,9 +3686,6 @@
</param>
</function>
<function name="SubscribeFuelLevel" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeFuelLevel" messagetype="response">
<param name="fuelLevel" type="Common.VehicleDataResult" mandatory="true">
@@ -3650,9 +3693,6 @@
</param>
</function>
<function name="UnsubscribeFuelLevel" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeFuelLevel" messagetype="response">
<param name="fuelLevel" type="Common.VehicleDataResult" mandatory="true">
@@ -3660,9 +3700,6 @@
</param>
</function>
<function name="SubscribeFuelLevel_State" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeFuelLevel_State" messagetype="response">
<param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="true">
@@ -3670,9 +3707,6 @@
</param>
</function>
<function name="UnsubscribeFuelLevel_State" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeFuelLevel_State" messagetype="response">
<param name="fuelLevel_State" type="Common.VehicleDataResult" mandatory="true">
@@ -3680,9 +3714,6 @@
</param>
</function>
<function name="SubscribeInstantFuelConsumption" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeInstantFuelConsumption" messagetype="response">
<param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="true">
@@ -3690,9 +3721,6 @@
</param>
</function>
<function name="UnsubscribeInstantFuelConsumption" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeInstantFuelConsumption" messagetype="response">
<param name="instantFuelConsumption" type="Common.VehicleDataResult" mandatory="true">
@@ -3700,9 +3728,6 @@
</param>
</function>
<function name="SubscribeExternalTemperature" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeExternalTemperature" messagetype="response">
<param name="externalTemperature" type="Common.VehicleDataResult" mandatory="true">
@@ -3710,9 +3735,6 @@
</param>
</function>
<function name="UnsubscribeExternalTemperature" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeExternalTemperature" messagetype="response">
<param name="externalTemperature" type="Common.VehicleDataResult" mandatory="true">
@@ -3720,9 +3742,6 @@
</param>
</function>
<function name="SubscribePrndl" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribePrndl" messagetype="response">
<param name="prndl" type="Common.VehicleDataResult" mandatory="true">
@@ -3730,9 +3749,6 @@
</param>
</function>
<function name="UnsubscribePrndl" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribePrndl" messagetype="response">
<param name="prndl" type="Common.VehicleDataResult" mandatory="true">
@@ -3740,9 +3756,6 @@
</param>
</function>
<function name="SubscribeVin" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeVin" messagetype="response">
<param name="vin" type="String" maxlength="17" mandatory="true">
@@ -3750,9 +3763,6 @@
</param>
</function>
<function name="UnsubscribeVin" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeVin" messagetype="response">
<param name="vin" type="String" maxlength="17" mandatory="true">
@@ -3760,9 +3770,6 @@
</param>
</function>
<function name="SubscribeTirePressure" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeTirePressure" messagetype="response">
<param name="tirePressure" type="Common.VehicleDataResult" mandatory="true">
@@ -3770,9 +3777,6 @@
</param>
</function>
<function name="UnsubscribeTirePressure" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeTirePressure" messagetype="response">
<param name="tirePressure" type="Common.VehicleDataResult" mandatory="true">
@@ -3780,9 +3784,6 @@
</param>
</function>
<function name="SubscribeOdometer" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeOdometer" messagetype="response">
<param name="odometer" type="Common.VehicleDataResult" mandatory="true">
@@ -3790,9 +3791,6 @@
</param>
</function>
<function name="UnsubscribeOdometer" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeOdometer" messagetype="response">
<param name="odometer" type="Common.VehicleDataResult" mandatory="true">
@@ -3800,9 +3798,6 @@
</param>
</function>
<function name="SubscribeBeltStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeBeltStatus" messagetype="response">
<param name="beltStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3810,9 +3805,6 @@
</param>
</function>
<function name="UnsubscribeBeltStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeBeltStatus" messagetype="response">
<param name="beltStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3820,9 +3812,6 @@
</param>
</function>
<function name="SubscribeBodyInformation" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeBodyInformation" messagetype="response">
<param name="bodyInformation" type="Common.VehicleDataResult" mandatory="true">
@@ -3830,9 +3819,6 @@
</param>
</function>
<function name="UnsubscribeBodyInformation" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeBodyInformation" messagetype="response">
<param name="bodyInformation" type="Common.VehicleDataResult" mandatory="true">
@@ -3840,9 +3826,6 @@
</param>
</function>
<function name="SubscribeDeviceStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeDeviceStatus" messagetype="response">
<param name="deviceStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3850,9 +3833,6 @@
</param>
</function>
<function name="UnsubscribeDeviceStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeDeviceStatus" messagetype="response">
<param name="deviceStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3860,9 +3840,6 @@
</param>
</function>
<function name="SubscribeDriverBraking" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeDriverBraking" messagetype="response">
<param name="driverBraking" type="Common.VehicleDataResult" mandatory="true">
@@ -3870,9 +3847,6 @@
</param>
</function>
<function name="UnsubscribeDriverBraking" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeDriverBraking" messagetype="response">
<param name="driverBraking" type="Common.VehicleDataResult" mandatory="true">
@@ -3880,9 +3854,6 @@
</param>
</function>
<function name="SubscribeWiperStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeWiperStatus" messagetype="response">
<param name="wiperStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3890,9 +3861,6 @@
</param>
</function>
<function name="UnsubscribeWiperStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeWiperStatus" messagetype="response">
<param name="wiperStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3900,9 +3868,6 @@
</param>
</function>
<function name="SubscribeHeadLampStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeHeadLampStatus" messagetype="response">
<param name="headLampStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3910,9 +3875,6 @@
</param>
</function>
<function name="UnsubscribeHeadLampStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeHeadLampStatus" messagetype="response">
<param name="headLampStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -3920,9 +3882,6 @@
</param>
</function>
<function name="SubscribeEngineTorque" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeEngineTorque" messagetype="response">
<param name="engineTorque" type="Common.VehicleDataResult" mandatory="true">
@@ -3930,9 +3889,6 @@
</param>
</function>
<function name="UnsubscribeEngineTorque" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeEngineTorque" messagetype="response">
<param name="engineTorque" type="Common.VehicleDataResult" mandatory="true">
@@ -3940,9 +3896,6 @@
</param>
</function>
<function name="SubscribeAccPedalPosition" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeAccPedalPosition" messagetype="response">
<param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="true">
@@ -3950,9 +3903,6 @@
</param>
</function>
<function name="UnsubscribeAccPedalPosition" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeAccPedalPosition" messagetype="response">
<param name="accPedalPosition" type="Common.VehicleDataResult" mandatory="true">
@@ -3960,9 +3910,6 @@
</param>
</function>
<function name="SubscribeSteeringWheelAngle" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeSteeringWheelAngle" messagetype="response">
<param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="true">
@@ -3970,9 +3917,6 @@
</param>
</function>
<function name="UnsubscribeSteeringWheelAngle" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeSteeringWheelAngle" messagetype="response">
<param name="steeringWheelAngle" type="Common.VehicleDataResult" mandatory="true">
@@ -3980,9 +3924,6 @@
</param>
</function>
<function name="SubscribeECallInfo" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeECallInfo" messagetype="response">
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="true">
@@ -3990,9 +3931,6 @@
</param>
</function>
<function name="UnsubscribeECallInfo" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeECallInfo" messagetype="response">
<param name="eCallInfo" type="Common.VehicleDataResult" mandatory="true">
@@ -4000,9 +3938,6 @@
</param>
</function>
<function name="SubscribeAirbagStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeAirbagStatus" messagetype="response">
<param name="airbagStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -4010,9 +3945,6 @@
</param>
</function>
<function name="UnsubscribeAirbagStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeAirbagStatus" messagetype="response">
<param name="airbagStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -4020,9 +3952,6 @@
</param>
</function>
<function name="SubscribeEmergencyEvent" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeEmergencyEvent" messagetype="response">
<param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="true">
@@ -4030,9 +3959,6 @@
</param>
</function>
<function name="UnsubscribeEmergencyEvent" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeEmergencyEvent" messagetype="response">
<param name="emergencyEvent" type="Common.VehicleDataResult" mandatory="true">
@@ -4040,9 +3966,6 @@
</param>
</function>
<function name="SubscribeClusterModeStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeClusterModeStatus" messagetype="response">
<param name="clusterModeStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -4050,9 +3973,6 @@
</param>
</function>
<function name="UnsubscribeClusterModeStatus" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeClusterModeStatus" messagetype="response">
<param name="clusterModeStatus" type="Common.VehicleDataResult" mandatory="true">
@@ -4060,9 +3980,6 @@
</param>
</function>
<function name="SubscribeMyKey" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="SubscribeMyKey" messagetype="response">
<param name="myKey" type="Common.VehicleDataResult" mandatory="true">
@@ -4070,9 +3987,6 @@
</param>
</function>
<function name="UnsubscribeMyKey" messagetype="request" provider="hmi">
- <param name="appID" type="Integer" mandatory="true">
- <description>ID of application requested this RPC.</description>
- </param>
</function>
<function name="UnsubscribeMyKey" messagetype="response">
<param name="myKey" type="Common.VehicleDataResult" mandatory="true">
diff --git a/src/components/media_manager/CMakeLists.txt b/src/components/media_manager/CMakeLists.txt
index 9a8618fa60..abb25f1eff 100644
--- a/src/components/media_manager/CMakeLists.txt
+++ b/src/components/media_manager/CMakeLists.txt
@@ -45,11 +45,14 @@ set(default_sources
${COMPONENTS_DIR}/media_manager/src/audio/from_mic_to_file_recorder_thread.cc
${COMPONENTS_DIR}/media_manager/src/audio/socket_audio_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/audio/pipe_audio_streamer_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/audio/file_audio_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/video/socket_video_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/video/pipe_video_streamer_adapter.cc
- ${COMPONENTS_DIR}/media_manager/src/video/video_stream_to_file_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/video/file_video_streamer_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/pipe_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/socket_streamer_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/file_streamer_adapter.cc
)
set(LIBRARIES
${GSTREAMER_gstreamer_LIBRARY}
@@ -63,14 +66,16 @@ else(EXTENDED_MEDIA_MODE)
set(default_includes
)
set(default_sources
- ${COMPONENTS_DIR}/media_manager/src/video/video_stream_to_file_adapter.cc
${COMPONENTS_DIR}/media_manager/src/audio/socket_audio_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/audio/pipe_audio_streamer_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/audio/file_audio_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/video/socket_video_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/video/pipe_video_streamer_adapter.cc
- ${COMPONENTS_DIR}/media_manager/src/video/video_stream_to_file_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/video/file_video_streamer_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/pipe_streamer_adapter.cc
${COMPONENTS_DIR}/media_manager/src/socket_streamer_adapter.cc
+ ${COMPONENTS_DIR}/media_manager/src/file_streamer_adapter.cc
)
set(LIBRARIES
ProtocolLibrary
@@ -109,5 +114,6 @@ add_library("MediaManager" ${SOURCES} ${default_sources})
target_link_libraries("MediaManager" ${LIBRARIES})
if(BUILD_TESTS)
- add_subdirectory(test)
+ add_subdirectory(test)
endif()
+
diff --git a/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h b/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h
index 257564e81a..72e7ca7d28 100644
--- a/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h
+++ b/src/components/media_manager/include/media_manager/audio/a2dp_source_player_adapter.h
@@ -52,7 +52,7 @@ class A2DPSourcePlayerAdapter : public MediaAdapterImpl {
const ::protocol_handler::RawMessagePtr message) {}
void StartActivity(int32_t application_key);
void StopActivity(int32_t application_key);
- bool is_app_performing_activity(int32_t application_key);
+ bool is_app_performing_activity(int32_t application_key) const;
private:
class A2DPSourcePlayerThread;
diff --git a/src/components/media_manager/include/media_manager/audio/file_audio_streamer_adapter.h b/src/components/media_manager/include/media_manager/audio/file_audio_streamer_adapter.h
new file mode 100644
index 0000000000..4f1ab8c848
--- /dev/null
+++ b/src/components/media_manager/include/media_manager/audio/file_audio_streamer_adapter.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014-2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_FILE_AUDIO_STREAMER_ADAPTER_H_
+#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_FILE_AUDIO_STREAMER_ADAPTER_H_
+
+#include "media_manager/file_streamer_adapter.h"
+
+namespace media_manager {
+
+class FileAudioStreamerAdapter : public FileStreamerAdapter {
+ public:
+ FileAudioStreamerAdapter();
+ ~FileAudioStreamerAdapter();
+};
+
+} // namespace media_manager
+
+#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_FILE_AUDIO_STREAMER_ADAPTER_H_
diff --git a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h
index 3ea4581435..a3c4061162 100644
--- a/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h
+++ b/src/components/media_manager/include/media_manager/audio/from_mic_recorder_adapter.h
@@ -50,7 +50,7 @@ class FromMicRecorderAdapter : public MediaAdapterImpl {
const ::protocol_handler::RawMessagePtr message) {}
void StartActivity(int32_t application_key);
void StopActivity(int32_t application_key);
- bool is_app_performing_activity(int32_t application_key);
+ bool is_app_performing_activity(int32_t application_key) const;
void set_output_file(const std::string& output_file);
void set_duration(int32_t duration);
private:
diff --git a/src/components/media_manager/include/media_manager/audio/pipe_audio_streamer_adapter.h b/src/components/media_manager/include/media_manager/audio/pipe_audio_streamer_adapter.h
index 437f34fa03..cb7cb79da8 100644
--- a/src/components/media_manager/include/media_manager/audio/pipe_audio_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/audio/pipe_audio_streamer_adapter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,17 +33,14 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_PIPE_AUDIO_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_PIPE_AUDIO_STREAMER_ADAPTER_H_
-#include <string>
#include "media_manager/pipe_streamer_adapter.h"
namespace media_manager {
-class PipeAudioStreamerAdapter : public PipeStreamerAdapter {
- public:
- PipeAudioStreamerAdapter();
- ~PipeAudioStreamerAdapter();
- private:
- DISALLOW_COPY_AND_ASSIGN(PipeAudioStreamerAdapter);
+class PipeAudioStreamerAdapter : public PipeStreamerAdapter {
+ public:
+ PipeAudioStreamerAdapter();
+ ~PipeAudioStreamerAdapter();
};
} // namespace media_manager
diff --git a/src/components/media_manager/include/media_manager/audio/socket_audio_streamer_adapter.h b/src/components/media_manager/include/media_manager/audio/socket_audio_streamer_adapter.h
index be5951be3e..5b517cb025 100644
--- a/src/components/media_manager/include/media_manager/audio/socket_audio_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/audio/socket_audio_streamer_adapter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,18 +33,16 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_SOCKET_AUDIO_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_SOCKET_AUDIO_STREAMER_ADAPTER_H_
-#include <string>
#include "media_manager/socket_streamer_adapter.h"
namespace media_manager {
+
class SocketAudioStreamerAdapter : public SocketStreamerAdapter {
- public:
- SocketAudioStreamerAdapter();
- virtual ~SocketAudioStreamerAdapter();
- private:
- DISALLOW_COPY_AND_ASSIGN(SocketAudioStreamerAdapter);
+ public:
+ SocketAudioStreamerAdapter();
+ virtual ~SocketAudioStreamerAdapter();
};
-} // namespace media_manager
+} // namespace media_manager
#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_AUDIO_SOCKET_AUDIO_STREAMER_ADAPTER_H_
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
new file mode 100644
index 0000000000..16ffb12ce5
--- /dev/null
+++ b/src/components/media_manager/include/media_manager/file_streamer_adapter.h
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014-2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_FILE_STREAMER_ADAPTER_H_
+#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_FILE_STREAMER_ADAPTER_H_
+
+#include <string>
+#include <fstream>
+#include "media_manager/streamer_adapter.h"
+#include "utils/threads/thread_delegate.h"
+
+namespace media_manager {
+
+class FileStreamerAdapter : public StreamerAdapter {
+ public:
+ explicit FileStreamerAdapter(const std::string& file_name);
+ virtual ~FileStreamerAdapter();
+
+ protected:
+ class FileStreamer : public StreamerAdapter::Streamer {
+ public:
+ FileStreamer(FileStreamerAdapter* const adapter,
+ const std::string& file_name);
+ virtual ~FileStreamer();
+
+ protected:
+ virtual bool Connect();
+ virtual void Disconnect();
+ virtual bool Send(protocol_handler::RawMessagePtr msg);
+
+ private:
+ std::string file_name_;
+ std::ofstream* file_stream_;
+ };
+};
+
+} // namespace media_manager
+
+#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_FILE_STREAMER_ADAPTER_H_
diff --git a/src/components/media_manager/include/media_manager/media_adapter.h b/src/components/media_manager/include/media_manager/media_adapter.h
index a96ce03c87..fea602e1b3 100644
--- a/src/components/media_manager/include/media_manager/media_adapter.h
+++ b/src/components/media_manager/include/media_manager/media_adapter.h
@@ -44,7 +44,7 @@ class MediaAdapter {
const ::protocol_handler::RawMessagePtr message) = 0;
virtual void StartActivity(int32_t application_key) = 0;
virtual void StopActivity(int32_t application_key) = 0;
- virtual bool is_app_performing_activity(int32_t application_key) = 0;
+ virtual bool is_app_performing_activity(int32_t application_key) const = 0;
virtual ~MediaAdapter() { ;}
};
diff --git a/src/components/media_manager/include/media_manager/media_manager_impl.h b/src/components/media_manager/include/media_manager/media_manager_impl.h
index ebdae7b958..d996b1fd1b 100644
--- a/src/components/media_manager/include/media_manager/media_manager_impl.h
+++ b/src/components/media_manager/include/media_manager/media_manager_impl.h
@@ -71,6 +71,16 @@ class MediaManagerImpl : public MediaManager,
const ::protocol_handler::RawMessagePtr message);
virtual void FramesProcessed(int32_t application_key, int32_t frame_number);
+#ifdef BUILD_TESTS
+ void set_mock_a2dp_player(MediaAdapter* media_adapter);
+ void set_mock_mic_listener(MediaListenerPtr media_listener);
+ void set_mock_mic_recorder(MediaAdapterImpl* media_adapter);
+ void set_mock_streamer(protocol_handler::ServiceType stype,
+ MediaAdapterImpl* mock_stream);
+ void set_mock_streamer_listener(protocol_handler::ServiceType stype,
+ MediaAdapterListener* mock_stream);
+#endif // BUILD_TESTS
+
protected:
MediaManagerImpl();
virtual void Init();
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 f6a0c687ea..d3663f195e 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,82 +34,32 @@
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_PIPE_STREAMER_ADAPTER_H_
#include <string>
-#include "media_manager/media_adapter_impl.h"
-#include "utils/shared_ptr.h"
-#include "utils/message_queue.h"
-#include "utils/threads/thread.h"
+#include "media_manager/streamer_adapter.h"
#include "utils/threads/thread_delegate.h"
namespace media_manager {
-using ::utils::MessageQueue;
+class PipeStreamerAdapter : public StreamerAdapter {
+ public:
+ explicit PipeStreamerAdapter(const std::string& named_pipe_path);
+ virtual ~PipeStreamerAdapter();
-class PipeStreamerAdapter : public MediaAdapterImpl {
- public:
- PipeStreamerAdapter();
- virtual ~PipeStreamerAdapter();
- virtual void SendData(int32_t application_key,
- const ::protocol_handler::RawMessagePtr message);
- virtual void StartActivity(int32_t application_key);
- virtual void StopActivity(int32_t application_key);
- virtual bool is_app_performing_activity(int32_t application_key);
+ protected:
+ class PipeStreamer : public StreamerAdapter::Streamer {
+ public:
+ PipeStreamer(PipeStreamerAdapter* const adapter,
+ const std::string& named_pipe_path);
+ virtual ~PipeStreamer();
- protected:
- std::string named_pipe_path_;
-
- /*
- * @brief Start streamer thread
- */
- virtual void Init();
-
- private:
- class Streamer : public threads::ThreadDelegate {
- public:
- /*
- * Default constructor
- *
- * @param server Server pointer
- */
- explicit Streamer(PipeStreamerAdapter* server);
-
- /*
- * Destructor
- */
- ~Streamer();
-
- /*
- * @brief Function called by thread on start
- */
- void threadMain();
-
- /*
- * @brief Function called by thread on exit
- */
- void exitThreadMain();
+ protected:
+ virtual bool Connect();
+ virtual void Disconnect();
+ virtual bool Send(protocol_handler::RawMessagePtr msg);
- /*
- * @brief Opens pipe
- */
- void open();
-
- /*
- * @brief Closes pipe
- */
- void close();
-
- private:
- PipeStreamerAdapter* server_;
- int32_t pipe_fd_;
- volatile bool stop_flag_;
-
- DISALLOW_COPY_AND_ASSIGN(Streamer);
- };
-
- bool is_ready_;
- threads::Thread* thread_;
- MessageQueue<protocol_handler::RawMessagePtr> messages_;
-
- DISALLOW_COPY_AND_ASSIGN(PipeStreamerAdapter);
+ private:
+ std::string named_pipe_path_;
+ int32_t pipe_fd_;
+ };
};
} // namespace media_manager
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 a4ded9cb33..ca4fcbe9e2 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
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,106 +34,43 @@
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_SOCKET_STREAMER_ADAPTER_H_
#include <string>
-#include "media_manager/media_adapter_impl.h"
-#include "utils/logger.h"
-#include "utils/shared_ptr.h"
-#include "utils/message_queue.h"
-#include "utils/threads/thread.h"
+#include "media_manager/streamer_adapter.h"
#include "utils/threads/thread_delegate.h"
namespace media_manager {
-using ::utils::MessageQueue;
-
-class SocketStreamerAdapter : public MediaAdapterImpl {
- public:
- SocketStreamerAdapter();
- virtual ~SocketStreamerAdapter();
- virtual void SendData(int32_t application_key,
- const ::protocol_handler::RawMessagePtr message);
- virtual void StartActivity(int32_t application_key);
- virtual void StopActivity(int32_t application_key);
- virtual bool is_app_performing_activity(int32_t application_key);
-
- protected:
-
- /*
- * @brief Start streamer thread
- */
- virtual void Init();
-
- int32_t port_;
+class SocketStreamerAdapter : public StreamerAdapter {
+ public:
+ SocketStreamerAdapter(const std::string& ip,
+ int32_t port,
+ const std::string& header);
+ virtual ~SocketStreamerAdapter();
+
+ protected:
+ class SocketStreamer : public StreamerAdapter::Streamer {
+ public:
+ SocketStreamer(SocketStreamerAdapter* const adapter,
+ const std::string& ip,
+ int32_t port,
+ const std::string& header);
+ virtual ~SocketStreamer();
+
+ protected:
+ virtual bool Connect();
+ virtual void Disconnect();
+ virtual bool Send(protocol_handler::RawMessagePtr msg);
+
+ private:
std::string ip_;
+ int32_t port_;
+ std::string header_;
- private:
- class Streamer : public threads::ThreadDelegate {
- public:
- /*
- * Default constructor
- *
- * @param server Server pointer
- */
- explicit Streamer(SocketStreamerAdapter* const server);
-
- /*
- * Destructor
- */
- ~Streamer();
-
- /*
- * Function called by thread on start
- */
- void threadMain();
-
- /*
- * Function called by thread on exit
- */
- void exitThreadMain();
-
- /*
- * Checks if server is ready
- *
- * @return TRUE if socket is ready otherwise FALSE
- */
- bool is_ready() const;
-
- /*
- * Starts server
- *
- */
- void start();
-
- /*
- * Stops server
- *
- */
- void stop();
-
- /*
- * Sends data to connected client
- *
- * @param block Pointer to the data
- */
- bool send(const ::protocol_handler::RawMessagePtr msg);
-
- private:
- SocketStreamerAdapter* const server_;
- int32_t new_socket_fd_;
- bool is_first_loop_;
- volatile bool is_client_connected_;
- volatile bool stop_flag_;
- sync_primitives::Lock thread_lock;
- DISALLOW_COPY_AND_ASSIGN(Streamer);
- };
-
- int32_t socket_fd_;
- bool is_ready_;
- Streamer* streamer_;
- threads::Thread* thread_;
- MessageQueue<protocol_handler::RawMessagePtr> messages_;
- DISALLOW_COPY_AND_ASSIGN(SocketStreamerAdapter);
+ int32_t socket_fd_;
+ int32_t send_socket_fd_;
+ bool is_first_frame_;
+ };
};
-} // namespace media_manager
+} // namespace media_manager
#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_SOCKET_STREAMER_ADAPTER_H_
diff --git a/src/components/media_manager/include/media_manager/streamer_adapter.h b/src/components/media_manager/include/media_manager/streamer_adapter.h
new file mode 100644
index 0000000000..81291bcfe1
--- /dev/null
+++ b/src/components/media_manager/include/media_manager/streamer_adapter.h
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_STREAMER_ADAPTER_H_
+#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_STREAMER_ADAPTER_H_
+
+#include "media_manager/media_adapter_impl.h"
+#include "utils/message_queue.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
+#include "utils/atomic_object.h"
+#include "utils/shared_ptr.h"
+#include "protocol/raw_message.h"
+
+namespace media_manager {
+
+/**
+ * Class StreamerAdapter represents media adapter
+ * for streaming data to some destination point
+ * (pipe, socket, file)
+ */
+class StreamerAdapter : public MediaAdapterImpl {
+ protected:
+ class Streamer;
+
+ public:
+ explicit StreamerAdapter(Streamer* const streamer);
+ virtual ~StreamerAdapter();
+
+ virtual void StartActivity(int32_t application_key);
+ virtual void StopActivity(int32_t application_key);
+ virtual void SendData(int32_t application_key,
+ const ::protocol_handler::RawMessagePtr msg);
+ virtual bool is_app_performing_activity(
+ int32_t application_key) const;
+
+ protected:
+ // TODO(AN): APPLINK-15203 Use MessageLoopThread
+ class Streamer : public threads::ThreadDelegate {
+ public:
+ explicit Streamer(StreamerAdapter* const adapter);
+ virtual ~Streamer();
+
+ virtual void threadMain();
+ virtual void exitThreadMain();
+
+ protected:
+ virtual bool Connect() = 0;
+ virtual void Disconnect() = 0;
+ virtual bool Send(protocol_handler::RawMessagePtr msg) = 0;
+
+ private:
+ sync_primitives::atomic_bool stop_flag_;
+ StreamerAdapter* adapter_;
+
+ DISALLOW_COPY_AND_ASSIGN(Streamer);
+ };
+
+ private:
+ int32_t current_application_;
+ utils::MessageQueue<protocol_handler::RawMessagePtr> messages_;
+
+ Streamer* streamer_;
+ threads::Thread* thread_;
+
+ DISALLOW_COPY_AND_ASSIGN(StreamerAdapter);
+};
+
+typedef utils::SharedPtr<StreamerAdapter> StreamerAdapterPtr;
+
+} // namespace media_manager
+
+#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_STREAMER_ADAPTER_H_
diff --git a/src/components/media_manager/include/media_manager/video/file_video_streamer_adapter.h b/src/components/media_manager/include/media_manager/video/file_video_streamer_adapter.h
new file mode 100644
index 0000000000..3eb0eac8bd
--- /dev/null
+++ b/src/components/media_manager/include/media_manager/video/file_video_streamer_adapter.h
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014-2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_FILE_VIDEO_STREAMER_ADAPTER_H_
+#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_FILE_VIDEO_STREAMER_ADAPTER_H_
+
+#include "media_manager/file_streamer_adapter.h"
+
+namespace media_manager {
+
+class FileVideoStreamerAdapter : public FileStreamerAdapter {
+ public:
+ FileVideoStreamerAdapter();
+ ~FileVideoStreamerAdapter();
+};
+
+} // namespace media_manager
+
+#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_FILE_VIDEO_STREAMER_ADAPTER_H_
diff --git a/src/components/media_manager/include/media_manager/video/pipe_video_streamer_adapter.h b/src/components/media_manager/include/media_manager/video/pipe_video_streamer_adapter.h
index 62447661a6..f0a4f24697 100644
--- a/src/components/media_manager/include/media_manager/video/pipe_video_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/video/pipe_video_streamer_adapter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,17 +33,14 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_PIPE_VIDEO_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_PIPE_VIDEO_STREAMER_ADAPTER_H_
-#include <string>
#include "media_manager/pipe_streamer_adapter.h"
namespace media_manager {
-class PipeVideoStreamerAdapter : public PipeStreamerAdapter {
- public:
- PipeVideoStreamerAdapter();
- ~PipeVideoStreamerAdapter();
- private:
- DISALLOW_COPY_AND_ASSIGN(PipeVideoStreamerAdapter);
+class PipeVideoStreamerAdapter : public PipeStreamerAdapter {
+ public:
+ PipeVideoStreamerAdapter();
+ ~PipeVideoStreamerAdapter();
};
} // namespace media_manager
diff --git a/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h b/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h
index e5eefed12c..b59fb3e1ac 100644
--- a/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h
+++ b/src/components/media_manager/include/media_manager/video/socket_video_streamer_adapter.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -33,19 +33,16 @@
#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_SOCKET_VIDEO_STREAMER_ADAPTER_H_
#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_SOCKET_VIDEO_STREAMER_ADAPTER_H_
-#include <string>
#include "media_manager/socket_streamer_adapter.h"
namespace media_manager {
-class SocketVideoStreamerAdapter : public SocketStreamerAdapter {
- public:
- SocketVideoStreamerAdapter();
- virtual ~SocketVideoStreamerAdapter();
- private:
- DISALLOW_COPY_AND_ASSIGN(SocketVideoStreamerAdapter);
+class SocketVideoStreamerAdapter : public SocketStreamerAdapter {
+ public:
+ SocketVideoStreamerAdapter();
+ virtual ~SocketVideoStreamerAdapter();
};
-} // namespace media_manager
+} // namespace media_manager
#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_SOCKET_VIDEO_STREAMER_ADAPTER_H_
diff --git a/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h b/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h
deleted file mode 100644
index 8ec7fff803..0000000000
--- a/src/components/media_manager/include/media_manager/video/video_stream_to_file_adapter.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_VIDEO_STREAM_TO_FILE_ADAPTER_H_
-#define SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_VIDEO_STREAM_TO_FILE_ADAPTER_H_
-
-#include <string>
-#include <fstream>
-#include "media_manager/media_adapter_impl.h"
-#include "utils/message_queue.h"
-#include "utils/threads/thread.h"
-#include "utils/threads/thread_delegate.h"
-
-namespace media_manager {
-
-using ::utils::MessageQueue;
-
-class VideoStreamToFileAdapter : public MediaAdapterImpl {
- public:
- explicit VideoStreamToFileAdapter(const std::string& file_name);
- virtual ~VideoStreamToFileAdapter();
- virtual void SendData(int32_t application_key,
- const ::protocol_handler::RawMessagePtr message);
- virtual void StartActivity(int32_t application_key);
- virtual void StopActivity(int32_t application_key);
- virtual bool is_app_performing_activity(int32_t application_key);
-
- /*
- * @brief Start streamer thread
- */
- virtual void Init();
-
- private:
- class Streamer : public threads::ThreadDelegate {
- public:
- /*
- * Default constructor
- *
- * @param server Server pointer
- */
- explicit Streamer(VideoStreamToFileAdapter* server);
-
- /*
- * Destructor
- */
- ~Streamer();
-
- /*
- * @brief Function called by thread on start
- */
- void threadMain();
-
- /*
- * @brief Function called by thread on exit
- */
- void exitThreadMain();
-
- /*
- * @brief Opens file
- */
- void open();
-
- /*
- * @brief Closes file
- */
- void close();
-
- private:
- VideoStreamToFileAdapter* server_;
- volatile bool stop_flag_;
- std::ofstream* file_stream_;
-
- DISALLOW_COPY_AND_ASSIGN(Streamer);
- };
-
- private:
- std::string file_name_;
- bool is_ready_;
- threads::Thread* thread_;
- MessageQueue<protocol_handler::RawMessagePtr> messages_;
-};
-} // namespace media_manager
-
-#endif // SRC_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_VIDEO_VIDEO_STREAM_TO_FILE_ADAPTER_H_
diff --git a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
index a6a36ef547..5f656902d9 100644
--- a/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
+++ b/src/components/media_manager/src/audio/a2dp_source_player_adapter.cc
@@ -39,10 +39,11 @@
#include "utils/lock.h"
#include "utils/logger.h"
#include "connection_handler/connection_handler_impl.h"
+#include "application_manager/application_manager_impl.h"
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "A2DPSourcePlayerAdapter");
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
const static size_t BUFSIZE = 32;
@@ -89,15 +90,16 @@ void A2DPSourcePlayerAdapter::StartActivity(int32_t application_key) {
if (application_key != current_application_) {
current_application_ = application_key;
+ const protocol_handler::SessionObserver& session_observer =
+ application_manager::ApplicationManagerImpl::instance()
+ ->connection_handler()
+ .get_session_observer();
+
uint32_t device_id = 0;
- connection_handler::ConnectionHandlerImpl::instance()->
- GetDataOnSessionKey(application_key, 0, NULL, &device_id);
- std::string mac_adddress;
- connection_handler::ConnectionHandlerImpl::instance()->GetDataOnDeviceID(
- device_id,
- NULL,
- NULL,
- &mac_adddress);
+ session_observer.GetDataOnSessionKey(application_key, 0, NULL, &device_id);
+
+ std::string mac_address;
+ session_observer.GetDataOnDeviceID(device_id, NULL, NULL, &mac_address);
// TODO(PK): Convert mac_adddress to the
// following format : "bluez_source.XX_XX_XX_XX_XX_XX" if needed
@@ -128,8 +130,8 @@ void A2DPSourcePlayerAdapter::StopActivity(int32_t application_key) {
}
}
-bool A2DPSourcePlayerAdapter::is_app_performing_activity(int32_t
- application_key) {
+bool A2DPSourcePlayerAdapter::is_app_performing_activity(
+ int32_t application_key) const {
return (application_key == current_application_);
}
diff --git a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
index a78ca8b49c..050af62ad7 100644
--- a/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
+++ b/src/components/media_manager/src/audio/audio_stream_sender_thread.cc
@@ -57,7 +57,7 @@ using sync_primitives::AutoLock;
const int32_t AudioStreamSenderThread::kAudioPassThruTimeout = 1;
const uint32_t kMqueueMessageSize = 4095;
-CREATE_LOGGERPTR_GLOBAL(logger_, "AudioPassThruThread")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
AudioStreamSenderThread::AudioStreamSenderThread(
const std::string fileName, uint32_t session_key)
@@ -93,23 +93,23 @@ void AudioStreamSenderThread::sendAudioChunkToMobile() {
std::vector<uint8_t>::iterator to;
if (!file_system::ReadBinaryFile(fileName_, binaryData)) {
- LOG4CXX_ERROR_EXT(logger_, "Unable to read file." << fileName_);
+ LOG4CXX_ERROR(logger_, "Unable to read file." << fileName_);
return;
}
if (binaryData.empty()) {
- LOG4CXX_ERROR_EXT(logger_, "Binary data is empty.");
+ LOG4CXX_ERROR(logger_, "Binary data is empty.");
return;
}
- LOG4CXX_INFO_EXT(logger_, "offset = " << offset_);
+ LOG4CXX_INFO(logger_, "offset = " << offset_);
from = binaryData.begin() + offset_;
to = binaryData.end();
if (from < binaryData.end() /*from != binaryData.end()*/) {
- LOG4CXX_INFO_EXT(logger_, "from != binaryData.end()");
+ LOG4CXX_INFO(logger_, "from != binaryData.end()");
offset_ = offset_ + to - from;
std::vector<uint8_t> data(from, to);
diff --git a/src/components/media_manager/src/audio/file_audio_streamer_adapter.cc b/src/components/media_manager/src/audio/file_audio_streamer_adapter.cc
new file mode 100644
index 0000000000..1381a18a01
--- /dev/null
+++ b/src/components/media_manager/src/audio/file_audio_streamer_adapter.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014-2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "media_manager/audio/file_audio_streamer_adapter.h"
+#include "config_profile/profile.h"
+
+namespace media_manager {
+
+FileAudioStreamerAdapter::FileAudioStreamerAdapter()
+ : FileStreamerAdapter(profile::Profile::instance()->audio_stream_file()) {
+}
+
+FileAudioStreamerAdapter::~FileAudioStreamerAdapter() {
+}
+
+} // namespace media_manager
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
index ef9d5b8de6..4a2f9ff618 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_adapter.cc
@@ -38,7 +38,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "FromMicRecorderAdapter")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
FromMicRecorderAdapter::FromMicRecorderAdapter()
: recorder_thread_(NULL)
@@ -98,8 +98,8 @@ void FromMicRecorderAdapter::StopActivity(int32_t application_key) {
current_application_ = 0;
}
-bool FromMicRecorderAdapter::is_app_performing_activity(int32_t
- application_key) {
+bool FromMicRecorderAdapter::is_app_performing_activity(
+ int32_t application_key) const {
return (application_key == current_application_);
}
diff --git a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
index 3718e82c60..b8c82e7ab6 100644
--- a/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
+++ b/src/components/media_manager/src/audio/from_mic_recorder_listener.cc
@@ -37,7 +37,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "FromMicRecorderListener")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
FromMicRecorderListener::FromMicRecorderListener(
const std::string& file_name)
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 88c358a494..7e155fcb21 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
@@ -37,7 +37,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "FromMicToFileRecorderThread")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
GMainLoop* FromMicToFileRecorderThread::loop = NULL;
diff --git a/src/components/media_manager/src/audio/pipe_audio_streamer_adapter.cc b/src/components/media_manager/src/audio/pipe_audio_streamer_adapter.cc
index 5c120397cf..fca363cbbf 100644
--- a/src/components/media_manager/src/audio/pipe_audio_streamer_adapter.cc
+++ b/src/components/media_manager/src/audio/pipe_audio_streamer_adapter.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,21 +32,14 @@
#include "media_manager/audio/pipe_audio_streamer_adapter.h"
#include "config_profile/profile.h"
-#include "utils/logger.h"
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger, "PipeAudioStreamerAdapter")
-
-PipeAudioStreamerAdapter::PipeAudioStreamerAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
- named_pipe_path_ = profile::Profile::instance()->named_audio_pipe_path();
-
- Init();
+PipeAudioStreamerAdapter::PipeAudioStreamerAdapter()
+ : PipeStreamerAdapter(profile::Profile::instance()->named_audio_pipe_path()) {
}
PipeAudioStreamerAdapter::~PipeAudioStreamerAdapter() {
- LOG4CXX_INFO(logger, "PipeAudioStreamerAdapter::~PipeAudioStreamerAdapter");
}
} // namespace media_manager
diff --git a/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc b/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc
index 06dc877d89..d7d6be1383 100644
--- a/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc
+++ b/src/components/media_manager/src/audio/socket_audio_streamer_adapter.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014 Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,22 +30,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string>
#include "config_profile/profile.h"
#include "media_manager/audio/socket_audio_streamer_adapter.h"
-#include "utils/logger.h"
-namespace media_manager {
-
-CREATE_LOGGERPTR_GLOBAL(logger, "SocketAudioStreamerAdapter")
+namespace {
+ const std::string kHeader = "HTTP/1.1 200 OK\r\n"
+ "Connection: Keep-Alive\r\n"
+ "Keep-Alive: timeout=15, max=300\r\n"
+ "Server: SDL\r\n"
+ "Content-Type: video/mp4\r\n\r\n";
+}
-SocketAudioStreamerAdapter::SocketAudioStreamerAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
- port_ = profile::Profile::instance()->audio_streaming_port();
- ip_ = profile::Profile::instance()->server_address();
+namespace media_manager {
- Init();
+SocketAudioStreamerAdapter::SocketAudioStreamerAdapter()
+ : SocketStreamerAdapter(profile::Profile::instance()->server_address(),
+ profile::Profile::instance()->audio_streaming_port(),
+ kHeader) {
}
SocketAudioStreamerAdapter::~SocketAudioStreamerAdapter() {
}
+
} // namespace media_manager
diff --git a/src/components/media_manager/src/file_streamer_adapter.cc b/src/components/media_manager/src/file_streamer_adapter.cc
new file mode 100644
index 0000000000..f2ef72699c
--- /dev/null
+++ b/src/components/media_manager/src/file_streamer_adapter.cc
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/logger.h"
+#include "utils/file_system.h"
+#include "config_profile/profile.h"
+#include "media_manager/file_streamer_adapter.h"
+
+namespace media_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger, "FileStreamerAdapter")
+
+FileStreamerAdapter::FileStreamerAdapter(
+ const std::string& file_name)
+ : StreamerAdapter(new FileStreamer(this, file_name)) {
+}
+
+FileStreamerAdapter::~FileStreamerAdapter() {
+}
+
+FileStreamerAdapter::FileStreamer::FileStreamer(
+ FileStreamerAdapter* const adapter,
+ const std::string& file_name)
+ : Streamer(adapter),
+ file_name_(file_name),
+ file_stream_(NULL) {
+}
+
+FileStreamerAdapter::FileStreamer::~FileStreamer() {
+}
+
+bool FileStreamerAdapter::FileStreamer::Connect() {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (!file_system::CreateDirectoryRecursively(
+ profile::Profile::instance()->app_storage_folder())) {
+ LOG4CXX_ERROR(logger, "Cannot create app folder");
+ return false;
+ }
+
+ file_stream_ = file_system::Open(file_name_);
+ if (!file_stream_) {
+ LOG4CXX_ERROR(logger, "Cannot open file stream "
+ << file_name_);
+ return false;
+ }
+
+ LOG4CXX_INFO(logger, "File " << file_name_
+ << " was successfuly opened");
+ return true;
+}
+
+void FileStreamerAdapter::FileStreamer::Disconnect() {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (file_stream_) {
+ file_system::Close(file_stream_);
+ delete file_stream_;
+ file_stream_ = NULL;
+ }
+ file_system::DeleteFile(file_name_);
+}
+
+bool FileStreamerAdapter::FileStreamer::Send(
+ protocol_handler::RawMessagePtr msg) {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (!file_stream_) {
+ LOG4CXX_ERROR(logger, "File stream not found "
+ << file_name_);
+ return false;
+ }
+
+ if (!file_system::Write(file_stream_, msg->data(),
+ msg->data_size())) {
+ LOG4CXX_ERROR(logger, "Failed writing data to file "
+ << file_name_);
+ return false;
+ }
+
+ LOG4CXX_INFO(logger, "Streamer::sent " << msg->data_size());
+ return true;
+}
+
+} // namespace media_manager
diff --git a/src/components/media_manager/src/media_adapter_impl.cc b/src/components/media_manager/src/media_adapter_impl.cc
index 257801ffd8..7d8cfb9059 100644
--- a/src/components/media_manager/src/media_adapter_impl.cc
+++ b/src/components/media_manager/src/media_adapter_impl.cc
@@ -35,7 +35,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaAdapterImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
MediaAdapterImpl::MediaAdapterImpl()
: current_application_(0) {
diff --git a/src/components/media_manager/src/media_manager_impl.cc b/src/components/media_manager/src/media_manager_impl.cc
index 61b2c5bb92..fcbbcce9fa 100644
--- a/src/components/media_manager/src/media_manager_impl.cc
+++ b/src/components/media_manager/src/media_manager_impl.cc
@@ -50,14 +50,14 @@
#include "media_manager/audio/socket_audio_streamer_adapter.h"
#include "media_manager/video/pipe_video_streamer_adapter.h"
#include "media_manager/audio/pipe_audio_streamer_adapter.h"
-#include "media_manager/video/video_stream_to_file_adapter.h"
+#include "media_manager/video/file_video_streamer_adapter.h"
+#include "media_manager/audio/file_audio_streamer_adapter.h"
namespace media_manager {
using profile::Profile;
-using timer::TimerThread;
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManagerImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
MediaManagerImpl::MediaManagerImpl()
: protocol_handler_(NULL)
@@ -78,6 +78,34 @@ MediaManagerImpl::~MediaManagerImpl() {
}
}
+#ifdef BUILD_TESTS
+ void MediaManagerImpl::set_mock_a2dp_player(MediaAdapter* media_adapter) {
+ a2dp_player_= media_adapter;
+ }
+
+ void MediaManagerImpl::set_mock_mic_listener(MediaListenerPtr media_listener) {
+ from_mic_listener_ = media_listener;
+ }
+
+#ifdef EXTENDED_MEDIA_MODE
+ void MediaManagerImpl::set_mock_mic_recorder(MediaAdapterImpl* media_adapter) {
+ from_mic_recorder_ = media_adapter;
+ }
+
+#endif // EXTENDED_MEDIA_MODE
+
+ void MediaManagerImpl::set_mock_streamer(protocol_handler::ServiceType stype,
+ MediaAdapterImpl* mock_stream) {
+ streamer_[stype]= mock_stream;
+ }
+
+ void MediaManagerImpl::set_mock_streamer_listener(protocol_handler::ServiceType stype,
+ MediaAdapterListener* mock_stream) {
+ streamer_listener_[stype]= mock_stream;
+ }
+
+#endif // BUILD_TESTS
+
void MediaManagerImpl::Init() {
using namespace protocol_handler;
LOG4CXX_INFO(logger_, "MediaManagerImpl::Init()");
@@ -93,8 +121,7 @@ void MediaManagerImpl::Init() {
} else if ("pipe" == profile::Profile::instance()->video_server_type()) {
streamer_[ServiceType::kMobileNav] = new PipeVideoStreamerAdapter();
} else if ("file" == profile::Profile::instance()->video_server_type()) {
- streamer_[ServiceType::kMobileNav] = new VideoStreamToFileAdapter(
- profile::Profile::instance()->video_stream_file());
+ streamer_[ServiceType::kMobileNav] = new FileVideoStreamerAdapter();
}
if ("socket" == profile::Profile::instance()->audio_server_type()) {
@@ -102,8 +129,7 @@ void MediaManagerImpl::Init() {
} else if ("pipe" == profile::Profile::instance()->audio_server_type()) {
streamer_[ServiceType::kAudio] = new PipeAudioStreamerAdapter();
} else if ("file" == profile::Profile::instance()->audio_server_type()) {
- streamer_[ServiceType::kAudio] = new VideoStreamToFileAdapter(
- profile::Profile::instance()->audio_stream_file());
+ streamer_[ServiceType::kAudio] = new FileAudioStreamerAdapter();
}
streamer_listener_[ServiceType::kMobileNav] = new StreamerListener();
diff --git a/src/components/media_manager/src/pipe_streamer_adapter.cc b/src/components/media_manager/src/pipe_streamer_adapter.cc
index 5990428c68..a61280f057 100644
--- a/src/components/media_manager/src/pipe_streamer_adapter.cc
+++ b/src/components/media_manager/src/pipe_streamer_adapter.cc
@@ -41,190 +41,88 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PipeStreamerAdapter")
+CREATE_LOGGERPTR_GLOBAL(logger, "PipeStreamerAdapter")
-PipeStreamerAdapter::PipeStreamerAdapter()
- : is_ready_(false),
- thread_(threads::CreateThread("PipeStreamer", new Streamer(this))),
- messages_() {
- LOG4CXX_AUTO_TRACE(logger_);
+PipeStreamerAdapter::PipeStreamerAdapter(
+ const std::string& named_pipe_path)
+ : StreamerAdapter(new PipeStreamer(this, named_pipe_path)) {
}
PipeStreamerAdapter::~PipeStreamerAdapter() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if ((0 != current_application_ ) && (is_ready_)) {
- StopActivity(current_application_);
- }
-
- thread_->join();
- delete thread_->delegate();
- threads::DeleteThread(thread_);
}
-void PipeStreamerAdapter::SendData(
- int32_t application_key,
- const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (application_key != current_application_) {
- LOG4CXX_WARN(logger_, "Wrong application " << application_key);
+PipeStreamerAdapter::PipeStreamer::PipeStreamer(
+ PipeStreamerAdapter* const adapter,
+ const std::string& named_pipe_path)
+ : Streamer(adapter),
+ named_pipe_path_(named_pipe_path),
+ pipe_fd_(0) {
+ if (!file_system::CreateDirectoryRecursively(
+ profile::Profile::instance()->app_storage_folder())) {
+ LOG4CXX_ERROR(logger, "Cannot create app storage folder "
+ << profile::Profile::instance()->app_storage_folder() );
return;
}
- if (is_ready_) {
- messages_.push(message);
+ if ((mkfifo(named_pipe_path_.c_str(),
+ S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0)
+ && (errno != EEXIST)) {
+ LOG4CXX_ERROR(logger, "Cannot create pipe " << named_pipe_path_);
+ } else {
+ LOG4CXX_INFO(logger, "Pipe " << named_pipe_path_
+ << " was successfuly created");
}
}
-void PipeStreamerAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (application_key == current_application_) {
- LOG4CXX_WARN(logger_, "Already started activity for " << application_key);
- return;
+PipeStreamerAdapter::PipeStreamer::~PipeStreamer() {
+ if (0 == unlink(named_pipe_path_.c_str()) ) {
+ LOG4CXX_INFO(logger, "Pipe " << named_pipe_path_ << " was removed");
+ } else {
+ LOG4CXX_ERROR(logger, "Error removing pipe " << named_pipe_path_);
}
-
- current_application_ = application_key;
- is_ready_ = true;
-
- for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
- media_listeners_.end() != it;
- ++it) {
- (*it)->OnActivityStarted(application_key);
- }
-
- LOG4CXX_DEBUG(logger_, "Pipe was opened for writing " << named_pipe_path_);
}
-void PipeStreamerAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_AUTO_TRACE(logger_);
-
- if (application_key != current_application_) {
- LOG4CXX_WARN(logger_, "Not performing activity for " << application_key);
- return;
- }
+bool PipeStreamerAdapter::PipeStreamer::Connect() {
+ LOG4CXX_AUTO_TRACE(logger);
- is_ready_ = false;
- current_application_ = 0;
-
- messages_.Reset();
-
- for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
- media_listeners_.end() != it;
- ++it) {
- (*it)->OnActivityEnded(application_key);
- }
-}
-
-bool PipeStreamerAdapter::is_app_performing_activity( int32_t application_key) {
- return (application_key == current_application_);
-}
-
-void PipeStreamerAdapter::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (thread_->is_running()) {
- thread_->stop();
- thread_->join();
+ pipe_fd_ = open(named_pipe_path_.c_str(), O_RDWR, 0);
+ if (-1 == pipe_fd_) {
+ LOG4CXX_ERROR(logger, "Cannot open pipe for writing "
+ << named_pipe_path_);
+ return false;
}
- LOG4CXX_DEBUG(logger_, "Start sending thread");
- const size_t kStackSize = 16384;
- thread_->start(threads::ThreadOptions(kStackSize));
-}
-PipeStreamerAdapter::Streamer::Streamer(
- PipeStreamerAdapter* server)
- : server_(server),
- pipe_fd_(0),
- stop_flag_(false) {
+ LOG4CXX_INFO(logger, "Pipe " << named_pipe_path_
+ << " was successfuly opened for writing");
+ return true;
}
-PipeStreamerAdapter::Streamer::~Streamer() {
- server_ = NULL;
-}
-
-void PipeStreamerAdapter::Streamer::threadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- open();
-
- while (!stop_flag_) {
- while (!server_->messages_.empty()) {
- ::protocol_handler::RawMessagePtr msg = server_->messages_.pop();
- if (!msg) {
- LOG4CXX_ERROR(logger_, "Null pointer message");
- continue;
- }
-
- ssize_t ret = write(pipe_fd_, msg.get()->data(),
- msg.get()->data_size());
-
- if (ret == -1) {
- LOG4CXX_ERROR(logger_, "Failed writing data to pipe "
- << server_->named_pipe_path_);
-
- std::set<MediaListenerPtr>::iterator it =
- server_->media_listeners_.begin();
- for (;server_->media_listeners_.end() != it; ++it) {
- (*it)->OnErrorReceived(server_->current_application_, -1);
- }
- } else if (static_cast<uint32_t>(ret) != msg.get()->data_size()) {
- LOG4CXX_WARN(logger_, "Couldn't write all the data to pipe "
- << server_->named_pipe_path_);
- }
-
- static int32_t messsages_for_session = 0;
- ++messsages_for_session;
-
- LOG4CXX_DEBUG(logger_, "Handling map streaming message. This is "
- << messsages_for_session << " the message for "
- << server_->current_application_);
- std::set<MediaListenerPtr>::iterator it =
- server_->media_listeners_.begin();
- for (; server_->media_listeners_.end() != it; ++it) {
- (*it)->OnDataReceived(server_->current_application_,
- messsages_for_session);
- }
- }
- server_->messages_.wait();
+void PipeStreamerAdapter::PipeStreamer::Disconnect() {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (0 == close(pipe_fd_)) {
+ LOG4CXX_INFO(logger, "Pipe " << named_pipe_path_ << " was closed");
+ } else {
+ LOG4CXX_ERROR(logger, "Error closing pipe " << named_pipe_path_);
}
- close();
-}
-
-void PipeStreamerAdapter::Streamer::exitThreadMain() {
- LOG4CXX_AUTO_TRACE(logger_);
- stop_flag_ = true;
- server_->messages_.Shutdown();
}
-void PipeStreamerAdapter::Streamer::open() {
- LOG4CXX_AUTO_TRACE(logger_);
-
- DCHECK(file_system::CreateDirectoryRecursively(
- profile::Profile::instance()->app_storage_folder()));
-
- if ((mkfifo(server_->named_pipe_path_.c_str(),
- S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0)
- && (errno != EEXIST)) {
- LOG4CXX_ERROR(logger_, "Cannot create pipe " << server_->named_pipe_path_);
- return;
+bool PipeStreamerAdapter::PipeStreamer::Send(
+ protocol_handler::RawMessagePtr msg) {
+ LOG4CXX_AUTO_TRACE(logger);
+ ssize_t ret = write(pipe_fd_, msg->data(), msg->data_size());
+ if (-1 == ret) {
+ LOG4CXX_ERROR(logger, "Failed writing data to pipe "
+ << named_pipe_path_);
+ return false;
}
- pipe_fd_ = ::open(server_->named_pipe_path_.c_str(), O_RDWR, 0);
- if (-1 == pipe_fd_) {
- LOG4CXX_ERROR(logger_, "Cannot open pipe for writing "
- << server_->named_pipe_path_);
- return;
+ if (static_cast<uint32_t>(ret) != msg->data_size()) {
+ LOG4CXX_WARN(logger, "Couldn't write all the data to pipe "
+ << named_pipe_path_);
}
- LOG4CXX_DEBUG(logger_, "Pipe " << server_->named_pipe_path_
- << " was successfully created");
-}
-
-void PipeStreamerAdapter::Streamer::close() {
- LOG4CXX_AUTO_TRACE(logger_);
- ::close(pipe_fd_);
- unlink(server_->named_pipe_path_.c_str());
+ LOG4CXX_INFO(logger, "Streamer::sent " << msg->data_size());
+ return true;
}
} // namespace media_manager
diff --git a/src/components/media_manager/src/socket_streamer_adapter.cc b/src/components/media_manager/src/socket_streamer_adapter.cc
index 45b1f63a17..ecf6535958 100644
--- a/src/components/media_manager/src/socket_streamer_adapter.cc
+++ b/src/components/media_manager/src/socket_streamer_adapter.cc
@@ -33,282 +33,123 @@
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/select.h>
-#include <sys/time.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
-#include <string.h>
-#include <errno.h>
-#include "config_profile/profile.h"
-#include "media_manager/video/socket_video_streamer_adapter.h"
#include "utils/logger.h"
+#include "media_manager/socket_streamer_adapter.h"
namespace media_manager {
CREATE_LOGGERPTR_GLOBAL(logger, "SocketStreamerAdapter")
-SocketStreamerAdapter::SocketStreamerAdapter()
- : socket_fd_(0),
- is_ready_(false),
- streamer_(new Streamer(this)),
- thread_(threads::CreateThread("SocketStreamer", streamer_)),
- messages_() {
+SocketStreamerAdapter::SocketStreamerAdapter(
+ const std::string& ip,
+ int32_t port,
+ const std::string& header)
+ : StreamerAdapter(new SocketStreamer(this, ip, port, header)) {
}
SocketStreamerAdapter::~SocketStreamerAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
- thread_->join();
- delete streamer_;
- threads::DeleteThread(thread_);
-}
-
-void SocketStreamerAdapter::StartActivity(int32_t application_key) {
- LOG4CXX_TRACE(logger, "enter " << application_key);
-
- if (application_key == current_application_) {
- LOG4CXX_INFO(logger, "Already running for app " << application_key);
- } else {
- is_ready_ = true;
- current_application_ = application_key;
-
- messages_.Reset();
-
- for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
- media_listeners_.end() != it;
- ++it) {
- (*it)->OnActivityStarted(application_key);
- }
- }
- LOG4CXX_TRACE(logger, "exit");
-}
-
-void SocketStreamerAdapter::StopActivity(int32_t application_key) {
- LOG4CXX_TRACE(logger, "enter " << application_key);
-
- if (application_key != current_application_) {
- LOG4CXX_WARN(logger, "Streaming is not active for " << application_key);
- } else {
- is_ready_ = false;
- current_application_ = 0;
-
- if (streamer_) {
- streamer_->stop();
- messages_.Shutdown();
- }
-
- for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
- media_listeners_.end() != it;
- ++it) {
- (*it)->OnActivityEnded(application_key);
- }
- }
- LOG4CXX_TRACE(logger, "exit");
}
-bool SocketStreamerAdapter::is_app_performing_activity(
- int32_t application_key) {
- return (application_key == current_application_);
+SocketStreamerAdapter::SocketStreamer::SocketStreamer(
+ SocketStreamerAdapter* const adapter,
+ const std::string& ip,
+ int32_t port,
+ const std::string& header)
+ : Streamer(adapter),
+ ip_(ip),
+ port_(port),
+ header_(header),
+ socket_fd_(0),
+ send_socket_fd_(0),
+ is_first_frame_(true) {
}
-void SocketStreamerAdapter::Init() {
- LOG4CXX_DEBUG(logger, "Start sending thread");
- const size_t kStackSize = 16384;
- thread_->start(threads::ThreadOptions(kStackSize));
+SocketStreamerAdapter::SocketStreamer::~SocketStreamer() {
}
-void SocketStreamerAdapter::SendData(
- int32_t application_key,
- const ::protocol_handler::RawMessagePtr message) {
- LOG4CXX_INFO(logger, "SendData(application_key = " << application_key << ")");
-
-
- if (application_key != current_application_) {
- LOG4CXX_WARN(logger, "Currently working with other app "
- << current_application_);
- return;
- }
-
- if (is_ready_) {
- messages_.push(message);
- }
-}
-
-SocketStreamerAdapter::Streamer::Streamer(
- SocketStreamerAdapter* const server)
- : server_(server),
- new_socket_fd_(0),
- is_first_loop_(true),
- is_client_connected_(false),
- stop_flag_(false) {
-}
-
-SocketStreamerAdapter::Streamer::~Streamer() {
- stop();
-}
-
-void SocketStreamerAdapter::Streamer::threadMain() {
- LOG4CXX_TRACE(logger,"enter " << this);
- sync_primitives::AutoLock auto_lock(thread_lock);
- start();
-
- while (!stop_flag_) {
- new_socket_fd_ = accept(server_->socket_fd_, NULL, NULL);
- LOG4CXX_INFO(logger, "Client connectd " << new_socket_fd_);
- if (0 > new_socket_fd_) {
- LOG4CXX_ERROR(logger, "Socket is closed " << strerror(errno));
- sleep(1);
- continue;
- }
-
- is_client_connected_ = true;
- is_first_loop_ = true;
- while (is_client_connected_) {
- while (!server_->messages_.empty()) {
- ::protocol_handler::RawMessagePtr msg = server_->messages_.pop();
- if (!msg) {
- LOG4CXX_ERROR(logger, "Null pointer message");
- continue;
- }
-
- is_client_connected_ = send(msg);
- static int32_t messages_for_session = 0;
- ++messages_for_session;
-
- LOG4CXX_INFO(logger, "Handling map streaming message. This is "
- << messages_for_session << " the message for "
- << server_->current_application_);
- std::set<MediaListenerPtr>::iterator it = server_->media_listeners_
- .begin();
- for (; server_->media_listeners_.end() != it; ++it) {
- (*it)->OnDataReceived(server_->current_application_,
- messages_for_session);
- }
- }
-
- if (!is_ready()) {
- LOG4CXX_INFO(logger, "Client disconnected.");
- stop();
- break;
- }
- server_->messages_.wait();
- }
- }
- LOG4CXX_TRACE(logger,"exit " << this);
-}
-
-void SocketStreamerAdapter::Streamer::exitThreadMain() {
- LOG4CXX_TRACE(logger,"enter " << this);
- stop_flag_ = true;
- stop();
- server_->messages_.Shutdown();
- if (server_->socket_fd_ != -1) {
- shutdown(server_->socket_fd_, SHUT_RDWR);
- close(server_->socket_fd_);
- }
- LOG4CXX_TRACE(logger,"exit " << this);
-}
-
-void SocketStreamerAdapter::Streamer::start() {
- server_->socket_fd_ = socket(AF_INET, SOCK_STREAM, 0);
-
- if (0 >= server_->socket_fd_) {
- LOG4CXX_ERROR_EXT(logger, "Server open error");
- return;
+bool SocketStreamerAdapter::SocketStreamer::Connect() {
+ LOG4CXX_AUTO_TRACE(logger);
+ socket_fd_ = socket(AF_INET, SOCK_STREAM, 0);
+ if (0 >= socket_fd_) {
+ LOG4CXX_ERROR(logger, "Unable to create socket");
+ return false;
}
int32_t optval = 1;
- if (-1 == setsockopt(server_->socket_fd_, SOL_SOCKET, SO_REUSEADDR,
+ if (-1 == setsockopt(socket_fd_, SOL_SOCKET, SO_REUSEADDR,
&optval, sizeof optval)) {
- LOG4CXX_ERROR_EXT(logger, "Unable to set sockopt");
- return;
+ LOG4CXX_ERROR(logger, "Unable to set sockopt");
+ return false;
}
struct sockaddr_in serv_addr_ = { 0 };
- serv_addr_.sin_addr.s_addr = inet_addr(server_->ip_.c_str());
+ serv_addr_.sin_addr.s_addr = inet_addr(ip_.c_str());
serv_addr_.sin_family = AF_INET;
- serv_addr_.sin_port = htons(server_->port_);
-
- if (-1 == bind(server_->socket_fd_,
+ serv_addr_.sin_port = htons(port_);
+ if (-1 == bind(socket_fd_,
reinterpret_cast<struct sockaddr*>(&serv_addr_),
sizeof(serv_addr_))) {
- LOG4CXX_ERROR_EXT(logger, "Unable to bind");
- return;
+ LOG4CXX_ERROR(logger, "Unable to bind");
+ return false;
}
- LOG4CXX_INFO(logger, "SocketStreamerAdapter::listen for connections");
- if (-1 == listen(server_->socket_fd_, 5)) {
- LOG4CXX_ERROR_EXT(logger, "Unable to listen");
- return;
+ if (-1 == listen(socket_fd_, 5)) {
+ LOG4CXX_ERROR(logger, "Unable to listen");
+ return false;
}
-}
-void SocketStreamerAdapter::Streamer::stop() {
- LOG4CXX_TRACE(logger,"enter " << this);
- if (0 == new_socket_fd_) {
- LOG4CXX_ERROR(logger, "Client Socket does not exist: ");
- } else if (-1 == shutdown(new_socket_fd_, SHUT_RDWR)) {
- LOG4CXX_ERROR(logger, "Unable to shutdown socket " << strerror(errno));
- } else if (-1 == ::close(new_socket_fd_)) {
- LOG4CXX_ERROR(logger, "Unable to close socket " << strerror(errno));
+ send_socket_fd_ = accept(socket_fd_, NULL, NULL);
+ if (0 >= send_socket_fd_) {
+ LOG4CXX_ERROR(logger, "Unable to accept");
+ return false;
}
- new_socket_fd_ = 0;
- is_client_connected_ = false;
- LOG4CXX_TRACE(logger,"exit" << this);
+ is_first_frame_ = true;
+ LOG4CXX_INFO(logger, "Client connected: " << send_socket_fd_);
+ return true;
}
-bool SocketStreamerAdapter::Streamer::is_ready() const {
- bool result = true;
- fd_set fds;
- FD_ZERO(&fds);
- FD_SET(new_socket_fd_, &fds);
- struct timeval tv;
- tv.tv_sec = 5; // set a 5 second timeout
- tv.tv_usec = 0;
-
- int32_t retval = 0;
- retval = select(new_socket_fd_ + 1, 0, &fds, 0, &tv);
-
- if (-1 == retval) {
- LOG4CXX_ERROR_EXT(logger, "An error occurred");
- result = false;
- } else if (0 == retval) {
- LOG4CXX_ERROR_EXT(logger, "The timeout expired");
- result = false;
+void SocketStreamerAdapter::SocketStreamer::Disconnect() {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (0 < send_socket_fd_) {
+ close(send_socket_fd_);
}
- return result;
-}
-
-bool SocketStreamerAdapter::Streamer::send(
- const ::protocol_handler::RawMessagePtr msg) {
- if (!is_ready()) {
- LOG4CXX_ERROR_EXT(logger, " Socket is not ready");
- return false;
+ if (0 < socket_fd_) {
+ close(socket_fd_);
}
+}
- if (is_first_loop_) {
- is_first_loop_ = false;
- char hdr[] = {"HTTP/1.1 200 OK\r\n "
- "Connection: Keep-Alive\r\n"
- "Keep-Alive: timeout=15, max=300\r\n"
- "Server: SDL\r\n"
- "Content-Type: video/mp4\r\n\r\n"
- };
-
- if (-1 == ::send(new_socket_fd_, hdr, strlen(hdr), MSG_NOSIGNAL)) {
- LOG4CXX_ERROR_EXT(logger, " Unable to send");
+bool SocketStreamerAdapter::SocketStreamer::Send(
+ protocol_handler::RawMessagePtr msg) {
+ LOG4CXX_AUTO_TRACE(logger);
+ ssize_t ret;
+ if (is_first_frame_) {
+ ret = send(send_socket_fd_, header_.c_str(),
+ header_.size(), MSG_NOSIGNAL);
+ if (static_cast<uint32_t>(ret) != header_.size()) {
+ LOG4CXX_ERROR(logger, "Unable to send data to socket");
return false;
}
+ is_first_frame_ = false;
}
- if (-1 == ::send(new_socket_fd_, (*msg).data(),
- (*msg).data_size(), MSG_NOSIGNAL)) {
- LOG4CXX_ERROR_EXT(logger, " Unable to send");
+ ret = send(send_socket_fd_, msg->data(),
+ msg->data_size(), MSG_NOSIGNAL);
+ if (-1 == ret) {
+ LOG4CXX_ERROR(logger, "Unable to send data to socket");
return false;
}
- LOG4CXX_INFO(logger, "Streamer::sent " << (*msg).data_size());
+ if (static_cast<uint32_t>(ret) != msg->data_size()) {
+ LOG4CXX_WARN(logger, "Couldn't send all the data to socket "
+ << send_socket_fd_);
+ }
+
+ LOG4CXX_INFO(logger, "Streamer::sent " << msg->data_size());
return true;
}
diff --git a/src/components/media_manager/src/streamer_adapter.cc b/src/components/media_manager/src/streamer_adapter.cc
new file mode 100644
index 0000000000..3246744ba9
--- /dev/null
+++ b/src/components/media_manager/src/streamer_adapter.cc
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "media_manager/streamer_adapter.h"
+#include "utils/logger.h"
+
+namespace media_manager {
+
+CREATE_LOGGERPTR_GLOBAL(logger, "StreamerAdapter")
+
+StreamerAdapter::StreamerAdapter(Streamer* const streamer)
+ : current_application_(0),
+ messages_(),
+ streamer_(streamer),
+ thread_(NULL) {
+ DCHECK(streamer_);
+ thread_ = threads::CreateThread("StreamerAdapter", streamer_);
+}
+
+StreamerAdapter::~StreamerAdapter() {
+ thread_->join();
+ threads::DeleteThread(thread_);
+ delete streamer_;
+}
+
+void StreamerAdapter::StartActivity(int32_t application_key) {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (is_app_performing_activity(application_key)) {
+ LOG4CXX_WARN(logger, "Activity for application: "
+ << application_key << " has been already started");
+ return;
+ }
+ messages_.Reset();
+
+ DCHECK(thread_);
+ const size_t kStackSize = 16384;
+ thread_->start(threads::ThreadOptions(kStackSize));
+
+ for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
+ media_listeners_.end() != it;
+ ++it) {
+ (*it)->OnActivityStarted(application_key);
+ }
+ current_application_ = application_key;
+}
+
+void StreamerAdapter::StopActivity(int32_t application_key) {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (!is_app_performing_activity(application_key)) {
+ LOG4CXX_WARN(logger, "Activity for application: "
+ << application_key << " has not been started");
+ return;
+ }
+
+ DCHECK(thread_);
+ thread_->stop();
+
+ for (std::set<MediaListenerPtr>::iterator it = media_listeners_.begin();
+ media_listeners_.end() != it;
+ ++it) {
+ (*it)->OnActivityEnded(application_key);
+ }
+ current_application_ = 0;
+}
+
+void StreamerAdapter::SendData(int32_t application_key,
+ const ::protocol_handler::RawMessagePtr msg) {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (!is_app_performing_activity(application_key)) {
+ LOG4CXX_ERROR(logger, "Activity for application: "
+ << application_key << " has not been started");
+ return;
+ }
+ messages_.push(msg);
+}
+
+bool StreamerAdapter::is_app_performing_activity(
+ int32_t application_key) const {
+ return application_key == current_application_;
+}
+
+StreamerAdapter::Streamer::Streamer(StreamerAdapter* const adapter)
+ : stop_flag_(false),
+ adapter_(adapter) {
+ DCHECK(adapter_);
+}
+
+StreamerAdapter::Streamer::~Streamer() {
+}
+
+void StreamerAdapter::Streamer::threadMain() {
+ LOG4CXX_AUTO_TRACE(logger);
+ if (!adapter_) {
+ LOG4CXX_ERROR(logger, "Null pointer to adapter");
+ return;
+ }
+ if (!Connect()) {
+ LOG4CXX_ERROR(logger, "Unable to connect");
+ return;
+ }
+ stop_flag_ = false;
+ while (!stop_flag_) {
+ adapter_->messages_.wait();
+ while (!adapter_->messages_.empty()) {
+ protocol_handler::RawMessagePtr msg;
+ if (!adapter_->messages_.pop(msg)) {
+ LOG4CXX_ERROR(logger, "Empty message queue");
+ continue;
+ }
+ if (!msg) {
+ LOG4CXX_ERROR(logger, "Null pointer message");
+ continue;
+ }
+ if (!Send(msg)) {
+ LOG4CXX_ERROR(logger, "Unable to send. Disconnecting");
+ Disconnect();
+ return;
+ }
+ static int32_t messages_for_session = 0;
+ ++messages_for_session;
+
+ LOG4CXX_DEBUG(logger, "Handling map streaming message. This is "
+ << messages_for_session << " message for "
+ << adapter_->current_application_);
+ std::set<MediaListenerPtr>::iterator it = adapter_->media_listeners_
+ .begin();
+ for (; adapter_->media_listeners_.end() != it; ++it) {
+ (*it)->OnDataReceived(adapter_->current_application_,
+ messages_for_session);
+ }
+ }
+ }
+ Disconnect();
+}
+
+void StreamerAdapter::Streamer::exitThreadMain() {
+ LOG4CXX_AUTO_TRACE(logger);
+ stop_flag_ = true;
+ if (adapter_) {
+ adapter_->messages_.Shutdown();
+ }
+}
+
+} // namespace media_manager
diff --git a/src/components/media_manager/src/streamer_listener.cc b/src/components/media_manager/src/streamer_listener.cc
index 3181ba8e09..3ad55c1265 100644
--- a/src/components/media_manager/src/streamer_listener.cc
+++ b/src/components/media_manager/src/streamer_listener.cc
@@ -36,7 +36,7 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "StreamerListener")
+CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManager")
StreamerListener::StreamerListener()
: current_application_(0) {
@@ -55,7 +55,7 @@ void StreamerListener::OnDataReceived(
void StreamerListener::OnErrorReceived(
int32_t application_key,
const DataForListener& data) {
- LOG4CXX_ERROR(logger_, "StreamerListener::OnErrorReceived");
+ LOG4CXX_AUTO_TRACE(logger_);
}
void StreamerListener::OnActivityStarted(int32_t application_key) {
diff --git a/src/components/media_manager/src/video/file_video_streamer_adapter.cc b/src/components/media_manager/src/video/file_video_streamer_adapter.cc
new file mode 100644
index 0000000000..07bcadcd94
--- /dev/null
+++ b/src/components/media_manager/src/video/file_video_streamer_adapter.cc
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014-2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "media_manager/video/file_video_streamer_adapter.h"
+#include "config_profile/profile.h"
+
+namespace media_manager {
+
+FileVideoStreamerAdapter::FileVideoStreamerAdapter()
+ : FileStreamerAdapter(profile::Profile::instance()->video_stream_file()) {
+}
+
+FileVideoStreamerAdapter::~FileVideoStreamerAdapter() {
+}
+
+} // namespace media_manager
diff --git a/src/components/media_manager/src/video/pipe_video_streamer_adapter.cc b/src/components/media_manager/src/video/pipe_video_streamer_adapter.cc
index 4812e19c9f..9fb66dc465 100644
--- a/src/components/media_manager/src/video/pipe_video_streamer_adapter.cc
+++ b/src/components/media_manager/src/video/pipe_video_streamer_adapter.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,17 +35,11 @@
namespace media_manager {
-CREATE_LOGGERPTR_GLOBAL(logger, "PipeVideoStreamerAdapter")
-
-PipeVideoStreamerAdapter::PipeVideoStreamerAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
- named_pipe_path_ = profile::Profile::instance()->named_video_pipe_path();
-
- Init();
+PipeVideoStreamerAdapter::PipeVideoStreamerAdapter()
+ : PipeStreamerAdapter(profile::Profile::instance()->named_video_pipe_path()) {
}
PipeVideoStreamerAdapter::~PipeVideoStreamerAdapter() {
- LOG4CXX_INFO(logger, "PipeVideoStreamerAdapter::~PipeVideoStreamerAdapter");
}
} // namespace media_manager
diff --git a/src/components/media_manager/src/video/socket_video_streamer_adapter.cc b/src/components/media_manager/src/video/socket_video_streamer_adapter.cc
index 3a83aabd10..9da1159feb 100644
--- a/src/components/media_manager/src/video/socket_video_streamer_adapter.cc
+++ b/src/components/media_manager/src/video/socket_video_streamer_adapter.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2014-2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,20 +30,24 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string>
#include "config_profile/profile.h"
#include "media_manager/video/socket_video_streamer_adapter.h"
-#include "utils/logger.h"
-namespace media_manager {
-
-CREATE_LOGGERPTR_GLOBAL(logger, "SocketVideoStreamerAdapter")
+namespace {
+ const std::string kHeader = "HTTP/1.1 200 OK\r\n"
+ "Connection: Keep-Alive\r\n"
+ "Keep-Alive: timeout=15, max=300\r\n"
+ "Server: SDL\r\n"
+ "Content-Type: video/mp4\r\n\r\n";
+}
-SocketVideoStreamerAdapter::SocketVideoStreamerAdapter() {
- LOG4CXX_AUTO_TRACE(logger);
- port_ = profile::Profile::instance()->video_streaming_port();
- ip_ = profile::Profile::instance()->server_address();
+namespace media_manager {
- Init();
+SocketVideoStreamerAdapter::SocketVideoStreamerAdapter()
+ : SocketStreamerAdapter(profile::Profile::instance()->server_address(),
+ profile::Profile::instance()->video_streaming_port(),
+ kHeader) {
}
SocketVideoStreamerAdapter::~SocketVideoStreamerAdapter() {
diff --git a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
index 33b0c43ee5..8ca547ed10 100644
--- a/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
+++ b/src/components/media_manager/src/video/video_stream_to_file_adapter.cc
@@ -139,7 +139,7 @@ VideoStreamToFileAdapter::Streamer::~Streamer() {
}
void VideoStreamToFileAdapter::Streamer::threadMain() {
- LOG4CXX_INFO(logger, "Streamer::threadMain");
+ LOG4CXX_AUTO_TRACE(logger);
open();
@@ -173,7 +173,7 @@ void VideoStreamToFileAdapter::Streamer::threadMain() {
}
void VideoStreamToFileAdapter::Streamer::exitThreadMain() {
- LOG4CXX_INFO(logger, "Streamer::exitThreadMain");
+ LOG4CXX_AUTO_TRACE(logger);
stop_flag_ = true;
server_->messages_.Shutdown();
}
diff --git a/src/components/media_manager/test/CMakeLists.txt b/src/components/media_manager/test/CMakeLists.txt
index 1146aacff0..837fd4a361 100644
--- a/src/components/media_manager/test/CMakeLists.txt
+++ b/src/components/media_manager/test/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Ford Motor Company
+# Copyright (c) 2015, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -33,6 +33,7 @@ if(BUILD_TESTS)
include_directories(
${GMOCK_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/media_manager/include
+ ${COMPONENTS_DIR}/include/
)
if(EXTENDED_MEDIA_MODE)
@@ -43,12 +44,13 @@ if(EXTENDED_MEDIA_MODE)
endif()
set(SOURCES
- media_manager_impl_test.cc
+ ${COMPONENTS_DIR}/media_manager/test/media_manager_impl_test.cc
)
set(LIBRARIES
MediaManager
ApplicationManager
+ MessageHelper
ProtocolHandler
gmock
connectionHandler
@@ -69,6 +71,6 @@ if(ENABLE_LOG)
target_link_libraries("media_manager_test" log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
-endif() # BUILD_TESTS
+endif()
# vim: set ts=2 sw=2 et:
diff --git a/src/components/media_manager/test/include/media_adapter_impl_mock.h b/src/components/media_manager/test/include/media_adapter_impl_mock.h
new file mode 100644
index 0000000000..02907c1217
--- /dev/null
+++ b/src/components/media_manager/test/include/media_adapter_impl_mock.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_IMPL_MOCK_H_
+#define TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_IMPL_MOCK_H_
+
+#include <gmock/gmock.h>
+#include "media_manager/media_adapter_impl.h"
+#include "media_adapter_listener_mock.h"
+#include "media_manager/media_adapter_listener.h"
+#include "media_adapter_mock.h"
+#include "utils/macro.h"
+#include "protocol_handler/protocol_handler.h"
+
+namespace test {
+namespace components {
+namespace media_manager_test {
+
+/*
+ * MOCK implementation of ::media_manager::MediaAdapterImpl
+ */
+using namespace media_manager;
+typedef utils::SharedPtr<MediaAdapterListener> MediaListenerPtr;
+class MediaAdapterImplMock : public ::media_manager::MediaAdapterImpl {
+ public:
+ MOCK_METHOD1(AddListener,
+ void(const utils::SharedPtr<MediaAdapterListener>&));
+ MOCK_METHOD1(RemoveListener,
+ void(const utils::SharedPtr<MediaAdapterListener> &));
+ MOCK_METHOD2(SendData,
+ void(int32_t application_key,
+ const ::protocol_handler::RawMessagePtr message));
+ MOCK_METHOD1(StartActivity,
+ void(int32_t application_key));
+ MOCK_METHOD1(StopActivity,
+ void(int32_t application_key));
+ MOCK_CONST_METHOD1(is_app_performing_activity,
+ bool(int32_t application_key));
+};
+
+} // namespace media_manager_test
+} // namespace components
+} // namespace test
+
+#endif // TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_IMPL_MOCK_H_
diff --git a/src/components/media_manager/test/include/media_adapter_listener_mock.h b/src/components/media_manager/test/include/media_adapter_listener_mock.h
new file mode 100644
index 0000000000..0aae8fc068
--- /dev/null
+++ b/src/components/media_manager/test/include/media_adapter_listener_mock.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_LISTENER_MOCK_H_
+#define TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_LISTENER_MOCK_H_
+
+#include <gmock/gmock.h>
+#include "media_manager/media_adapter_listener.h"
+
+namespace test {
+namespace components {
+namespace media_manager_test {
+
+/*
+ * MOCK implementation of ::media_manager::MediaAdapterListener
+ */
+class MediaAdapterListenerMock : public ::media_manager::MediaAdapterListener {
+ public:
+ MOCK_METHOD2(OnDataReceived,
+ void(int32_t application_key,
+ const int32_t& data));
+ MOCK_METHOD1(OnActivityStarted,
+ void(int32_t application_key));
+ MOCK_METHOD1(OnActivityEnded,
+ void(int32_t application_key));
+ MOCK_METHOD2(OnErrorReceived,
+ void(int32_t application_key,
+ const int32_t& data));
+};
+
+
+} // namespace media_manager_test
+} // namespace components
+} // namespace test
+
+#endif // TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_LISTENER_MOCK_H_
diff --git a/src/components/media_manager/test/include/media_adapter_mock.h b/src/components/media_manager/test/include/media_adapter_mock.h
new file mode 100644
index 0000000000..a7c2ef7c51
--- /dev/null
+++ b/src/components/media_manager/test/include/media_adapter_mock.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_MOCK_H_
+#define TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_MOCK_H_
+
+#include <gmock/gmock.h>
+#include "media_manager/media_manager.h"
+
+namespace test {
+namespace components {
+namespace media_manager_test {
+
+/*
+ * MOCK implementation of ::media_manager::MediaAdapter
+ */
+class MediaAdapterMock : public ::media_manager::MediaAdapter {
+ public:
+ MOCK_METHOD2(SendData,
+ void(int32_t application_key,
+ const ::protocol_handler::RawMessagePtr message));
+ MOCK_METHOD1(StartActivity,
+ void(int32_t application_key));
+ MOCK_METHOD1(StopActivity,
+ void(int32_t application_key));
+ MOCK_CONST_METHOD1(is_app_performing_activity,
+ bool(int32_t application_key));
+};
+
+
+} // namespace media_manager_test
+} // namespace components
+} // namespace test
+
+#endif // TEST_COMPONENTS_MEDIA_MANAGER_INCLUDE_MEDIA_MANAGER_MEDIA_ADAPTER_MOCK_H_
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 615d74f9a1..4c63640fee 100644
--- a/src/components/media_manager/test/media_manager_impl_test.cc
+++ b/src/components/media_manager/test/media_manager_impl_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,61 +32,94 @@
#include "gmock/gmock.h"
#include "media_manager/media_manager_impl.h"
+#include "include/media_adapter_mock.h"
+#include "include/media_adapter_listener_mock.h"
+#include "include/media_adapter_impl_mock.h"
+#include "protocol_handler/mock_protocol_handler.h"
namespace test {
namespace components {
namespace media_manager_test {
-CREATE_LOGGERPTR_GLOBAL(logger_, "MediaManagerImplTest")
+using ::testing::_;
+using protocol_handler::ServiceType;
-class MediaManagerTest : public ::testing::Test {
- protected:
- virtual void SetUp();
- virtual void TearDown();
-};
+TEST(MediaManagerImplTest, PlayA2DPSource) {
+ MediaManagerImpl* mediaManagerImpl = MediaManagerImpl::instance();
+ EXPECT_TRUE(mediaManagerImpl->exists());
+ int32_t application_key = 1;
-void MediaManagerTest::SetUp() {
+ MediaAdapterMock media_mock;
+ mediaManagerImpl->set_mock_a2dp_player(&media_mock);
+ EXPECT_CALL(media_mock, StartActivity(application_key));
+ mediaManagerImpl->PlayA2DPSource(application_key);
}
-void MediaManagerTest::TearDown() {
-}
-
-TEST_F(MediaManagerTest, AddAndPlayStream) {
- media_manager::MediaManager* mediaManager =
- media_manager::MediaManagerImpl::instance();
-
- const useconds_t sleeptime = 100;
-
- mediaManager->PlayA2DPSource(1);
- LOG4CXX_INFO(logger_, ".Playing stream");
-
- usleep(sleeptime);
-
- mediaManager->StopA2DPSource(1);
+TEST(MediaManagerImplTest, StopA2DPSource) {
+ MediaManagerImpl* mediaManagerImpl = MediaManagerImpl::instance();
+ EXPECT_TRUE(mediaManagerImpl->exists());
+ int32_t application_key = 1;
- usleep(sleeptime);
-
- mediaManager->PlayA2DPSource(1);
-
- usleep(sleeptime);
+ MediaAdapterMock media_mock;
+ mediaManagerImpl->set_mock_a2dp_player(&media_mock);
+ EXPECT_CALL(media_mock, StopActivity(application_key));
+ mediaManagerImpl->StopA2DPSource(application_key);
+}
- mediaManager->StopA2DPSource(1);
+TEST(MediaManagerImplTest, StopMicrophoneRecording) {
+ MediaManagerImpl* mediaManagerImpl = MediaManagerImpl::instance();
+ int32_t application_key = 1;
+ MediaAdapterListenerMock media_adapter_listener_mock;
+
+ mediaManagerImpl->set_mock_mic_listener(&media_adapter_listener_mock);
+#ifdef EXTENDED_MEDIA_MODE
+ MediaAdapterImplMock media_adapter_recorder_mock;
+ mediaManagerImpl->set_mock_mic_recorder(&media_adapter_recorder_mock);
+ EXPECT_CALL(media_adapter_recorder_mock, StopActivity(application_key));
+#endif // EXTENDED_MEDIA_MODE
+ EXPECT_CALL(media_adapter_listener_mock, OnActivityEnded(application_key));
+#ifdef EXTENDED_MEDIA_MODE
+ EXPECT_CALL(media_adapter_recorder_mock, RemoveListener(_));
+#endif // EXTENDED_MEDIA_MODE
+ mediaManagerImpl->StopMicrophoneRecording(application_key);
+}
- usleep(sleeptime);
+TEST(MediaManagerImplTest, StartStopStreaming) {
+ MediaManagerImpl* mediaManagerImpl = MediaManagerImpl::instance();
- mediaManager->PlayA2DPSource(1);
+ int32_t application_key = 1;
+ MediaAdapterImplMock mock_audio_media_streamer;
+ mediaManagerImpl->set_mock_streamer(ServiceType::kAudio,
+ &mock_audio_media_streamer);
+ MediaAdapterImplMock mock_nav_media_streamer;
+ mediaManagerImpl->set_mock_streamer(ServiceType::kMobileNav,
+ &mock_nav_media_streamer);
- usleep(sleeptime);
+ EXPECT_CALL(mock_audio_media_streamer, StartActivity(application_key));
+ mediaManagerImpl->StartStreaming(application_key, ServiceType::kAudio);
- mediaManager->StopA2DPSource(1);
+ EXPECT_CALL(mock_nav_media_streamer, StartActivity(application_key));
+ mediaManagerImpl->StartStreaming(application_key, ServiceType::kMobileNav);
- usleep(sleeptime);
+ EXPECT_CALL(mock_audio_media_streamer, StopActivity(application_key));
+ mediaManagerImpl->StopStreaming(application_key, ServiceType::kAudio);
- mediaManager->StopA2DPSource(1);
+ EXPECT_CALL(mock_nav_media_streamer, StopActivity(application_key));
+ mediaManagerImpl->StopStreaming(application_key, ServiceType::kMobileNav);
}
-} // namespace media_manager_test
-} // namespace components
-} // namespace test
+TEST(MediaManagerImplTest, CheckFramesProcessed) {
+ MediaManagerImpl* mediaManagerImpl = MediaManagerImpl::instance();
+ protocol_handler_test::MockProtocolHandler mock_protocol_handler;
+ mediaManagerImpl->SetProtocolHandler(&mock_protocol_handler);
+ int32_t application_key = 1;
+ int32_t frame_number = 10;
+ EXPECT_CALL(mock_protocol_handler,
+ SendFramesNumber(application_key, frame_number));
+ mediaManagerImpl->FramesProcessed(application_key, frame_number);
+}
+} // namespace media_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/policy/src/policy/CMakeLists.txt b/src/components/policy/src/policy/CMakeLists.txt
index 2b794e9db8..00ad52b628 100644
--- a/src/components/policy/src/policy/CMakeLists.txt
+++ b/src/components/policy/src/policy/CMakeLists.txt
@@ -48,6 +48,7 @@ include_directories (
${CMAKE_SOURCE_DIR}/src/components/utils/include/
${CMAKE_SOURCE_DIR}/src/components
${CMAKE_SOURCE_DIR}/src/components/config_profile/include
+ ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/table_struct
${LOG4CXX_INCLUDE_DIRECTORY}
)
@@ -70,13 +71,11 @@ add_subdirectory(policy_table/table_struct)
set(LIBRARIES ConfigProfile policy_struct dbms jsoncpp Utils)
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
- # --- QDB Wrapper
- include_directories (qdb_wrapper/include)
- add_subdirectory(qdb_wrapper)
+ # --- QDB Wrapper
+ include_directories (${COMPONENTS_DIR}/utils/include/utils)
else ()
# --- SQLite Wrapper
- include_directories (sqlite_wrapper/include)
- add_subdirectory(sqlite_wrapper)
+ include_directories (${COMPONENTS_DIR}/utils/include/utils)
list(APPEND LIBRARIES sqlite3)
endif ()
diff --git a/src/components/policy/src/policy/include/policy/cache_manager.h b/src/components/policy/src/policy/include/policy/cache_manager.h
index ff30d95363..4494caf922 100644
--- a/src/components/policy/src/policy/include/policy/cache_manager.h
+++ b/src/components/policy/src/policy/include/policy/cache_manager.h
@@ -40,10 +40,12 @@
#include "policy/pt_ext_representation.h"
#include "usage_statistics/statistics_manager.h"
#include "policy/cache_manager_interface.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
#include "utils/lock.h"
-#include "utils/timer_thread.h"
#include "utils/conditional_variable.h"
+#include "policy/policy_types.h"
namespace policy {
@@ -87,11 +89,10 @@ class CacheManager : public CacheManagerInterface {
virtual int KilometersBeforeExchange(int current);
/**
- * @brief Sets kilometers and days after epoch, that passed for recieved
- * successful PT UPdate
+ * @brief Sets counter value that passed for recieved successful PT UPdate
*/
- virtual bool SetCountersPassedForSuccessfulUpdate(int kilometers,
- int days_after_epoch);
+ virtual bool SetCountersPassedForSuccessfulUpdate(Counters counter,
+ int value);
/**
* Gets value in days before next update policy table
@@ -126,7 +127,7 @@ class CacheManager : public CacheManagerInterface {
/**
* @brief Get information about vehicle
*/
- virtual VehicleData GetVehicleData();
+ virtual const VehicleInfo GetVehicleInfo() const;
/**
* @brief Allows to update 'vin' field in module_meta table.
@@ -168,7 +169,7 @@ class CacheManager : public CacheManagerInterface {
* depending on application priority.
* @param priority Priority of application
*/
- virtual int GetNotificationsNumber(const std::string& priority);
+ virtual rpc::policy_table_interface_base::NumberOfNotificationsType GetNotificationsNumber(const std::string& priority);
/**
* @brief Get priority for given application
@@ -345,6 +346,15 @@ class CacheManager : public CacheManagerInterface {
rpc::policy_table_interface_base::Strings &preconsented_groups);
/**
+ * @brief Add's information about mobile device in Policy Table.
+ * @param device_id Generated or obtained id of device
+ * @param connection_type device connection type
+ * @return bool Success of operation
+ */
+ bool AddDevice(const std::string& device_id,
+ const std::string& connection_type);
+
+ /**
* @brief Record information about mobile device in Policy Table.
* @param device_id Generated or obtained id of device
* @return bool Success of operation
@@ -535,7 +545,7 @@ class CacheManager : public CacheManagerInterface {
* @param file_name preloaded
* @return
*/
- bool LoadFromFile(const std::string& file_name);
+ bool LoadFromFile(const std::string& file_name, policy_table::Table& table);
/**
* @brief Backup allows to save cache onto hard drive.
@@ -546,10 +556,10 @@ class CacheManager : public CacheManagerInterface {
/**
* Returns heart beat timeout
* @param app_id application id
- * @return if timeout was set then value in seconds greater zero
+ * @return if timeout was set then value in milliseconds greater zero
* otherwise heart beat for specific application isn't set
*/
- uint16_t HeartBeatTimeout(const std::string& app_id) const;
+ uint32_t HeartBeatTimeout(const std::string& app_id) const;
/**
* @brief Allows to generate hash from the specified string.
@@ -566,6 +576,101 @@ class CacheManager : public CacheManagerInterface {
*/
void GetAppRequestTypes(const std::string& policy_app_id,
std::vector<std::string>& request_types) const;
+
+ /**
+ * @brief GetCertificate allows to obtain certificate in order to
+ * make secure connection
+ *
+ * @return The certificate in PKCS#7.
+ */
+ virtual std::string GetCertificate() const OVERRIDE;
+
+ /**
+ * @brief MergePreloadPT allows to load policy table from certain JSON file,
+ * and then decide if merge is needed. The merge is needed in case when preload
+ * JSON date is different than current database.
+ *
+ * @param file_name the preloaded policy table JSON file.
+ */
+ void MergePreloadPT(const std::string& file_name);
+
+ /**
+ * @brief MergeMC allows to merge ModuleConfig section by definite rules.
+ *
+ * The rules are:
+ * 1. Add new fields (known to PoliciesManager) & sub-sections if such are
+ * present in the updated Preloaded PT
+ * 2. "vehicle_make", “model”, “year” – leave the fields & values as they were
+ * in the database
+ * 3. For all other fields – overwrite the values with the new ones from preloaded PT.
+ *
+ * @param new_pt the policy table loaded from updated preload JSON file.
+ *
+ * @param pt the exists database.
+ */
+ void MergeMC(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt);
+
+ /**
+ * @brief MergeFG allows to merge FunctionalGroupings sections by definite rules.
+ *
+ * The rules are:
+ * 1. If functional_group_name exists in both database (LocalPT) and updated
+ * PreloadedPT -> PoliciesManager must overwrite it (that is, replace such
+ * functional_group_name in the database by the one from Pre-PT).
+ * 2. If functional_group_name exists in updated PreloadedPT and does not
+ * exist in database (LocalPT), PoliciesManager must add such group to the database.
+ * 3. If functional_group_name does not exist in updated PreloadedPT and
+ * exists in the database (LocalPT), PoliciesManager must leave such group in
+ * the database without changes.
+ *
+ * @param new_pt the policy table loaded from updated preload JSON file.
+ *
+ * @param pt the exists database.
+ */
+ void MergeFG(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt);
+
+ /**
+ * @brief MergeAP Allows to merge ApplicationPolicies section by definite relues.
+ * The rules are:
+ * 1. Leave “<appID>” sub-sections as they were in the database (fields & their values).
+ * 2. Over-write "default", "device", "pre_DataConsent" subsections.
+ *
+ * @param new_pt the policy table loaded from updated preload JSON file.
+ *
+ * @param pt the exists database.
+ */
+ void MergeAP(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt);
+
+ /**
+ * @brief MergeCFM allows to merge ConsumerFriendlyMessages section by definite rules.
+ *
+ * The rules are:
+ * 1. If friendly_message_name exists in both database (LocalPT) and updated
+ * Preloaded PT -> PoliciesManager must overwrite it.
+ * 2. If friendly_message_name exists in updated Preloaded PT and does not
+ * exist in database (LocalPT), PoliciesManager must add such
+ * friendly_message_name to the database (LocalPT).
+ * 3. If friendly_message_name does not exist in updated Preloaded PT and
+ * exists in the database (LocalPT), PoliciesManager must leave such
+ * friendly_message_name in the database without changes.
+ *
+ * @param new_pt the policy table loaded from updated preload JSON file.
+ *
+ * @param pt the exists database
+ */
+ void MergeCFM(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt);
+
+
+#ifdef BUILD_TESTS
+ utils::SharedPtr<policy_table::Table> GetPT() const {
+ return pt_;
+ }
+#endif
+
private:
std::string currentDateTime();
struct AppHMITypeToString {
@@ -613,7 +718,6 @@ private:
utils::SharedPtr<policy_table::Table> pt_;
utils::SharedPtr<policy_table::Table> snapshot_;
utils::SharedPtr<PTRepresentation> backup_;
- utils::SharedPtr<PTExtRepresentation> ex_backup_;
bool update_required;
typedef std::set<std::string> UnpairedDevices;
UnpairedDevices is_unpaired_;
diff --git a/src/components/policy/src/policy/include/policy/cache_manager_interface.h b/src/components/policy/src/policy/include/policy/cache_manager_interface.h
index 56d0933e45..e3afdb7e91 100644
--- a/src/components/policy/src/policy/include/policy/cache_manager_interface.h
+++ b/src/components/policy/src/policy/include/policy/cache_manager_interface.h
@@ -38,6 +38,7 @@
#include "utils/shared_ptr.h"
#include "usage_statistics/counter.h"
+#include "policy/policy_types.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -82,11 +83,10 @@ class CacheManagerInterface {
virtual int KilometersBeforeExchange(int current) = 0;
/**
- * @brief Sets kilometers and days after epoch, that passed for recieved
- * successful PT UPdate
+ * @brief Sets counter value that passed for recieved successful PT UPdate
*/
- virtual bool SetCountersPassedForSuccessfulUpdate(int kilometers,
- int days_after_epoch) = 0;
+ virtual bool SetCountersPassedForSuccessfulUpdate(Counters counter,
+ int value) = 0;
/**
* Gets value in days before next update policy table
@@ -121,7 +121,7 @@ class CacheManagerInterface {
/**
* @brief Get information about vehicle
*/
- virtual VehicleData GetVehicleData() = 0;
+ virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
* @brief Allows to update 'vin' field in module_meta table.
@@ -164,7 +164,7 @@ class CacheManagerInterface {
* depending on application priority.
* @param priority Priority of application
*/
- virtual int GetNotificationsNumber(const std::string& priority) = 0;
+ virtual policy_table::NumberOfNotificationsType GetNotificationsNumber(const std::string& priority) = 0;
/**
* @brief Get priority for given application
@@ -342,6 +342,15 @@ class CacheManagerInterface {
rpc::policy_table_interface_base::Strings &preconsented_groups) = 0;
/**
+ * @brief Add's information about mobile device in Policy Table.
+ * @param device_id Generated or obtained id of device
+ * @param connection_type device connection type
+ * @return bool Success of operation
+ */
+ virtual bool AddDevice(const std::string& device_id,
+ const std::string& connection_type) = 0;
+
+ /**
* @brief Record information about mobile device in Policy Table.
* @param device_id Generated or obtained id of device
* @return bool Success of operation
@@ -527,9 +536,10 @@ class CacheManagerInterface {
/**
* @brief LoadFromFile allows to load policy cache from preloaded table.
* @param file_name preloaded
- * @return
+ * @param table object which will be filled during file parsing.
+ * @return true in case file was successfuly loaded, false otherwise.
*/
- virtual bool LoadFromFile(const std::string& file_name) = 0;
+ virtual bool LoadFromFile(const std::string& file_name, policy_table::Table& table) = 0;
/**
* @brief Backup allows to save cache onto hard drive.
@@ -539,10 +549,10 @@ class CacheManagerInterface {
/**
* Returns heart beat timeout
* @param app_id application id
- * @return if timeout was set then value in seconds greater zero
+ * @return if timeout was set then value in milliseconds greater zero
* otherwise heart beat for specific application isn't set
*/
- virtual uint16_t HeartBeatTimeout(const std::string& app_id) const = 0;
+ virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0;
/**
* @brief Resets all calculated permissions in cache
@@ -582,6 +592,24 @@ class CacheManagerInterface {
virtual void GetAppRequestTypes(
const std::string& policy_app_id,
std::vector<std::string>& request_types) const = 0;
+
+ /**
+ * @brief GetCertificate allows to obtain certificate in order to
+ * make secure connection
+ *
+ * @return The certificate in PKCS#7.
+ */
+ virtual std::string GetCertificate() const = 0;
+
+#ifdef BUILD_TESTS
+ /**
+ * @brief GetPT allows to obtain SharedPtr to PT.
+ * Used ONLY in Unit tests
+ * @return SharedPTR to PT
+ *
+ */
+ virtual utils::SharedPtr<policy_table::Table> GetPT() const = 0;
+#endif
};
typedef utils::SharedPtr<CacheManagerInterface> CacheManagerInterfaceSPtr;
diff --git a/src/components/policy/src/policy/include/policy/policy_helper.h b/src/components/policy/src/policy/include/policy/policy_helper.h
index c3fcce6b2b..15d28f3242 100644
--- a/src/components/policy/src/policy/include/policy/policy_helper.h
+++ b/src/components/policy/src/policy/include/policy/policy_helper.h
@@ -33,7 +33,7 @@
#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_HELPER_H_
#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_HELPER_H_
-#include "./functions.h"
+#include "functions.h"
#include "utils/shared_ptr.h"
#include "policy/policy_types.h"
diff --git a/src/components/policy/src/policy/include/policy/policy_listener.h b/src/components/policy/src/policy/include/policy/policy_listener.h
index 357fb20aed..197dfd5c8a 100644
--- a/src/components/policy/src/policy/include/policy/policy_listener.h
+++ b/src/components/policy/src/policy/include/policy/policy_listener.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -36,12 +36,15 @@
#include <queue>
#include "policy/policy_types.h"
+#include "utils/custom_string.h"
namespace policy {
+
+namespace custom_str = utils::custom_string;
+
class PolicyListener {
public:
- virtual ~PolicyListener() {
- }
+ virtual ~PolicyListener() {}
virtual void OnPermissionsUpdated(const std::string& policy_app_id,
const Permissions& permissions,
const policy::HMILevel& default_hmi) = 0;
@@ -52,16 +55,18 @@ class PolicyListener {
virtual std::string OnCurrentDeviceIdUpdateRequired(
const std::string& policy_app_id) = 0;
virtual void OnSystemInfoUpdateRequired() = 0;
- virtual std::string GetAppName(const std::string& policy_app_id) = 0;
- virtual void OnUpdateHMIAppType(std::map<std::string, StringArray> app_hmi_types) = 0;
+ virtual custom_str::CustomString GetAppName(
+ const std::string& policy_app_id) = 0;
+ virtual void OnUpdateHMIAppType(
+ std::map<std::string, StringArray> app_hmi_types) = 0;
- /**
- * @brief CanUpdate allows to find active application
- * and check whether related device consented.
- *
- * @return true if there are at least one application has been registered
- * with consented device.
- */
+ /**
+ * @brief CanUpdate allows to find active application
+ * and check whether related device consented.
+ *
+ * @return true if there are at least one application has been registered
+ * with consented device.
+ */
virtual bool CanUpdate() = 0;
/**
@@ -70,13 +75,8 @@ class PolicyListener {
*
* @param pt_string the snapshot
*
- * @param retry_seconds retry sequence timeouts.
- *
- * @param timeout_exceed timeout.
*/
- virtual void OnSnapshotCreated(const BinaryMessage& pt_string,
- const std::vector<int>& retry_seconds,
- int timeout_exceed) = 0;
+ virtual void OnSnapshotCreated(const BinaryMessage& pt_string) = 0;
/**
* @brief Make appropriate changes for related applications permissions and
diff --git a/src/components/policy/src/policy/include/policy/policy_manager.h b/src/components/policy/src/policy/include/policy/policy_manager.h
index 4a31df4437..40f6bd53df 100644
--- a/src/components/policy/src/policy/include/policy/policy_manager.h
+++ b/src/components/policy/src/policy/include/policy/policy_manager.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -34,12 +34,14 @@
#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_H_
#include <vector>
+#include <cstdint>
#include "policy/policy_types.h"
#include "policy/policy_listener.h"
#include "usage_statistics/statistics_manager.h"
namespace policy {
+
class PolicyManager : public usage_statistics::StatisticsManager {
public:
virtual ~PolicyManager() {
@@ -89,7 +91,7 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* @brief PTU is needed, for this PTS has to be formed and sent.
*/
- virtual void RequestPTUpdate() = 0;
+ virtual bool RequestPTUpdate() = 0;
/**
* @brief Check if specified RPC for specified application
@@ -143,10 +145,10 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* Gets timeout to wait before next retry updating PT
- * If timeout is less or equal to zero then the retry sequence is not need.
+ * If timeout is equal to zero then the retry sequence is not need.
* @return timeout in seconds
*/
- virtual int NextRetryTimeout() = 0;
+ virtual uint32_t NextRetryTimeout() = 0;
/**
* Gets timeout to wait until receive response
@@ -204,10 +206,9 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual bool ReactOnUserDevConsentForApp(const std::string app_id,
bool is_device_allowed) = 0;
/**
- * Sets number of kilometers and days after epoch, that passed for
- * receiving PT UPdate.
+ * Sets counter value that passed for receiving PT UPdate.
*/
- virtual void PTUpdatedAt(int kilometers, int days_after_epoch) = 0;
+ virtual void PTUpdatedAt(Counters counter, int value) = 0;
/**
* @brief Retrieves data from app_policies about app on its registration:
@@ -218,6 +219,15 @@ class PolicyManager : public usage_statistics::StatisticsManager {
virtual bool GetInitialAppData(const std::string& application_id,
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL) = 0;
+
+ /**
+ * @brief Add's device to policy table
+ * @param device_id Device mac address
+ * @param connection_type Device connection type
+ */
+ virtual void AddDevice(const std::string& device_id,
+ const std::string& connection_type) = 0;
+
/**
* @brief Stores device parameters received during application registration
* to policy table
@@ -383,10 +393,10 @@ class PolicyManager : public usage_statistics::StatisticsManager {
/**
* Returns heart beat timeout
* @param app_id application id
- * @return if timeout was set then value in seconds greater zero
+ * @return if timeout was set then value in milliseconds greater zero
* otherwise heart beat for specific application isn't set
*/
- virtual uint16_t HeartBeatTimeout(const std::string& app_id) const = 0;
+ virtual uint32_t HeartBeatTimeout(const std::string& app_id) const = 0;
/**
* @brief SaveUpdateStatusRequired alows to save update status.
@@ -409,6 +419,28 @@ class PolicyManager : public usage_statistics::StatisticsManager {
*/
virtual const std::vector<std::string> GetAppRequestTypes(
const std::string policy_app_id) const = 0;
+
+ /**
+ * @brief Get information about vehicle
+ */
+ virtual const VehicleInfo GetVehicleInfo() const = 0;
+
+ /**
+ * @brief OnAppRegisteredOnMobile alows to handle event when application were
+ * succesfully registered on mobile device.
+ * It will send OnAppPermissionSend notification and will try to start PTU.
+ *
+ * @param application_id registered application.
+ */
+ virtual void OnAppRegisteredOnMobile(const std::string& application_id) = 0;
+
+ /**
+ * @brief RetrieveCertificate Allows to obtain certificate in order
+ * to start secure connection.
+ *
+ * @return The certificate in PKCS#7 format.
+ */
+ virtual std::string RetrieveCertificate() const = 0;
protected:
/**
diff --git a/src/components/policy/src/policy/include/policy/policy_manager_impl.h b/src/components/policy/src/policy/include/policy/policy_manager_impl.h
index 50f9cf1481..efdd0e4a13 100644
--- a/src/components/policy/src/policy/include/policy/policy_manager_impl.h
+++ b/src/components/policy/src/policy/include/policy/policy_manager_impl.h
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -33,15 +33,20 @@
#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_
#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_MANAGER_IMPL_H_
+#include <string>
#include <list>
+#include <cstdint>
+
#include "utils/shared_ptr.h"
#include "utils/lock.h"
#include "policy/policy_manager.h"
#include "policy/policy_table.h"
#include "policy/cache_manager_interface.h"
#include "policy/update_status_manager.h"
-#include "./functions.h"
+#include "functions.h"
#include "usage_statistics/statistics_manager.h"
+#include "policy/policy_helper.h"
+#include "utils/timer.h"
namespace policy_table = rpc::policy_table_interface_base;
@@ -63,7 +68,7 @@ class PolicyManagerImpl : public PolicyManager {
EndpointUrls& end_points);
virtual std::string GetLockScreenIconUrl() const;
- virtual void RequestPTUpdate();
+ virtual bool RequestPTUpdate();
virtual void CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
@@ -75,12 +80,12 @@ class PolicyManagerImpl : public PolicyManager {
virtual std::string ForcePTExchange();
virtual std::string GetPolicyTableStatus() const;
virtual void ResetRetrySequence();
- virtual int NextRetryTimeout();
+ virtual uint32_t NextRetryTimeout();
virtual int TimeoutExchange();
virtual const std::vector<int> RetrySequenceDelaysSeconds();
virtual void OnExceededTimeout();
virtual void OnUpdateStarted();
- virtual void PTUpdatedAt(int kilometers, int days_after_epoch);
+ virtual void PTUpdatedAt(Counters counter, int value);
/**
* Refresh data about retry sequence from policy table
@@ -98,6 +103,9 @@ class PolicyManagerImpl : public PolicyManager {
StringArray* nicknames = NULL,
StringArray* app_hmi_types = NULL);
+ virtual void AddDevice(const std::string& device_id,
+ const std::string& connection_type);
+
virtual void SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info);
@@ -158,7 +166,7 @@ class PolicyManagerImpl : public PolicyManager {
virtual void RemoveAppConsentForGroup(const std::string& app_id,
const std::string& group_name);
- virtual uint16_t HeartBeatTimeout(const std::string& app_id) const;
+ virtual uint32_t HeartBeatTimeout(const std::string& app_id) const;
virtual void SaveUpdateStatusRequired(bool is_update_needed);
@@ -169,8 +177,18 @@ class PolicyManagerImpl : public PolicyManager {
virtual void OnAppsSearchCompleted();
+#ifdef BUILD_TESTS
+ inline CacheManagerInterfaceSPtr GetCache() { return cache_; }
+#endif // BUILD_TESTS
virtual const std::vector<std::string> GetAppRequestTypes(
const std::string policy_app_id) const;
+
+ virtual const VehicleInfo GetVehicleInfo() const;
+
+ virtual void OnAppRegisteredOnMobile(const std::string& application_id) OVERRIDE;
+
+ virtual std::string RetrieveCertificate() const OVERRIDE;
+
protected:
#ifdef USE_HMI_PTU_DECRYPTION
virtual utils::SharedPtr<policy_table::Table> Parse(
@@ -268,6 +286,8 @@ class PolicyManagerImpl : public PolicyManager {
bool IsPTValid(utils::SharedPtr<policy_table::Table> policy_table,
policy_table::PolicyTableType type) const;
+ void RetrySequence();
+
private:
PolicyListener* listener_;
@@ -280,7 +300,7 @@ private:
/**
* Timeout to wait response with UpdatePT
*/
- int retry_sequence_timeout_;
+ uint32_t retry_sequence_timeout_;
/**
* Seconds between retries to update PT
@@ -298,9 +318,9 @@ private:
sync_primitives::Lock retry_sequence_lock_;
/**
- * Lock for guarding recording statistics
- */
- sync_primitives::Lock statistics_lock_;
+ * Timer to retry UpdatePT
+ */
+ timer::Timer timer_retry_sequence_;
/**
* @brief Device id, which is used during PTU handling for specific
diff --git a/src/components/policy/src/policy/include/policy/policy_types.h b/src/components/policy/src/policy/include/policy/policy_types.h
index 367d0f2a09..949923e691 100644
--- a/src/components/policy/src/policy/include/policy/policy_types.h
+++ b/src/components/policy/src/policy/include/policy/policy_types.h
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -39,6 +39,7 @@
#include <set>
#include "utils/shared_ptr.h"
#include "utils/helpers.h"
+
namespace policy {
// TODO(PV): specify errors
@@ -181,10 +182,10 @@ struct DeviceInfo {
void AdoptDeviceType(const std::string& deviceType) {
connection_type = "USB_serial_number";
using namespace helpers;
- if (Compare<std::string, EQ, ONE> (deviceType,
- "BLUETOOTH",
- "WIFI")) {
- connection_type.assign("BTMAC");
+ static const std::string bluetooth("BLUETOOTH");
+ static const std::string wifi("WIFI");
+ if (Compare<std::string, EQ, ONE>(deviceType, bluetooth, wifi)) {
+ connection_type.assign("BTMAC");
}
}
};
@@ -305,6 +306,23 @@ typedef std::map<uint32_t, std::pair<std::string, std::string> > FunctionalGroup
*/
typedef std::vector<std::string> DeviceIds;
+/**
+ * @brief Counters that calculated on receiving of succesful update
+ */
+enum Counters {
+ KILOMETERS,
+ DAYS_AFTER_EPOCH
+};
+
+/**
+ * @struct Vehicle information
+ */
+struct VehicleInfo {
+ std::string vehicle_make;
+ std::string vehicle_model;
+ std::string vehicle_year;
+};
+
} // namespace policy
#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_POLICY_TYPES_H_
diff --git a/src/components/policy/src/policy/include/policy/pt_representation.h b/src/components/policy/src/policy/include/policy/pt_representation.h
index 3c02985446..f1b39d3f24 100644
--- a/src/components/policy/src/policy/include/policy/pt_representation.h
+++ b/src/components/policy/src/policy/include/policy/pt_representation.h
@@ -42,15 +42,6 @@ namespace policy_table = rpc::policy_table_interface_base;
namespace policy {
-/**
- * @struct Data about vehicle
- */
-struct VehicleData {
- const std::string vehicle_make;
- const std::string vehicle_model;
- int vehicle_year;
-};
-
enum InitResult {
NONE = 0,
EXISTS,
@@ -138,7 +129,7 @@ class PTRepresentation {
/**
* @brief Get information about vehicle
*/
- virtual VehicleData GetVehicleData() = 0;
+ virtual const VehicleInfo GetVehicleInfo() const = 0;
/**
* @brief Allows to update 'vin' field in module_meta table.
@@ -303,6 +294,25 @@ class PTRepresentation {
bool is_predata) = 0;
virtual void WriteDb() = 0;
+
+ /**
+ * @brief RemoveDB allows to remove the database.
+ * It will either remove or do nothing in case file not exists or any other
+ * troubles are happens during this operation.
+ */
+ virtual void RemoveDB() const = 0;
+
+ /**
+ * @brief Checks if DB version is actual to current schema
+ * @return true if actual, otherwise - false
+ */
+ virtual bool IsDBVersionActual() const = 0;
+
+ /**
+ * @brief Updates DB version according to current schema
+ * @return true if success, otherwise - false
+ */
+ virtual bool UpdateDBVersion() const = 0;
};
} // namespace policy
diff --git a/src/components/policy/src/policy/include/policy/sql_pt_queries.h b/src/components/policy/src/policy/include/policy/sql_pt_queries.h
index 14c10d6319..a2fbdef3f5 100644
--- a/src/components/policy/src/policy/include/policy/sql_pt_queries.h
+++ b/src/components/policy/src/policy/include/policy/sql_pt_queries.h
@@ -113,7 +113,8 @@ extern const std::string kInsertApplicationFull;
extern const std::string kDeletePreconsentedGroupsByApplicationId;
extern const std::string kSelectApplicationFull;
extern const std::string kUpdatePreloaded;
-
+extern const std::string kSelectDBVersion;
+extern const std::string kUpdateDBVersion;
} // namespace sql_pt
} // namespace policy
diff --git a/src/components/policy/src/policy/include/policy/sql_pt_representation.h b/src/components/policy/src/policy/include/policy/sql_pt_representation.h
index 2a498a6fb0..e5248774cf 100644
--- a/src/components/policy/src/policy/include/policy/sql_pt_representation.h
+++ b/src/components/policy/src/policy/include/policy/sql_pt_representation.h
@@ -37,15 +37,18 @@
#include <vector>
#include "policy/pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "./types.h"
+#include "types.h"
namespace policy_table = rpc::policy_table_interface_base;
-namespace policy {
-
+namespace utils {
namespace dbms {
class SQLDatabase;
-} // namespace dbms
+} // namespace dbms
+} // namespace utils
+
+
+namespace policy {
class SQLPTRepresentation : public virtual PTRepresentation {
public:
@@ -67,7 +70,7 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual int TimeoutResponse();
virtual bool SecondsBetweenRetries(std::vector<int>* seconds);
virtual bool RefreshDB();
- virtual VehicleData GetVehicleData();
+ virtual const VehicleInfo GetVehicleInfo() const;
virtual std::vector<UserFriendlyMessage> GetUserFriendlyMsg(
const std::vector<std::string>& msg_codes, const std::string& language);
@@ -89,6 +92,11 @@ class SQLPTRepresentation : public virtual PTRepresentation {
StringArray* app_hmi_types = NULL);
bool GetFunctionalGroupings(policy_table::FunctionalGroupings& groups);
+#ifdef BUILD_TESTS
+ uint32_t open_counter() {
+ return open_counter_;
+ }
+#endif // BUILD_TESTS
protected:
virtual void GatherModuleMeta(policy_table::ModuleMeta* meta) const;
virtual void GatherModuleConfig(policy_table::ModuleConfig* config) const;
@@ -160,13 +168,27 @@ class SQLPTRepresentation : public virtual PTRepresentation {
virtual bool SetVINValue(const std::string& value);
- dbms::SQLDatabase* db() const;
+ virtual utils::dbms::SQLDatabase* db() const;
virtual bool SetIsDefault(const std::string& app_id, bool is_default) const;
+
+ void RemoveDB() const OVERRIDE;
+ virtual bool IsDBVersionActual() const OVERRIDE;
+ virtual bool UpdateDBVersion() const OVERRIDE;
+
private:
static const std::string kDatabaseName;
- dbms::SQLDatabase* db_;
+ utils::dbms::SQLDatabase* db_;
+
+#ifdef BUILD_TESTS
+ uint32_t open_counter_;
+#endif // BUILD_TESTS
+ /**
+ * @brief Calculates DB version from current schema
+ * @return version
+ */
+ const int32_t GetDBVersion() const;
bool SaveRpcs(int64_t group_id, const policy_table::Rpc& rpcs);
bool SaveServiceEndpoints(const policy_table::ServiceEndpoints& endpoints);
bool SaveSecondsBetweenRetries(
diff --git a/src/components/policy/src/policy/include/policy/update_status_manager.h b/src/components/policy/src/policy/include/policy/update_status_manager.h
index 2fb0a2b18b..f239325bdf 100644
--- a/src/components/policy/src/policy/include/policy/update_status_manager.h
+++ b/src/components/policy/src/policy/include/policy/update_status_manager.h
@@ -3,7 +3,6 @@
#include "policy/policy_types.h"
#include "utils/lock.h"
-#include "utils/timer_thread.h"
#include "utils/threads/thread.h"
#include "utils/threads/thread_delegate.h"
#include "utils/conditional_variable.h"
@@ -121,6 +120,12 @@ class UpdateStatusManager {
*/
bool IsAppsSearchInProgress();
+#ifdef BUILD_TESTS
+ PolicyTableStatus GetLastUpdateStatus() const {
+ return GetUpdateStatus();
+ }
+#endif // BUILD_TESTS
+
private:
/*
* @brief Sets flag for update progress
diff --git a/src/components/policy/src/policy/policy_table/table_struct/types.cc b/src/components/policy/src/policy/policy_table/table_struct/types.cc
index fb1daf2b33..458b5cfb9f 100644
--- a/src/components/policy/src/policy/policy_table/table_struct/types.cc
+++ b/src/components/policy/src/policy/policy_table/table_struct/types.cc
@@ -26,107 +26,55 @@ namespace policy_table_interface_base {
PolicyBase::PolicyBase()
: CompositeType(kUninitialized) {
}
- PolicyBase::PolicyBase(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus)
+
+ PolicyBase::PolicyBase(Priority priority)
: CompositeType(kUninitialized),
- groups(groups),
- priority(priority),
- default_hmi(default_hmi),
- keep_context(keep_context),
- steal_focus(steal_focus) {
+ priority(priority) {
}
+
PolicyBase::~PolicyBase() {
}
+
PolicyBase::PolicyBase(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject)),
- groups(impl::ValueMember(value__, "groups")),
- preconsented_groups(impl::ValueMember(value__, "preconsented_groups")),
- priority(impl::ValueMember(value__, "priority")),
- default_hmi(impl::ValueMember(value__, "default_hmi")),
- keep_context(impl::ValueMember(value__, "keep_context")),
- steal_focus(impl::ValueMember(value__, "steal_focus")) {
+ priority(impl::ValueMember(value__, "priority")) {
}
+
Json::Value PolicyBase::ToJsonValue() const {
Json::Value result__(Json::objectValue);
- impl::WriteJsonField("groups", groups, &result__);
- impl::WriteJsonField("preconsented_groups", preconsented_groups, &result__);
impl::WriteJsonField("priority", priority, &result__);
- impl::WriteJsonField("default_hmi", default_hmi, &result__);
- impl::WriteJsonField("keep_context", keep_context, &result__);
- impl::WriteJsonField("steal_focus", steal_focus, &result__);
return result__;
}
+
bool PolicyBase::is_valid() const {
- if (!groups.is_valid()) {
- return false;
- }
- if (!preconsented_groups.is_valid()) {
- return false;
- }
if (!priority.is_valid()) {
return false;
}
- if (!default_hmi.is_valid()) {
- return false;
- }
- if (!keep_context.is_valid()) {
- return false;
- }
- if (!steal_focus.is_valid()) {
- return false;
- }
return Validate();
}
+
bool PolicyBase::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
+
bool PolicyBase::struct_empty() const {
- if (groups.is_initialized()) {
- return false;
- }
- if (preconsented_groups.is_initialized()) {
- return false;
- }
if (priority.is_initialized()) {
return false;
}
- if (default_hmi.is_initialized()) {
- return false;
- }
- if (keep_context.is_initialized()) {
- return false;
- }
- if (steal_focus.is_initialized()) {
- return false;
- }
return true;
}
+
void PolicyBase::ReportErrors(rpc::ValidationReport* report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
}
- if (!groups.is_valid()) {
- groups.ReportErrors(&report__->ReportSubobject("groups"));
- }
- if (!preconsented_groups.is_valid()) {
- preconsented_groups.ReportErrors(&report__->ReportSubobject("preconsented_groups"));
- }
if (!priority.is_valid()) {
priority.ReportErrors(&report__->ReportSubobject("priority"));
}
- if (!default_hmi.is_valid()) {
- default_hmi.ReportErrors(&report__->ReportSubobject("default_hmi"));
- }
- if (!keep_context.is_valid()) {
- keep_context.ReportErrors(&report__->ReportSubobject("keep_context"));
- }
- if (!steal_focus.is_valid()) {
- steal_focus.ReportErrors(&report__->ReportSubobject("steal_focus"));
- }
}
void PolicyBase::SetPolicyTableType(PolicyTableType pt_type) {
CompositeType::SetPolicyTableType(pt_type);
- groups.SetPolicyTableType(pt_type);
priority.SetPolicyTableType(pt_type);
}
@@ -134,11 +82,14 @@ namespace policy_table_interface_base {
DevicePolicy::DevicePolicy()
: PolicyBase() {
}
- DevicePolicy::DevicePolicy(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus)
- : PolicyBase(groups, priority, default_hmi, keep_context, steal_focus) {
+
+ DevicePolicy::DevicePolicy(Priority priority)
+ : PolicyBase(priority) {
}
+
DevicePolicy::~DevicePolicy() {
}
+
DevicePolicy::DevicePolicy(const Json::Value* value__)
: PolicyBase(value__) {
}
@@ -147,13 +98,16 @@ namespace policy_table_interface_base {
ApplicationPoliciesSection::ApplicationPoliciesSection()
: CompositeType(kUninitialized) {
}
+
ApplicationPoliciesSection::ApplicationPoliciesSection(const ApplicationPolicies& apps, const DevicePolicy& device)
: CompositeType(kUninitialized),
apps(apps),
device(device) {
}
+
ApplicationPoliciesSection::~ApplicationPoliciesSection() {
}
+
ApplicationPoliciesSection::ApplicationPoliciesSection(const Json::Value* value__)
: CompositeType(InitHelper(value__, &Json::Value::isObject)),
apps(value__),
@@ -163,12 +117,14 @@ namespace policy_table_interface_base {
// device section
apps.erase("device");
}
+
Json::Value ApplicationPoliciesSection::ToJsonValue() const {
Json::Value result__(Json::objectValue);
result__ = apps.ToJsonValue();
impl::WriteJsonField("device", device, &result__);
return result__;
}
+
bool ApplicationPoliciesSection::is_valid() const {
if (!device.is_valid()) {
return false;
@@ -178,9 +134,11 @@ namespace policy_table_interface_base {
}
return Validate();
}
+
bool ApplicationPoliciesSection::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
+
bool ApplicationPoliciesSection::struct_empty() const {
if (device.is_initialized()) {
return false;
@@ -190,6 +148,7 @@ namespace policy_table_interface_base {
}
return true;
}
+
void ApplicationPoliciesSection::ReportErrors(rpc::ValidationReport* report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
@@ -210,15 +169,21 @@ namespace policy_table_interface_base {
// ApplicationParams methods
ApplicationParams::ApplicationParams()
- : PolicyBase() {
+ : PolicyBase(),
+ groups() {
}
-ApplicationParams::ApplicationParams(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus)
- : PolicyBase(groups, priority, default_hmi, keep_context, steal_focus) {
+
+ApplicationParams::ApplicationParams(const Strings& groups, Priority priority)
+ : PolicyBase(priority),
+ groups(groups) {
}
+
ApplicationParams::~ApplicationParams() {
}
+
ApplicationParams::ApplicationParams(const Json::Value* value__)
: PolicyBase(value__),
+ groups(impl::ValueMember(value__, "groups")),
nicknames(impl::ValueMember(value__, "nicknames")),
AppHMIType(impl::ValueMember(value__, "AppHMIType")),
RequestType(impl::ValueMember(value__, "RequestType")),
@@ -226,8 +191,10 @@ ApplicationParams::ApplicationParams(const Json::Value* value__)
heart_beat_timeout_ms(impl::ValueMember(value__, "heart_beat_timeout_ms")),
certificate(impl::ValueMember(value__, "certificate"), "not_specified") {
}
+
Json::Value ApplicationParams::ToJsonValue() const {
Json::Value result__(PolicyBase::ToJsonValue());
+ impl::WriteJsonField("groups", groups, &result__);
impl::WriteJsonField("nicknames", nicknames, &result__);
impl::WriteJsonField("AppHMIType", AppHMIType, &result__);
impl::WriteJsonField("RequestType", RequestType, &result__);
@@ -236,12 +203,16 @@ Json::Value ApplicationParams::ToJsonValue() const {
impl::WriteJsonField("certificate", certificate, &result__);
return result__;
}
+
bool ApplicationParams::is_valid() const {
// RequestType is not validated since there is high-level validation logic,
// which takes into account information not available here.
if (!PolicyBase::is_valid()) {
return false;
}
+ if (!groups.is_valid()) {
+ return false;
+ }
if (!nicknames.is_valid()) {
return false;
}
@@ -259,13 +230,18 @@ bool ApplicationParams::is_valid() const {
}
return Validate();
}
+
bool ApplicationParams::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
+
bool ApplicationParams::struct_empty() const {
if (!PolicyBase::is_initialized()) {
return false;
}
+ if (groups.is_initialized()) {
+ return false;
+ }
if (nicknames.is_initialized()) {
return false;
}
@@ -286,6 +262,7 @@ bool ApplicationParams::struct_empty() const {
}
return true;
}
+
void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (struct_empty()) {
rpc::CompositeType::ReportErrors(report__);
@@ -296,9 +273,6 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!nicknames.is_valid()) {
nicknames.ReportErrors(&report__->ReportSubobject("nicknames"));
}
- if (!preconsented_groups.is_valid()) {
- preconsented_groups.ReportErrors(&report__->ReportSubobject("preconsented_groups"));
- }
if (!AppHMIType.is_valid()) {
AppHMIType.ReportErrors(&report__->ReportSubobject("AppHMIType"));
}
@@ -308,15 +282,6 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
if (!priority.is_valid()) {
priority.ReportErrors(&report__->ReportSubobject("priority"));
}
- if (!default_hmi.is_valid()) {
- default_hmi.ReportErrors(&report__->ReportSubobject("default_hmi"));
- }
- if (!keep_context.is_valid()) {
- keep_context.ReportErrors(&report__->ReportSubobject("keep_context"));
- }
- if (!steal_focus.is_valid()) {
- steal_focus.ReportErrors(&report__->ReportSubobject("steal_focus"));
- }
if (!memory_kb.is_valid()) {
memory_kb.ReportErrors(&report__->ReportSubobject("memory_kb"));
}
@@ -330,12 +295,14 @@ void ApplicationParams::ReportErrors(rpc::ValidationReport* report__) const {
void ApplicationParams::SetPolicyTableType(PolicyTableType pt_type) {
PolicyBase::SetPolicyTableType(pt_type);
+ groups.SetPolicyTableType(pt_type);
AppHMIType.SetPolicyTableType(pt_type);
RequestType.SetPolicyTableType(pt_type);
memory_kb.SetPolicyTableType(pt_type);
heart_beat_timeout_ms.SetPolicyTableType(pt_type);
certificate.SetPolicyTableType(pt_type);
}
+
// RpcParameters methods
RpcParameters::RpcParameters()
: CompositeType(kUninitialized) {
@@ -487,7 +454,9 @@ ModuleConfig::ModuleConfig(const Json::Value* value__)
notifications_per_minute_by_priority(impl::ValueMember(value__, "notifications_per_minute_by_priority")),
vehicle_make(impl::ValueMember(value__, "vehicle_make")),
vehicle_model(impl::ValueMember(value__, "vehicle_model")),
- vehicle_year(impl::ValueMember(value__, "vehicle_year")) {
+ vehicle_year(impl::ValueMember(value__, "vehicle_year")),
+ preloaded_date(impl::ValueMember(value__, "preloaded_date")),
+ certificate(impl::ValueMember(value__, "certificate")){
}
void ModuleConfig::SafeCopyFrom(const ModuleConfig& from) {
@@ -521,6 +490,8 @@ Json::Value ModuleConfig::ToJsonValue() const {
impl::WriteJsonField("vehicle_make", vehicle_make, &result__);
impl::WriteJsonField("vehicle_model", vehicle_model, &result__);
impl::WriteJsonField("vehicle_year", vehicle_year, &result__);
+ impl::WriteJsonField("certificate", certificate, &result__);
+ impl::WriteJsonField("preloaded_date", preloaded_date, &result__);
return result__;
}
bool ModuleConfig::is_valid() const {
@@ -560,6 +531,12 @@ bool ModuleConfig::is_valid() const {
if (!vehicle_year.is_valid()) {
return false;
}
+ if (!certificate.is_valid()) {
+ return false;
+ }
+ if (!preloaded_date.is_valid()) {
+ return false;
+ }
return Validate();
}
bool ModuleConfig::is_initialized() const {
@@ -941,18 +918,109 @@ void ModuleMeta::ReportErrors(rpc::ValidationReport* report__) const {
AppLevel::AppLevel()
: CompositeType(kUninitialized) {
}
+
+AppLevel::AppLevel(uint16_t minutes_in_hmi_full, const std::string& app_registration_language_gui, const std::string& app_registration_language_vui, uint16_t minutes_in_hmi_limited, uint16_t minutes_in_hmi_background, uint16_t minutes_in_hmi_none, uint16_t count_of_user_selections, uint16_t count_of_rejections_sync_out_of_memory, uint16_t count_of_rejections_nickname_mismatch, uint16_t count_of_rejections_duplicate_name, uint16_t count_of_rejected_rpc_calls, uint16_t count_of_rpcs_sent_in_hmi_none, uint16_t count_of_removals_for_bad_behavior, uint16_t count_of_tls_errors, uint16_t count_of_run_attempts_while_revoked)
+ : CompositeType(kUninitialized),
+ minutes_in_hmi_full(minutes_in_hmi_full),
+ app_registration_language_gui(app_registration_language_gui),
+ app_registration_language_vui(app_registration_language_vui),
+ minutes_in_hmi_limited(minutes_in_hmi_limited),
+ minutes_in_hmi_background(minutes_in_hmi_background),
+ minutes_in_hmi_none(minutes_in_hmi_none),
+ count_of_user_selections(count_of_user_selections),
+ count_of_rejections_sync_out_of_memory(count_of_rejections_sync_out_of_memory),
+ count_of_rejections_nickname_mismatch(count_of_rejections_nickname_mismatch),
+ count_of_rejections_duplicate_name(count_of_rejections_duplicate_name),
+ count_of_rejected_rpc_calls(count_of_rejected_rpc_calls),
+ count_of_rpcs_sent_in_hmi_none(count_of_rpcs_sent_in_hmi_none),
+ count_of_removals_for_bad_behavior(count_of_removals_for_bad_behavior),
+ count_of_tls_errors(count_of_tls_errors),
+ count_of_run_attempts_while_revoked(count_of_run_attempts_while_revoked) {
+}
AppLevel::~AppLevel() {
}
AppLevel::AppLevel(const Json::Value* value__)
- : CompositeType(InitHelper(value__, &Json::Value::isObject)) {
+ : CompositeType(InitHelper(value__, &Json::Value::isObject)),
+ minutes_in_hmi_full(impl::ValueMember(value__, "minutes_in_hmi_full")),
+ app_registration_language_gui(impl::ValueMember(value__, "app_registration_language_gui")),
+ app_registration_language_vui(impl::ValueMember(value__, "app_registration_language_vui")),
+ minutes_in_hmi_limited(impl::ValueMember(value__, "minutes_in_hmi_limited")),
+ minutes_in_hmi_background(impl::ValueMember(value__, "minutes_in_hmi_background")),
+ minutes_in_hmi_none(impl::ValueMember(value__, "minutes_in_hmi_none")),
+ count_of_user_selections(impl::ValueMember(value__, "count_of_user_selections")),
+ count_of_rejections_sync_out_of_memory(impl::ValueMember(value__, "count_of_rejections_sync_out_of_memory")),
+ count_of_rejections_nickname_mismatch(impl::ValueMember(value__, "count_of_rejections_nickname_mismatch")),
+ count_of_rejections_duplicate_name(impl::ValueMember(value__, "count_of_rejections_duplicate_name")),
+ count_of_rejected_rpc_calls(impl::ValueMember(value__, "count_of_rejected_rpc_calls")),
+ count_of_rpcs_sent_in_hmi_none(impl::ValueMember(value__, "count_of_rpcs_sent_in_hmi_none")),
+ count_of_removals_for_bad_behavior(impl::ValueMember(value__, "count_of_removals_for_bad_behavior")),
+ count_of_tls_errors(impl::ValueMember(value__, "count_of_tls_errors")),
+ count_of_run_attempts_while_revoked(impl::ValueMember(value__, "count_of_run_attempts_while_revoked")) {
}
Json::Value AppLevel::ToJsonValue() const {
Json::Value result__(Json::objectValue);
+ impl::WriteJsonField("minutes_in_hmi_full", minutes_in_hmi_full, &result__);
+ impl::WriteJsonField("app_registration_language_gui", app_registration_language_gui, &result__);
+ impl::WriteJsonField("app_registration_language_vui", app_registration_language_vui, &result__);
+ impl::WriteJsonField("minutes_in_hmi_limited", minutes_in_hmi_limited, &result__);
+ impl::WriteJsonField("minutes_in_hmi_background", minutes_in_hmi_background, &result__);
+ impl::WriteJsonField("minutes_in_hmi_none", minutes_in_hmi_none, &result__);
+ impl::WriteJsonField("count_of_user_selections", count_of_user_selections, &result__);
+ impl::WriteJsonField("count_of_rejections_sync_out_of_memory", count_of_rejections_sync_out_of_memory, &result__);
+ impl::WriteJsonField("count_of_rejections_nickname_mismatch", count_of_rejections_nickname_mismatch, &result__);
+ impl::WriteJsonField("count_of_rejections_duplicate_name", count_of_rejections_duplicate_name, &result__);
+ impl::WriteJsonField("count_of_rejected_rpc_calls", count_of_rejected_rpc_calls, &result__);
+ impl::WriteJsonField("count_of_rpcs_sent_in_hmi_none", count_of_rpcs_sent_in_hmi_none, &result__);
+ impl::WriteJsonField("count_of_removals_for_bad_behavior", count_of_removals_for_bad_behavior, &result__);
+ impl::WriteJsonField("count_of_tls_errors", count_of_tls_errors, &result__);
+ impl::WriteJsonField("count_of_run_attempts_while_revoked", count_of_run_attempts_while_revoked, &result__);
return result__;
}
bool AppLevel::is_valid() const {
- if (struct_empty()) {
- return initialization_state__ == kInitialized && Validate();
+ if (!minutes_in_hmi_full.is_valid()) {
+ return false;
+ }
+ if (!app_registration_language_gui.is_valid()) {
+ return false;
+ }
+ if (!app_registration_language_vui.is_valid()) {
+ return false;
+ }
+ if (!minutes_in_hmi_limited.is_valid()) {
+ return false;
+ }
+ if (!minutes_in_hmi_background.is_valid()) {
+ return false;
+ }
+ if (!minutes_in_hmi_none.is_valid()) {
+ return false;
+ }
+ if (!count_of_user_selections.is_valid()) {
+ return false;
+ }
+ if (!count_of_rejections_sync_out_of_memory.is_valid()) {
+ return false;
+ }
+ if (!count_of_rejections_nickname_mismatch.is_valid()) {
+ return false;
+ }
+ if (!count_of_rejections_duplicate_name.is_valid()) {
+ return false;
+ }
+ if (!count_of_rejected_rpc_calls.is_valid()) {
+ return false;
+ }
+ if (!count_of_rpcs_sent_in_hmi_none.is_valid()) {
+ return false;
+ }
+ if (!count_of_removals_for_bad_behavior.is_valid()) {
+ return false;
+ }
+ if (!count_of_tls_errors.is_valid()) {
+ return false;
+ }
+ if (!count_of_run_attempts_while_revoked.is_valid()) {
+ return false;
}
return Validate();
}
@@ -960,6 +1028,58 @@ bool AppLevel::is_initialized() const {
return (initialization_state__ != kUninitialized) || (!struct_empty());
}
bool AppLevel::struct_empty() const {
+
+ if (minutes_in_hmi_full.is_initialized()) {
+ return false;
+ }
+ if (app_registration_language_gui.is_initialized()) {
+ return false;
+ }
+
+ if (app_registration_language_vui.is_initialized()) {
+ return false;
+ }
+
+ if (minutes_in_hmi_limited.is_initialized()) {
+ return false;
+ }
+ if (minutes_in_hmi_background.is_initialized()) {
+ return false;
+ }
+
+ if (minutes_in_hmi_none.is_initialized()) {
+ return false;
+ }
+ if (count_of_user_selections.is_initialized()) {
+ return false;
+ }
+
+ if (count_of_rejections_sync_out_of_memory.is_initialized()) {
+ return false;
+ }
+ if (count_of_rejections_nickname_mismatch.is_initialized()) {
+ return false;
+ }
+
+ if (count_of_rejections_duplicate_name.is_initialized()) {
+ return false;
+ }
+ if (count_of_rejected_rpc_calls.is_initialized()) {
+ return false;
+ }
+
+ if (count_of_rpcs_sent_in_hmi_none.is_initialized()) {
+ return false;
+ }
+ if (count_of_removals_for_bad_behavior.is_initialized()) {
+ return false;
+ }
+ if (count_of_tls_errors.is_initialized()) {
+ return false;
+ }
+ if (count_of_run_attempts_while_revoked.is_initialized()) {
+ return false;
+ }
return true;
}
void AppLevel::ReportErrors(rpc::ValidationReport* report__) const {
diff --git a/src/components/policy/src/policy/policy_table/table_struct/types.h b/src/components/policy/src/policy/policy_table/table_struct/types.h
index a7b0e2d492..1e8d17b27a 100644
--- a/src/components/policy/src/policy/policy_table/table_struct/types.h
+++ b/src/components/policy/src/policy/policy_table/table_struct/types.h
@@ -1,6 +1,8 @@
// This file is generated, do not edit
#ifndef POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_
#define POLICY_TABLE_INTERFACE_BASE_POLICY_TABLE_INTERFACE_BASE_TYPES_H_
+#include <climits>
+
#include "./enums.h"
#include "rpc_base/rpc_message.h"
namespace Json {
@@ -38,7 +40,8 @@ typedef Map< URL, 1, 255 > URLList;
typedef Map< URLList, 1, 255 > ServiceEndpoints;
-typedef Map< Integer<uint8_t, 0, 255>, 0, 6 > NumberOfNotificationsPerMinute;
+typedef uint8_t NumberOfNotificationsType;
+typedef Map< Integer<NumberOfNotificationsType, 0, 255>, 0, 6 > NumberOfNotificationsPerMinute;
typedef Array< Integer<uint16_t, 1, 1000>, 0, 10 > SecondsBetweenRetries;
@@ -58,15 +61,10 @@ typedef Array< Enum<RequestType>, 0, 255 > RequestTypes;
struct PolicyBase : CompositeType {
public:
- Strings groups;
- Optional< Strings > preconsented_groups;
Enum<Priority> priority;
- Enum<HmiLevel> default_hmi;
- Boolean keep_context;
- Boolean steal_focus;
public:
PolicyBase();
- PolicyBase(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus);
+ PolicyBase(Priority priority);
virtual ~PolicyBase();
explicit PolicyBase(const Json::Value* value__);
Json::Value ToJsonValue() const;
@@ -82,22 +80,23 @@ struct PolicyBase : CompositeType {
struct DevicePolicy : PolicyBase {
public:
DevicePolicy();
- DevicePolicy(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus);
+ DevicePolicy(Priority priority);
~DevicePolicy();
explicit DevicePolicy(const Json::Value* value__);
};
struct ApplicationParams : PolicyBase {
public:
+ Strings groups;
Optional< Strings > nicknames;
Optional< AppHMITypes > AppHMIType;
Optional< RequestTypes > RequestType;
Optional< Integer<uint16_t, 0, 65225> > memory_kb;
- Optional< Integer<uint16_t, 0, 65225> > heart_beat_timeout_ms;
+ Optional< Integer<uint32_t, 0, UINT_MAX> > heart_beat_timeout_ms;
Optional< String<0, 255> > certificate;
public:
ApplicationParams();
- ApplicationParams(const Strings& groups, Priority priority, HmiLevel default_hmi, bool keep_context, bool steal_focus);
+ ApplicationParams(const Strings& groups, Priority priority);
~ApplicationParams();
explicit ApplicationParams(const Json::Value* value__);
Json::Value ToJsonValue() const;
@@ -181,6 +180,7 @@ struct ModuleConfig : CompositeType {
Optional< String<1, 100> > vehicle_make;
Optional< String<1, 100> > vehicle_model;
Optional< String<4, 4> > vehicle_year;
+ Optional< String<0, 10> > preloaded_date;
Optional< String<0, 65535> > certificate;
public:
ModuleConfig();
@@ -273,8 +273,26 @@ struct ModuleMeta : CompositeType {
struct AppLevel : CompositeType {
public:
+
+ Integer<uint16_t, 0, 65535> minutes_in_hmi_full;
+ String<1, 10> app_registration_language_gui;
+ String<0, 10> app_registration_language_vui;
+ Integer<uint16_t, 0, 65535> minutes_in_hmi_limited;
+ Integer<uint16_t, 0, 65535> minutes_in_hmi_background;
+ Integer<uint16_t, 0, 65535> minutes_in_hmi_none;
+ Integer<uint16_t, 0, 65535> count_of_user_selections;
+ Integer<uint16_t, 0, 65535> count_of_rejections_sync_out_of_memory;
+ Integer<uint16_t, 0, 65535> count_of_rejections_nickname_mismatch;
+ Integer<uint16_t, 0, 65535> count_of_rejections_duplicate_name;
+ Integer<uint16_t, 0, 65535> count_of_rejected_rpc_calls;
+ Integer<uint16_t, 0, 65535> count_of_rpcs_sent_in_hmi_none;
+ Integer<uint16_t, 0, 65535> count_of_removals_for_bad_behavior;
+ Integer<uint16_t, 0, 65535> count_of_tls_errors;
+ Integer<uint16_t, 0, 65535> count_of_run_attempts_while_revoked;
public:
AppLevel();
+ AppLevel(uint16_t minutes_in_hmi_full, const std::string& app_registration_language_gui, const std::string& app_registration_language_vui, uint16_t minutes_in_hmi_limited, uint16_t minutes_in_hmi_background, uint16_t minutes_in_hmi_none, uint16_t count_of_user_selections, uint16_t count_of_rejections_sync_out_of_memory, uint16_t count_of_rejections_nickname_mismatch, uint16_t count_of_rejections_duplicate_name, uint16_t count_of_rejected_rpc_calls, uint16_t count_of_rpcs_sent_in_hmi_none, uint16_t count_of_removals_for_bad_behavior,
+uint16_t count_of_tls_errors, uint16_t count_of_run_attempts_while_revoked);
~AppLevel();
explicit AppLevel(const Json::Value* value__);
Json::Value ToJsonValue() const;
diff --git a/src/components/policy/src/policy/policy_table/table_struct/validation.cc b/src/components/policy/src/policy/policy_table/table_struct/validation.cc
index be39b8022e..a4e12ed3a6 100644
--- a/src/components/policy/src/policy/policy_table/table_struct/validation.cc
+++ b/src/components/policy/src/policy/policy_table/table_struct/validation.cc
@@ -9,7 +9,7 @@ bool IsTypeInvalid(rpc::Enum<rpc::policy_table_interface_base::RequestType> requ
namespace rpc {
namespace policy_table_interface_base {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyTableValidation")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
void RemoveInvalidTypes(RequestTypes& types) {
types.erase(
@@ -153,9 +153,8 @@ bool MessageLanguages::Validate() const {
}
bool ConsumerFriendlyMessages::Validate() const {
- if (PT_SNAPSHOT == GetPolicyTableType()) {
- return false;
- }
+ /* According to requirements consumer_friendly_messages are optional for PTU
+ and required for PTP and PTS. So, they are allowed always */
return true;
}
diff --git a/src/components/policy/src/policy/src/cache_manager.cc b/src/components/policy/src/policy/src/cache_manager.cc
index c6df31f35a..3cba7d857e 100644
--- a/src/components/policy/src/policy/src/cache_manager.cc
+++ b/src/components/policy/src/policy/src/cache_manager.cc
@@ -42,6 +42,10 @@
#include "json/features.h"
#include "json/writer.h"
#include "utils/logger.h"
+#include "utils/gen_hash.h"
+#include "utils/macro.h"
+#include "utils/threads/thread.h"
+#include "utils/threads/thread_delegate.h"
# include "policy/sql_pt_representation.h"
@@ -49,7 +53,7 @@ namespace policy_table = rpc::policy_table_interface_base;
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "CacheManager")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
#define CACHE_MANAGER_CHECK(return_value) {\
if (!pt_) {\
@@ -79,9 +83,8 @@ private:
CacheManager::CacheManager()
: CacheManagerInterface(),
- backup_(
- new SQLPTRepresentation()
- ),
+ pt_(new policy_table::Table),
+ backup_(new SQLPTRepresentation()),
update_required(false) {
LOG4CXX_AUTO_TRACE(logger_);
@@ -104,9 +107,9 @@ bool CacheManager::CanAppKeepContext(const std::string &app_id) {
return result;
}
-uint16_t CacheManager::HeartBeatTimeout(const std::string &app_id) const {
+uint32_t CacheManager::HeartBeatTimeout(const std::string& app_id) const {
CACHE_MANAGER_CHECK(0);
- uint16_t result = 0;
+ uint32_t result = 0;
if (AppExists(app_id)) {
if (pt_->policy_table.app_policies_section.apps[app_id].heart_beat_timeout_ms
.is_initialized()) {
@@ -150,19 +153,9 @@ void CacheManager::GetAllAppGroups(const std::string& app_id,
LOG4CXX_AUTO_TRACE(logger_);
CACHE_MANAGER_CHECK_VOID();
- if (kDeviceId == app_id) {
- policy_table::DevicePolicy& device =
- pt_->policy_table.app_policies_section.device;
-
- policy_table::Strings::const_iterator iter = device.groups.begin();
- policy_table::Strings::const_iterator iter_end = device.groups.end();
-
- for (; iter != iter_end; ++iter) {
- const uint32_t group_id =
- static_cast<uint32_t> ((GenerateHash(*iter)));
- all_group_ids.push_back(group_id);
- }
+ if (kDeviceId == app_id) {
+ LOG4CXX_INFO(logger_, "Devices doesn't have groups");
return;
}
@@ -309,6 +302,16 @@ bool CacheManager::GetDeviceGroupsFromPolicies(
return true;
}
+bool CacheManager::AddDevice(const std::string& device_id,
+ const std::string& connection_type) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ sync_primitives::AutoLock auto_lock(cache_lock_);
+ CACHE_MANAGER_CHECK(false);
+ Backup();
+ return true;
+}
+
bool CacheManager::SetDeviceData(const std::string &device_id,
const std::string &hardware,
const std::string &firmware,
@@ -478,9 +481,11 @@ int CacheManager::KilometersBeforeExchange(int current) {
return std::max(limit - actual, 0);
}
-bool CacheManager::SetCountersPassedForSuccessfulUpdate(int kilometers,
- int days_after_epoch) {
+bool CacheManager::SetCountersPassedForSuccessfulUpdate(policy::Counters counter,
+ int value) {
CACHE_MANAGER_CHECK(false);
+ UNUSED(counter);
+ UNUSED(value);
Backup();
return true;
}
@@ -530,13 +535,23 @@ bool CacheManager::SecondsBetweenRetries(std::vector<int>& seconds) {
return true;
}
-VehicleData CacheManager::GetVehicleData() {
- // TODO(AGaliuzov): maybe should be removed.
- return VehicleData();
+const policy::VehicleInfo CacheManager::GetVehicleInfo() const {
+ CACHE_MANAGER_CHECK(VehicleInfo());
+ policy_table::ModuleConfig& module_config =
+ pt_->policy_table.module_config;
+ VehicleInfo vehicle_info;
+ vehicle_info.vehicle_make = *module_config.vehicle_make;
+ vehicle_info.vehicle_model = *module_config.vehicle_model;
+ vehicle_info.vehicle_year = *module_config.vehicle_year;
+ LOG4CXX_DEBUG(logger_, "Vehicle info (make, model, year):"
+ << vehicle_info.vehicle_make << ","
+ << vehicle_info.vehicle_model << ","
+ << vehicle_info.vehicle_year );
+ return vehicle_info;
}
std::vector<UserFriendlyMessage> CacheManager::GetUserFriendlyMsg(
- const std::vector<std::string> &msg_codes, const std::string &language) {
+ const std::vector<std::string>& msg_codes, const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
std::vector<UserFriendlyMessage> result;
@@ -623,7 +638,7 @@ std::string CacheManager::GetLockScreenIconUrl() const {
return std::string ("");
}
-int CacheManager::GetNotificationsNumber(const std::string &priority) {
+rpc::policy_table_interface_base::NumberOfNotificationsType CacheManager::GetNotificationsNumber(const std::string& priority) {
CACHE_MANAGER_CHECK(0);
typedef rpc::policy_table_interface_base::NumberOfNotificationsPerMinute NNPM;
@@ -632,7 +647,8 @@ int CacheManager::GetNotificationsNumber(const std::string &priority) {
NNPM::const_iterator priority_iter = nnpm.find(priority);
- const int result = (nnpm.end() != priority_iter ? (*priority_iter).second : 0);
+ const rpc::policy_table_interface_base::NumberOfNotificationsType result =
+ (nnpm.end() != priority_iter ? (*priority_iter).second : 0u);
return result;
}
@@ -666,6 +682,92 @@ void CacheManager::CheckSnapshotInitialization() {
}
*(snapshot_->policy_table.module_config.preloaded_pt) = false;
+
+ // SDL must not send certificate in snapshot
+ snapshot_->policy_table.module_config.certificate =
+ rpc::Optional<rpc::String<0, 65535> >();
+
+ /* consumer_friendly_messages are required for the snapshot;
+ * consumer_friendly_messages->version is required always, but
+ * consumer_friendly_messages->messages must be omitted in PTS */
+ if( snapshot_->policy_table.consumer_friendly_messages->is_initialized() ) {
+ snapshot_->policy_table.consumer_friendly_messages->messages =
+ rpc::Optional<policy_table::Messages>();
+ } else {
+ LOG4CXX_WARN(logger_, "policy_table.consumer_friendly_messages is not initialized");
+ }
+
+ /* policy_table.usage_and_error_counts are required for PTS and
+ * policy_table.usage_and_error_counts->app_level is optional */
+ rpc::Optional<policy_table::UsageAndErrorCounts>& usage_and_error_counts =
+ snapshot_->policy_table.usage_and_error_counts;
+
+ if (usage_and_error_counts->is_initialized() &&
+ usage_and_error_counts->app_level->is_initialized()) {
+ policy_table::AppLevels::iterator it =
+ usage_and_error_counts->app_level->begin();
+ policy_table::AppLevels::const_iterator it_end =
+ usage_and_error_counts->app_level->end();
+ for (;it != it_end; ++it) {
+ if (!(*it).second.minutes_in_hmi_full.is_initialized()) {
+ (*it).second.minutes_in_hmi_full = 0;
+ }
+
+ if (!(*it).second.app_registration_language_gui.is_initialized()) {
+ (*it).second.app_registration_language_gui = "unknown";
+ }
+
+ if (!(*it).second.app_registration_language_vui.is_initialized()) {
+ (*it).second.app_registration_language_vui = "unknown";
+ }
+
+ if (!(*it).second.minutes_in_hmi_limited.is_initialized()) {
+ (*it).second.minutes_in_hmi_limited = 0;
+ }
+
+ if (!(*it).second.minutes_in_hmi_background.is_initialized()) {
+ (*it).second.minutes_in_hmi_background = 0;
+ }
+
+ if (!(*it).second.minutes_in_hmi_none.is_initialized()) {
+ (*it).second.minutes_in_hmi_none = 0;
+ }
+
+ if (!(*it).second.count_of_user_selections.is_initialized()) {
+ (*it).second.count_of_user_selections = 0;
+ }
+
+ if (!(*it).second.count_of_rejections_sync_out_of_memory.is_initialized()) {
+ (*it).second.count_of_rejections_sync_out_of_memory = 0;
+ }
+
+ if (!(*it).second.count_of_rejections_nickname_mismatch.is_initialized()) {
+ (*it).second.count_of_rejections_nickname_mismatch = 0;
+ }
+
+ if (!(*it).second.count_of_rejections_duplicate_name.is_initialized()) {
+ (*it).second.count_of_rejections_duplicate_name = 0;
+ }
+
+ if (!(*it).second.count_of_rejected_rpc_calls.is_initialized()) {
+ (*it).second.count_of_rejected_rpc_calls = 0;
+ }
+
+ if (!(*it).second.count_of_rpcs_sent_in_hmi_none.is_initialized()) {
+ (*it).second.count_of_rpcs_sent_in_hmi_none = 0;
+ }
+
+ if (!(*it).second.count_of_removals_for_bad_behavior.is_initialized()) {
+ (*it).second.count_of_removals_for_bad_behavior = 0;
+ }
+
+ if (!(*it).second.count_of_run_attempts_while_revoked.is_initialized()) {
+ (*it).second.count_of_run_attempts_while_revoked = 0;
+ }
+ }
+ } else {
+ LOG4CXX_WARN(logger_, "usage_and_error_counts or app_level is not initialized");
+ }
}
void CacheManager::PersistData() {
@@ -723,7 +825,7 @@ void CacheManager::PersistData() {
}
void CacheManager::ResetCalculatedPermissions() {
- LOG4CXX_TRACE(logger_, "ResetCalculatedPermissions");
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(calculated_permissions_lock_);
calculated_permissions_.clear();
}
@@ -895,6 +997,48 @@ void CacheManager::Increment(usage_statistics::GlobalCounterId type) {
void CacheManager::Increment(const std::string &app_id,
usage_statistics::AppCounterId type) {
CACHE_MANAGER_CHECK_VOID();
+ sync_primitives::AutoLock lock (cache_lock_);
+ switch (type) {
+ case usage_statistics::USER_SELECTIONS:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_user_selections;
+ break;
+ case usage_statistics::REJECTIONS_SYNC_OUT_OF_MEMORY:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_rejections_sync_out_of_memory;
+ break;
+ case usage_statistics::REJECTIONS_NICKNAME_MISMATCH:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_rejections_nickname_mismatch;
+ break;
+ case usage_statistics::REJECTIONS_DUPLICATE_NAME:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_rejections_duplicate_name;
+ break;
+ case usage_statistics::REJECTED_RPC_CALLS:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_rejected_rpc_calls;
+ break;
+ case usage_statistics::RPCS_IN_HMI_NONE:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_rpcs_sent_in_hmi_none;
+ break;
+ case usage_statistics::REMOVALS_MISBEHAVED:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_removals_for_bad_behavior;
+ break;
+ case usage_statistics::RUN_ATTEMPTS_WHILE_REVOKED:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_run_attempts_while_revoked;
+ break;
+ case usage_statistics::COUNT_OF_TLS_ERRORS:
+ ++(*pt_->policy_table.usage_and_error_counts->app_level)[app_id].
+ count_of_tls_errors;
+ break;
+ default:
+ LOG4CXX_WARN(logger_, "Type app counter is unknown");
+ return;
+ }
Backup();
}
@@ -1042,11 +1186,24 @@ bool CacheManager::Init(const std::string& file_name) {
case InitResult::EXISTS: {
LOG4CXX_INFO(logger_, "Policy Table exists, was loaded correctly.");
result = LoadFromBackup();
+ if (result) {
+ if (!backup_->IsDBVersionActual()) {
+ LOG4CXX_INFO(logger_, "DB version is NOT actual");
+ if (!backup_->RefreshDB()) {
+ LOG4CXX_ERROR(logger_, "RefreshDB() failed");
+ return false;
+ }
+ backup_->UpdateDBVersion();
+ Backup();
+ }
+ MergePreloadPT(file_name);
+ }
} break;
case InitResult::SUCCESS: {
LOG4CXX_INFO(logger_, "Policy Table was inited successfully");
- result = LoadFromFile(file_name);
-
+
+ result = LoadFromFile(file_name, *pt_);
+
utils::SharedPtr<policy_table::Table> snapshot = GenerateSnapshot();
result &= snapshot->is_valid();
LOG4CXX_DEBUG(logger_, "Check if snapshot is valid: "
@@ -1054,8 +1211,11 @@ bool CacheManager::Init(const std::string& file_name) {
if(!result) {
rpc::ValidationReport report("policy_table");
snapshot->ReportErrors(&report);
+ return result;
}
+ backup_->UpdateDBVersion();
+ Backup();
} break;
default: {
result = false;
@@ -1079,7 +1239,8 @@ bool CacheManager::LoadFromBackup() {
return true;
}
-bool CacheManager::LoadFromFile(const std::string& file_name) {
+bool CacheManager::LoadFromFile(const std::string& file_name,
+ policy_table::Table& table) {
LOG4CXX_AUTO_TRACE(logger_);
BinaryMessage json_string;
if (!file_system::ReadBinaryFile(file_name, json_string)) {
@@ -1099,24 +1260,21 @@ bool CacheManager::LoadFromFile(const std::string& file_name) {
LOG4CXX_TRACE(logger_, "Start create PT");
sync_primitives::AutoLock locker(cache_lock_);
- backup_->Clear();
- pt_ = new policy_table::Table(&value);
- if (pt_->is_valid()) {
- if (backup_->Save(*pt_)) {
- backup_->WriteDb();
- return true;
- } else {
- LOG4CXX_FATAL(logger_, "Failed to save PT");
- return false;
- }
- } else {
+ table = policy_table::Table(&value);
+
+ Json::StyledWriter s_writer;
+ LOG4CXX_DEBUG(logger_, "PT out:");
+ LOG4CXX_DEBUG(logger_, s_writer.write(table.ToJsonValue()));
+
+ if (!table.is_valid()) {
rpc::ValidationReport report("policy_table");
- pt_->ReportErrors(&report);
+ table.ReportErrors(&report);
LOG4CXX_FATAL(logger_,
"Parsed table is not valid " << rpc::PrettyFormat(report));
return false;
}
+ return true;
}
bool CacheManager::ResetPT(const std::string& file_name) {
@@ -1172,6 +1330,96 @@ void CacheManager::GetAppRequestTypes(
return;
}
+std::string CacheManager::GetCertificate() const {
+ CACHE_MANAGER_CHECK(std::string(""));
+ if (pt_->policy_table.module_config.certificate.is_initialized()) {
+ return *pt_->policy_table.module_config.certificate;
+ }
+ return std::string("");
+}
+
+void CacheManager::MergePreloadPT(const std::string& file_name) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ policy_table::Table table;
+ if (!LoadFromFile(file_name, table)) {
+ LOG4CXX_DEBUG(logger_, "Unable to load preloaded PT.");
+ return;
+ }
+
+ sync_primitives::AutoLock lock(cache_lock_);
+ policy_table::PolicyTable& current = pt_->policy_table;
+ policy_table::PolicyTable& new_table = table.policy_table;
+ const std::string date_current = *current.module_config.preloaded_date;
+ const std::string date_new = *new_table.module_config.preloaded_date;
+ if (date_current != date_new) {
+ MergeMC(new_table, current);
+ MergeFG(new_table, current);
+ MergeAP(new_table, current);
+ MergeCFM(new_table, current);
+ Backup();
+ }
+}
+
+void CacheManager::MergeMC(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ policy_table::ModuleConfig copy(pt.module_config);
+
+ pt.module_config = new_pt.module_config;
+ pt.module_config.vehicle_make = copy.vehicle_make;
+ pt.module_config.vehicle_year = copy.vehicle_year;
+ pt.module_config.vehicle_model = copy.vehicle_model;
+}
+
+void CacheManager::MergeFG(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ policy_table::FunctionalGroupings::const_iterator it = new_pt.functional_groupings.begin();
+
+ for (; it != new_pt.functional_groupings.end(); ++it) {
+ LOG4CXX_DEBUG(logger_, "Merge functional group: " << it->first);
+ pt.functional_groupings[it->first] = it->second;
+ }
+}
+
+void CacheManager::MergeAP(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ pt.app_policies_section.device = const_cast<policy_table::PolicyTable&>
+ (new_pt).app_policies_section.device;
+
+ pt.app_policies_section.apps[kDefaultId] =
+ const_cast<policy_table::PolicyTable&>
+ (new_pt).app_policies_section.apps[kDefaultId];
+
+ pt.app_policies_section.apps[kPreDataConsentId] =
+ const_cast<policy_table::PolicyTable&>
+ (new_pt).app_policies_section.apps[kPreDataConsentId];
+}
+
+void CacheManager::MergeCFM(const policy_table::PolicyTable& new_pt,
+ policy_table::PolicyTable& pt) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (new_pt.consumer_friendly_messages.is_initialized()) {
+ if (!pt.consumer_friendly_messages.is_initialized()) {
+ pt.consumer_friendly_messages = new_pt.consumer_friendly_messages;
+ } else {
+ policy_table::Messages::const_iterator it = new_pt.consumer_friendly_messages->messages->begin();
+
+ pt.consumer_friendly_messages->version =
+ new_pt.consumer_friendly_messages->version;
+ for (; it != new_pt.consumer_friendly_messages->messages->end(); ++it) {
+ LOG4CXX_DEBUG(logger_, "Merge CFM: " << it->first);
+ if (!(pt.consumer_friendly_messages->messages.is_initialized())) {
+ LOG4CXX_DEBUG(logger_, "CFM not initialized.");
+ }
+ (*pt.consumer_friendly_messages->messages)[it->first] = it->second;
+ }
+
+ }
+ }
+}
+
CacheManager::BackgroundBackuper::BackgroundBackuper(CacheManager* cache_manager)
: cache_manager_(cache_manager),
stop_flag_(false),
diff --git a/src/components/policy/src/policy/src/policy_helper.cc b/src/components/policy/src/policy/src/policy_helper.cc
index 5a32f6f5ff..b72a041a83 100644
--- a/src/components/policy/src/policy/src/policy_helper.cc
+++ b/src/components/policy/src/policy/src/policy_helper.cc
@@ -34,14 +34,17 @@
#include <sstream>
#include <string.h>
#include "utils/logger.h"
+#include "utils/custom_string.h"
#include "policy/policy_helper.h"
#include "policy/policy_manager_impl.h"
namespace policy {
+namespace custom_str = utils::custom_string;
+
namespace {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
bool Compare(const StringsValueType& first, const StringsValueType& second) {
const std::string& first_str = first;
@@ -50,53 +53,48 @@ bool Compare(const StringsValueType& first, const StringsValueType& second) {
}
struct CheckGroupName {
- CheckGroupName(const policy::StringsValueType& value)
- : value_(value) {
- }
+ CheckGroupName(const policy::StringsValueType& value) : value_(value) {}
bool operator()(const FunctionalGroupNames::value_type& value) {
return value.second.second == std::string(value_);
}
-private:
+ private:
const policy::StringsValueType& value_;
};
-struct CopyAttributes{
+struct CopyAttributes {
CopyAttributes(const FunctionalGroupNames& groups_attributes,
- std::vector<FunctionalGroupPermission>& groups_permissions)
- : groups_attributes_(groups_attributes),
- groups_permissions_(groups_permissions) {
- }
-
-bool operator()(const policy::StringsValueType& value) {
- CheckGroupName checker(value);
- FunctionalGroupNames::const_iterator it =
- std::find_if(groups_attributes_.begin(), groups_attributes_.end(),
- checker);
- if (groups_attributes_.end() == it) {
- return false;
+ std::vector<FunctionalGroupPermission>& groups_permissions)
+ : groups_attributes_(groups_attributes)
+ , groups_permissions_(groups_permissions) {}
+
+ bool operator()(const policy::StringsValueType& value) {
+ CheckGroupName checker(value);
+ FunctionalGroupNames::const_iterator it = std::find_if(
+ groups_attributes_.begin(), groups_attributes_.end(), checker);
+ if (groups_attributes_.end() == it) {
+ return false;
+ }
+ FunctionalGroupPermission group;
+ group.group_name = it->second.second;
+ group.group_alias = it->second.first;
+ group.group_id = it->first;
+ groups_permissions_.push_back(group);
+ return true;
}
- FunctionalGroupPermission group;
- group.group_name = it->second.second;
- group.group_alias = it->second.first;
- group.group_id = it->first;
- groups_permissions_.push_back(group);
- return true;
-}
-private:
+ private:
const FunctionalGroupNames& groups_attributes_;
std::vector<FunctionalGroupPermission>& groups_permissions_;
};
-} // namespace
+} // namespace
CompareGroupName::CompareGroupName(const StringsValueType& group_name)
- : group_name_(group_name) {
-}
+ : group_name_(group_name) {}
bool CompareGroupName::operator()(
- const StringsValueType& group_name_to_compare) const {
+ const StringsValueType& group_name_to_compare) const {
const std::string gn_ = group_name_;
const std::string gn_compare = group_name_to_compare;
return !(strcasecmp(gn_.c_str(), gn_compare.c_str()));
@@ -125,10 +123,7 @@ CheckAppPolicy::CheckAppPolicy(
PolicyManagerImpl* pm,
const utils::SharedPtr<policy_table::Table> update,
const utils::SharedPtr<policy_table::Table> snapshot)
- : pm_(pm),
- update_(update),
- snapshot_(snapshot) {
-}
+ : pm_(pm), update_(update), snapshot_(snapshot) {}
bool policy::CheckAppPolicy::HasRevokedGroups(
const policy::AppPoliciesValueType& app_policy,
@@ -149,13 +144,16 @@ bool policy::CheckAppPolicy::HasRevokedGroups(
StringsConstItr it_groups_curr_end = groups_curr.end();
policy_table::Strings revoked_group_list;
- std::set_difference(it_groups_curr, it_groups_curr_end,
- it_groups_new, it_groups_new_end,
- std::back_inserter(revoked_group_list), Compare);
+ std::set_difference(it_groups_curr,
+ it_groups_curr_end,
+ it_groups_new,
+ it_groups_new_end,
+ std::back_inserter(revoked_group_list),
+ Compare);
// Remove groups which are not required user consent
policy_table::Strings::iterator it_revoked = revoked_group_list.begin();
- for (;revoked_group_list.end() != it_revoked; ) {
+ for (; revoked_group_list.end() != it_revoked;) {
if (!IsConsentRequired(app_policy.first, std::string(*it_revoked))) {
revoked_group_list.erase(it_revoked);
it_revoked = revoked_group_list.begin();
@@ -190,9 +188,12 @@ bool policy::CheckAppPolicy::HasNewGroups(
StringsConstItr it_groups_curr_end = groups_curr.end();
policy_table::Strings new_group_list;
- std::set_difference(it_groups_new, it_groups_new_end,
- it_groups_curr, it_groups_curr_end,
- std::back_inserter(new_group_list), Compare);
+ std::set_difference(it_groups_new,
+ it_groups_new_end,
+ it_groups_curr,
+ it_groups_curr_end,
+ std::back_inserter(new_group_list),
+ Compare);
if (new_groups) {
*new_groups = new_group_list;
@@ -219,8 +220,7 @@ bool policy::CheckAppPolicy::HasConsentNeededGroups(
return false;
}
-std::vector<FunctionalGroupPermission>
-policy::CheckAppPolicy::GetRevokedGroups(
+std::vector<FunctionalGroupPermission> policy::CheckAppPolicy::GetRevokedGroups(
const policy::AppPoliciesValueType& app_policy) const {
policy_table::Strings revoked_groups_names;
if (!HasRevokedGroups(app_policy, &revoked_groups_names)) {
@@ -235,8 +235,8 @@ policy::CheckAppPolicy::GetRevokedGroups(
std::vector<FunctionalGroupPermission> revoked_groups_permissions;
CopyAttributes copier(groups_attributes, revoked_groups_permissions);
- std::for_each(revoked_groups_names.begin(), revoked_groups_names.end(),
- copier);
+ std::for_each(
+ revoked_groups_names.begin(), revoked_groups_names.end(), copier);
return revoked_groups_permissions;
}
@@ -248,7 +248,7 @@ void policy::CheckAppPolicy::RemoveRevokedConsents(
revoked_groups.begin();
std::vector<policy::FunctionalGroupPermission>::const_iterator it_end =
revoked_groups.end();
- for (;it != it_end; ++it) {
+ for (; it != it_end; ++it) {
pm_->RemoveAppConsentForGroup(app_policy.first, it->group_name);
}
}
@@ -267,13 +267,13 @@ void policy::CheckAppPolicy::NotifySystem(
}
void CheckAppPolicy::SendPermissionsToApp(
- const AppPoliciesValueType& app_policy) const {
+ const AppPoliciesValueType& app_policy) const {
const std::string app_id = app_policy.first;
const std::string device_id = pm_->GetCurrentDeviceId(app_id);
if (device_id.empty()) {
- LOG4CXX_WARN(logger_, "Couldn't find device info for application id: "
- << app_id);
+ LOG4CXX_WARN(logger_,
+ "Couldn't find device info for application id: " << app_id);
return;
}
std::vector<FunctionalGroupPermission> group_permissons;
@@ -282,7 +282,8 @@ void CheckAppPolicy::SendPermissionsToApp(
Permissions notification_data;
pm_->PrepareNotificationData(update_->policy_table.functional_groupings,
app_policy.second.groups,
- group_permissons, notification_data);
+ group_permissons,
+ notification_data);
LOG4CXX_INFO(logger_, "Send notification for application_id: " << app_id);
// Default_hmi is Ford-specific and should not be used with basic policy
@@ -291,7 +292,7 @@ void CheckAppPolicy::SendPermissionsToApp(
}
bool CheckAppPolicy::IsAppRevoked(
- const AppPoliciesValueType& app_policy) const {
+ const AppPoliciesValueType& app_policy) const {
LOG4CXX_AUTO_TRACE(logger_);
// Application params are not initialized = application revoked
// i.e. "123":null
@@ -301,15 +302,15 @@ bool CheckAppPolicy::IsAppRevoked(
bool CheckAppPolicy::NicknamesMatch(
const AppPoliciesValueType& app_policy) const {
const std::string& app_id = app_policy.first;
- std::string app_name = pm_->listener()->GetAppName(app_id);
- if (!app_name.empty() &&
- app_policy.second.nicknames &&
+ const custom_str::CustomString app_name = pm_->listener()->GetAppName(app_id);
+ if (!app_name.empty() && app_policy.second.nicknames &&
!app_policy.second.nicknames->empty()) {
for (policy_table::Strings::const_iterator it =
- app_policy.second.nicknames->begin();
- app_policy.second.nicknames->end() != it; ++it) {
+ app_policy.second.nicknames->begin();
+ app_policy.second.nicknames->end() != it;
+ ++it) {
std::string temp = *it;
- if (!strcasecmp(temp.c_str(), app_name.c_str())) {
+ if (app_name.CompareIgnoreCase(temp.c_str())) {
return true;
}
}
@@ -322,8 +323,8 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
const std::string app_id = app_policy.first;
if (!IsKnownAppication(app_id)) {
- LOG4CXX_WARN(logger_, "Application:" << app_id <<
- " is not present in snapshot.");
+ LOG4CXX_WARN(logger_,
+ "Application:" << app_id << " is not present in snapshot.");
return true;
}
@@ -345,13 +346,15 @@ bool CheckAppPolicy::operator()(const AppPoliciesValueType& app_policy) {
NotifySystem(app_policy);
}
if (RESULT_NO_CHANGES == result) {
- LOG4CXX_INFO(logger_, "Permissions for application:" << app_id <<
- " wasn't changed.");
+ LOG4CXX_INFO(logger_,
+ "Permissions for application:" << app_id
+ << " wasn't changed.");
return true;
}
- LOG4CXX_INFO(logger_, "Permissions for application:" << app_id <<
- " have been changed.");
+ LOG4CXX_INFO(logger_,
+ "Permissions for application:" << app_id
+ << " have been changed.");
if (!IsPredefinedApp(app_policy) && RESULT_CONSENT_NOT_REQIURED != result) {
SetPendingPermissions(app_policy, result);
@@ -370,46 +373,47 @@ void policy::CheckAppPolicy::SetPendingPermissions(
PermissionsCheckResult result) const {
const std::string app_id = app_policy.first;
AppPermissions permissions_diff(app_id);
- permissions_diff.priority = policy_table::EnumToJsonString(
- app_policy.second.priority);
+ permissions_diff.priority =
+ policy_table::EnumToJsonString(app_policy.second.priority);
switch (result) {
- case RESULT_APP_REVOKED:
- permissions_diff.appRevoked = true;
- break;
- case RESULT_NICKNAME_MISMATCH:
- permissions_diff.appUnauthorized = true;
- break;
- case RESULT_PERMISSIONS_REVOKED:
- permissions_diff.isAppPermissionsRevoked = true;
- permissions_diff.appRevokedPermissions = GetRevokedGroups(app_policy);
- RemoveRevokedConsents(app_policy, permissions_diff.appRevokedPermissions);
- break;
- case RESULT_CONSENT_NEEDED:
- permissions_diff.appPermissionsConsentNeeded = true;
- break;
- case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED:
- permissions_diff.isAppPermissionsRevoked = true;
- permissions_diff.appPermissionsConsentNeeded = true;
- permissions_diff.appRevokedPermissions = GetRevokedGroups(app_policy);
- RemoveRevokedConsents(app_policy, permissions_diff.appRevokedPermissions);
- break;
- case RESULT_REQUEST_TYPE_CHANGED:
- permissions_diff.priority.clear();
- permissions_diff.requestTypeChanged = true;
- {
- // Getting RequestTypes from PTU (not from cache)
- policy_table::RequestTypes::const_iterator it_request_type =
- app_policy.second.RequestType->begin();
- for (; app_policy.second.RequestType->end() != it_request_type;
- ++it_request_type) {
- permissions_diff.requestType.push_back(EnumToJsonString(*it_request_type));
- }
- }
+ case RESULT_APP_REVOKED:
+ permissions_diff.appRevoked = true;
+ break;
+ case RESULT_NICKNAME_MISMATCH:
+ permissions_diff.appUnauthorized = true;
+ break;
+ case RESULT_PERMISSIONS_REVOKED:
+ permissions_diff.isAppPermissionsRevoked = true;
+ permissions_diff.appRevokedPermissions = GetRevokedGroups(app_policy);
+ RemoveRevokedConsents(app_policy, permissions_diff.appRevokedPermissions);
+ break;
+ case RESULT_CONSENT_NEEDED:
+ permissions_diff.appPermissionsConsentNeeded = true;
+ break;
+ case RESULT_PERMISSIONS_REVOKED_AND_CONSENT_NEEDED:
+ permissions_diff.isAppPermissionsRevoked = true;
+ permissions_diff.appPermissionsConsentNeeded = true;
+ permissions_diff.appRevokedPermissions = GetRevokedGroups(app_policy);
+ RemoveRevokedConsents(app_policy, permissions_diff.appRevokedPermissions);
+ break;
+ case RESULT_REQUEST_TYPE_CHANGED:
+ permissions_diff.priority.clear();
+ permissions_diff.requestTypeChanged = true;
+ {
+ // Getting RequestTypes from PTU (not from cache)
+ policy_table::RequestTypes::const_iterator it_request_type =
+ app_policy.second.RequestType->begin();
+ for (; app_policy.second.RequestType->end() != it_request_type;
+ ++it_request_type) {
+ permissions_diff.requestType.push_back(
+ EnumToJsonString(*it_request_type));
+ }
+ }
- break;
- default:
- return;
+ break;
+ default:
+ return;
}
pm_->app_permissions_diff_lock_.Acquire();
pm_->app_permissions_diff_.insert(std::make_pair(app_id, permissions_diff));
@@ -419,7 +423,6 @@ void policy::CheckAppPolicy::SetPendingPermissions(
policy::CheckAppPolicy::PermissionsCheckResult
policy::CheckAppPolicy::CheckPermissionsChanges(
const policy::AppPoliciesValueType& app_policy) const {
-
bool has_revoked_groups = HasRevokedGroups(app_policy);
bool has_consent_needed_groups = HasConsentNeededGroups(app_policy);
@@ -477,8 +480,9 @@ bool CheckAppPolicy::IsRequestTypeChanged(
}
FillNotificationData::FillNotificationData(Permissions& data,
- GroupConsent group_state, GroupConsent undefined_group_consent)
- : data_(data) {
+ GroupConsent group_state,
+ GroupConsent undefined_group_consent)
+ : data_(data) {
switch (group_state) {
case kGroupAllowed:
current_key_ = kAllowedKey;
@@ -488,9 +492,9 @@ FillNotificationData::FillNotificationData(Permissions& data,
current_key_ = kUndefinedKey;
break;
}
- current_key_ = kGroupAllowed == undefined_group_consent?
- kAllowedKey:
- kUserDisallowedKey;
+ current_key_ = kGroupAllowed == undefined_group_consent
+ ? kAllowedKey
+ : kUserDisallowedKey;
break;
default:
current_key_ = kUserDisallowedKey;
@@ -524,7 +528,7 @@ bool FillNotificationData::operator()(const RpcValueType& rpc) {
}
void FillNotificationData::UpdateHMILevels(
- const policy_table::HmiLevels& in_hmi, std::set<HMILevel>& out_hmi) {
+ const policy_table::HmiLevels& in_hmi, std::set<HMILevel>& out_hmi) {
HMILevelsConstItr it_hmi_levels = in_hmi.begin();
HMILevelsConstItr it_hmi_levels_end = in_hmi.end();
@@ -534,8 +538,8 @@ void FillNotificationData::UpdateHMILevels(
}
void FillNotificationData::UpdateParameters(
- const policy_table::Parameters& in_parameters,
- std::set<Parameter>& out_parameter) {
+ const policy_table::Parameters& in_parameters,
+ std::set<Parameter>& out_parameter) {
ParametersConstItr it_parameters = in_parameters.begin();
ParametersConstItr it_parameters_end = in_parameters.end();
@@ -558,7 +562,7 @@ void FillNotificationData::ExcludeSame() {
(*it).second.hmi_permissions.find(kUserDisallowedKey);
ParameterPermissions& rpc_parameter_permissions =
- (*it).second.parameter_permissions;
+ (*it).second.parameter_permissions;
ParameterPermissions::const_iterator it_parameter_allowed =
(*it).second.parameter_permissions.find(kAllowedKey);
ParameterPermissions::const_iterator it_parameter_undefined =
@@ -570,11 +574,11 @@ void FillNotificationData::ExcludeSame() {
if (rpc_hmi_permissions.end() != it_hmi_user_disallowed) {
if (rpc_hmi_permissions.end() != it_hmi_allowed) {
ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey],
- rpc_hmi_permissions[kUserDisallowedKey]);
+ rpc_hmi_permissions[kUserDisallowedKey]);
}
if (rpc_hmi_permissions.end() != it_hmi_undefined) {
ExcludeSameHMILevels(rpc_hmi_permissions[kUndefinedKey],
- rpc_hmi_permissions[kUserDisallowedKey]);
+ rpc_hmi_permissions[kUserDisallowedKey]);
}
}
@@ -593,7 +597,7 @@ void FillNotificationData::ExcludeSame() {
if (rpc_hmi_permissions.end() != it_hmi_undefined) {
if (rpc_hmi_permissions.end() != it_hmi_allowed) {
ExcludeSameHMILevels(rpc_hmi_permissions[kAllowedKey],
- rpc_hmi_permissions[kUndefinedKey]);
+ rpc_hmi_permissions[kUndefinedKey]);
}
}
@@ -607,24 +611,26 @@ void FillNotificationData::ExcludeSame() {
}
void FillNotificationData::ExcludeSameHMILevels(
- std::set<HMILevel>& source,
- const std::set<HMILevel>& target) {
+ std::set<HMILevel>& source, const std::set<HMILevel>& target) {
std::set<HMILevel> diff_hmi;
- std::set_difference(source.begin(), source.end(),
- target.begin(), target.end(),
+ std::set_difference(source.begin(),
+ source.end(),
+ target.begin(),
+ target.end(),
std::inserter(diff_hmi, diff_hmi.begin()));
source = diff_hmi;
}
void FillNotificationData::ExcludeSameParameters(
- std::set<Parameter>& source,
- const std::set<Parameter>& target) {
+ std::set<Parameter>& source, const std::set<Parameter>& target) {
std::set<Parameter> diff_parameter;
- std::set_difference(source.begin(), source.end(),
- target.begin(), target.end(),
+ std::set_difference(source.begin(),
+ source.end(),
+ target.begin(),
+ target.end(),
std::inserter(diff_parameter, diff_parameter.begin()));
source = diff_parameter;
@@ -638,15 +644,14 @@ void FillNotificationData::InitRpcKeys(const std::string& rpc_name) {
}
ProcessFunctionalGroup::ProcessFunctionalGroup(
- const policy_table::FunctionalGroupings& fg,
- const std::vector<FunctionalGroupPermission>& group_permissions,
- Permissions& data,
- GroupConsent undefined_group_consent)
- : fg_(fg),
- group_permissions_(group_permissions),
- data_(data),
- undefined_group_consent_(undefined_group_consent) {
-}
+ const policy_table::FunctionalGroupings& fg,
+ const std::vector<FunctionalGroupPermission>& group_permissions,
+ Permissions& data,
+ GroupConsent undefined_group_consent)
+ : fg_(fg)
+ , group_permissions_(group_permissions)
+ , data_(data)
+ , undefined_group_consent_(undefined_group_consent) {}
bool ProcessFunctionalGroup::operator()(const StringsValueType& group_name) {
const std::string group_name_str = group_name;
@@ -654,19 +659,19 @@ bool ProcessFunctionalGroup::operator()(const StringsValueType& group_name) {
if (fg_.end() != it) {
const policy_table::Rpc& rpcs = (*it).second.rpcs;
- FillNotificationData filler(data_, GetGroupState(group_name_str),
- undefined_group_consent_);
+ FillNotificationData filler(
+ data_, GetGroupState(group_name_str), undefined_group_consent_);
std::for_each(rpcs.begin(), rpcs.end(), filler);
}
return true;
}
GroupConsent ProcessFunctionalGroup::GetGroupState(
- const std::string& group_name) {
+ const std::string& group_name) {
std::vector<FunctionalGroupPermission>::const_iterator it =
- group_permissions_.begin();
+ group_permissions_.begin();
std::vector<FunctionalGroupPermission>::const_iterator it_end =
- group_permissions_.end();
+ group_permissions_.end();
for (; it != it_end; ++it) {
if (group_name == (*it).group_name) {
return (*it).state;
@@ -676,15 +681,13 @@ GroupConsent ProcessFunctionalGroup::GetGroupState(
}
FunctionalGroupInserter::FunctionalGroupInserter(
- const policy_table::Strings& preconsented_groups, PermissionsList& list)
- : list_(list),
- preconsented_(preconsented_groups) {
-}
+ const policy_table::Strings& preconsented_groups, PermissionsList& list)
+ : list_(list), preconsented_(preconsented_groups) {}
void FunctionalGroupInserter::operator()(const StringsValueType& group_name) {
CompareGroupName name(group_name);
- if (std::find_if(preconsented_.begin(), preconsented_.end(), name)
- == preconsented_.end()) {
+ if (std::find_if(preconsented_.begin(), preconsented_.end(), name) ==
+ preconsented_.end()) {
list_.push_back(group_name);
}
}
@@ -694,7 +697,7 @@ void FillFunctionalGroupPermissions(
FunctionalGroupNames& names,
GroupConsent state,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions" );
+ LOG4CXX_INFO(logger_, "FillFunctionalGroupPermissions");
FunctionalGroupIDs::const_iterator it = ids.begin();
FunctionalGroupIDs::const_iterator it_end = ids.end();
for (; it != it_end; ++it) {
@@ -714,7 +717,7 @@ bool IsPredefinedApp(const AppPoliciesValueType& app) {
FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
const FunctionalGroupIDs& what) {
- LOG4CXX_INFO(logger_, "Exclude same groups" );
+ LOG4CXX_INFO(logger_, "Exclude same groups");
FunctionalGroupIDs from_copy(from);
FunctionalGroupIDs what_copy(what);
@@ -722,8 +725,10 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
std::sort(what_copy.begin(), what_copy.end());
FunctionalGroupIDs no_same;
- std::set_difference(from_copy.begin(), from_copy.end(),
- what_copy.begin(),what_copy.end(),
+ std::set_difference(from_copy.begin(),
+ from_copy.end(),
+ what_copy.begin(),
+ what_copy.end(),
std::back_inserter(no_same));
no_same.resize(std::distance(no_same.begin(),
@@ -734,7 +739,7 @@ FunctionalGroupIDs ExcludeSame(const FunctionalGroupIDs& from,
FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
const FunctionalGroupIDs& second) {
- LOG4CXX_INFO(logger_, "Merge groups" );
+ LOG4CXX_INFO(logger_, "Merge groups");
FunctionalGroupIDs first_copy(first);
FunctionalGroupIDs second_copy(second);
@@ -742,12 +747,14 @@ FunctionalGroupIDs Merge(const FunctionalGroupIDs& first,
std::sort(second_copy.begin(), second_copy.end());
FunctionalGroupIDs merged;
- std::set_union(first_copy.begin(), first_copy.end(),
- second_copy.begin(), second_copy.end(),
+ std::set_union(first_copy.begin(),
+ first_copy.end(),
+ second_copy.begin(),
+ second_copy.end(),
std::back_inserter(merged));
- merged.resize(std::distance(merged.begin(),
- std::unique(merged.begin(), merged.end())));
+ merged.resize(
+ std::distance(merged.begin(), std::unique(merged.begin(), merged.end())));
return merged;
}
@@ -762,20 +769,22 @@ FunctionalGroupIDs FindSame(const FunctionalGroupIDs& first,
std::sort(second_copy.begin(), second_copy.end());
FunctionalGroupIDs same;
- std::set_intersection(first_copy.begin(), first_copy.end(),
- second_copy.begin(), second_copy.end(),
+ std::set_intersection(first_copy.begin(),
+ first_copy.end(),
+ second_copy.begin(),
+ second_copy.end(),
std::back_inserter(same));
- same.resize(std::distance(same.begin(),
- std::unique(same.begin(), same.end())));
+ same.resize(
+ std::distance(same.begin(), std::unique(same.begin(), same.end())));
return same;
}
bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) {
policy_table::ApplicationPolicies::iterator it = app_policies.begin();
- policy_table::ApplicationPolicies::iterator it_default = app_policies.
- find(kDefaultId);
+ policy_table::ApplicationPolicies::iterator it_default =
+ app_policies.find(kDefaultId);
for (; app_policies.end() != it; ++it) {
// Set default policies for app, if there is record like "123":"default"
if (kDefaultId.compare((*it).second.get_string()) == 0) {
@@ -783,7 +792,8 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) {
(*it).second = (*it_default).second;
it->second.set_to_string(kDefaultId);
} else {
- LOG4CXX_ERROR(logger_, "There is no default application policy was "
+ LOG4CXX_ERROR(logger_,
+ "There is no default application policy was "
"found in PTU.");
return false;
}
@@ -792,5 +802,4 @@ bool UnwrapAppPolicies(policy_table::ApplicationPolicies& app_policies) {
return true;
}
-
}
diff --git a/src/components/policy/src/policy/src/policy_manager_impl.cc b/src/components/policy/src/policy/src/policy_manager_impl.cc
index 4cfab15060..8cc8870a31 100644
--- a/src/components/policy/src/policy/src/policy_manager_impl.cc
+++ b/src/components/policy/src/policy/src/policy_manager_impl.cc
@@ -1,5 +1,5 @@
/*
- Copyright (c) 2013, Ford Motor Company
+ Copyright (c) 2016, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -35,6 +35,7 @@
#include <set>
#include <queue>
#include <iterator>
+#include <limits>
#include "json/reader.h"
#include "json/writer.h"
#include "policy/policy_table.h"
@@ -43,26 +44,34 @@
#include "utils/file_system.h"
#include "utils/logger.h"
#include "utils/date_time.h"
+#include "utils/make_shared.h"
#include "policy/cache_manager.h"
#include "policy/update_status_manager.h"
#include "config_profile/profile.h"
+#include "utils/timer_task_impl.h"
policy::PolicyManager* CreateManager() {
return new policy::PolicyManagerImpl();
}
+namespace {
+const uint32_t kDefaultRetryTimeoutInSec = 60u;
+} // namespace
+
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyManagerImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
PolicyManagerImpl::PolicyManagerImpl()
- : PolicyManager(),
- listener_(NULL),
- cache_(new CacheManager),
- retry_sequence_timeout_(60),
- retry_sequence_index_(0),
- ignition_check(true) {
-}
+ : PolicyManager()
+ , listener_(NULL)
+ , cache_(new CacheManager)
+ , retry_sequence_timeout_(kDefaultRetryTimeoutInSec)
+ , retry_sequence_index_(0)
+ , timer_retry_sequence_("Retry sequence timer",
+ new timer::TimerTaskImpl<PolicyManagerImpl>(
+ this, &PolicyManagerImpl::RetrySequence))
+ , ignition_check(true) {}
void PolicyManagerImpl::set_listener(PolicyListener* listener) {
listener_ = listener;
@@ -80,7 +89,7 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::Parse(
return new policy_table::Table(&value);
} else {
return utils::SharedPtr<policy_table::Table>();
- }
+ }
}
#else
@@ -94,7 +103,7 @@ utils::SharedPtr<policy_table::Table> PolicyManagerImpl::ParseArray(
//For PT Update received from SDL Server.
if (value["data"].size()!=0) {
Json::Value data = value["data"];
- //First Element in
+ //First Element in
return new policy_table::Table(&data[0]);
} else {
return new policy_table::Table(&value);
@@ -131,9 +140,9 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
// Parse message into table struct
utils::SharedPtr<policy_table::Table> pt_update = Parse(pt_content);
#else
- //Message Received from server unecnrypted with PTU in first element
+ //Message Received from server unecnrypted with PTU in first element
//of 'data' array. No Parsing was done by HMI.
- utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content);
+ utils::SharedPtr<policy_table::Table> pt_update = ParseArray(pt_content);
#endif
if (!pt_update) {
LOG4CXX_WARN(logger_, "Parsed table pointer is 0.");
@@ -141,6 +150,7 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
return false;
}
+ file_system::DeleteFile(file);
if (!IsPTValid(pt_update, policy_table::PT_UPDATE)) {
update_status_manager_.OnWrongUpdateReceived();
@@ -150,43 +160,49 @@ bool PolicyManagerImpl::LoadPT(const std::string& file,
update_status_manager_.OnValidUpdateReceived();
cache_->SaveUpdateRequired(false);
- apps_registration_lock_.Acquire();
-
- // Get current DB data, since it could be updated during awaiting of PTU
- utils::SharedPtr<policy_table::Table> policy_table_snapshot =
- cache_->GenerateSnapshot();
- if (!policy_table_snapshot) {
- LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
- return false;
+ // Update finished, no need retry
+ if (timer_retry_sequence_.IsRunning()) {
+ LOG4CXX_INFO(logger_, "Stop retry sequence");
+ timer_retry_sequence_.Stop();
}
- // Checking of difference between PTU and current policy state
- // Must to be done before PTU applying since it is possible, that functional
- // groups, which had been present before are absent in PTU and will be
- // removed after update. So in case of revoked groups system has to know
- // names and ids of revoked groups before they will be removed.
- CheckPermissionsChanges(pt_update, policy_table_snapshot);
+ {
+ sync_primitives::AutoLock lock(apps_registration_lock_);
- // Replace current data with updated
- if (!cache_->ApplyUpdate(*pt_update)) {
- LOG4CXX_WARN(logger_, "Unsuccessful save of updated policy table.");
- return false;
- }
+ // Get current DB data, since it could be updated during awaiting of PTU
+ utils::SharedPtr<policy_table::Table> policy_table_snapshot =
+ cache_->GenerateSnapshot();
+ if (!policy_table_snapshot) {
+ LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
+ return false;
+ }
- if (pt_update->policy_table.module_config.certificate.is_initialized()) {
- listener_->OnCertificateUpdated(*(pt_update->policy_table.module_config.certificate));
- }
+ // Checking of difference between PTU and current policy state
+ // Must to be done before PTU applying since it is possible, that functional
+ // groups, which had been present before are absent in PTU and will be
+ // removed after update. So in case of revoked groups system has to know
+ // names and ids of revoked groups before they will be removed.
+ CheckPermissionsChanges(pt_update, policy_table_snapshot);
+
+ // Replace current data with updated
+ if (!cache_->ApplyUpdate(*pt_update)) {
+ LOG4CXX_WARN(logger_, "Unsuccessful save of updated policy table.");
+ return false;
+ }
- std::map<std::string, StringArray> app_hmi_types;
- cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
- if (!app_hmi_types.empty()) {
- LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
- listener_->OnUpdateHMIAppType(app_hmi_types);
- } else {
- LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
- }
+ if (pt_update->policy_table.module_config.certificate.is_initialized()) {
+ listener_->OnCertificateUpdated(*(pt_update->policy_table.module_config.certificate));
+ }
- apps_registration_lock_.Release();
+ std::map<std::string, StringArray> app_hmi_types;
+ cache_->GetHMIAppTypeAfterUpdate(app_hmi_types);
+ if (!app_hmi_types.empty()) {
+ LOG4CXX_INFO(logger_, "app_hmi_types is full calling OnUpdateHMIAppType");
+ listener_->OnUpdateHMIAppType(app_hmi_types);
+ } else {
+ LOG4CXX_INFO(logger_, "app_hmi_types empty" << pt_content.size());
+ }
+ }
// If there was a user request for policy table update, it should be started
// right after current update is finished
@@ -230,13 +246,13 @@ void PolicyManagerImpl::GetServiceUrls(const std::string& service_type,
cache_->GetServiceUrls(service_type, end_points);
}
-void PolicyManagerImpl::RequestPTUpdate() {
+bool PolicyManagerImpl::RequestPTUpdate() {
LOG4CXX_AUTO_TRACE(logger_);
utils::SharedPtr<policy_table::Table> policy_table_snapshot =
cache_->GenerateSnapshot();
if (!policy_table_snapshot) {
LOG4CXX_ERROR(logger_, "Failed to create snapshot of policy table");
- return;
+ return false;
}
IsPTValid(policy_table_snapshot, policy_table::PT_SNAPSHOT);
@@ -249,14 +265,13 @@ void PolicyManagerImpl::RequestPTUpdate() {
BinaryMessage update(message_string.begin(), message_string.end());
-
- listener_->OnSnapshotCreated(update,
- RetrySequenceDelaysSeconds(),
- TimeoutExchange());
+ listener_->OnSnapshotCreated(update);
// Need to reset update schedule since all currenly registered applications
// were already added to the snapshot so no update for them required.
update_status_manager_.ResetUpdateSchedule();
+
+ return true;
}
std::string PolicyManagerImpl::GetLockScreenIconUrl() const {
@@ -287,7 +302,10 @@ void PolicyManagerImpl::StartPTExchange() {
}
if (update_status_manager_.IsUpdateRequired()) {
- RequestPTUpdate();
+ if (RequestPTUpdate() && !timer_retry_sequence_.IsRunning()) {
+ // Start retry sequency
+ timer_retry_sequence_.Start(NextRetryTimeout(), true);
+ }
}
}
}
@@ -311,6 +329,11 @@ const std::vector<std::string> PolicyManagerImpl::GetAppRequestTypes(
cache_->GetAppRequestTypes(policy_app_id, request_types);
return request_types;
}
+
+const VehicleInfo PolicyManagerImpl::GetVehicleInfo() const {
+ return cache_->GetVehicleInfo();
+}
+
void PolicyManagerImpl::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
@@ -369,7 +392,7 @@ void PolicyManagerImpl::SendNotificationOnPermissionsUpdated(
}
bool PolicyManagerImpl::CleanupUnpairedDevices() {
- LOG4CXX_INFO(logger_, "CleanupUnpairedDevices");
+ LOG4CXX_AUTO_TRACE(logger_);
// For SDL-specific it doesn't matter
return true;
}
@@ -382,7 +405,7 @@ DeviceConsent PolicyManagerImpl::GetUserConsentForDevice(
void PolicyManagerImpl::SetUserConsentForDevice(const std::string& device_id,
bool is_allowed) {
- LOG4CXX_INFO(logger_, "SetUserConsentForDevice");
+ LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Device :" << device_id);
DeviceConsent current_consent = GetUserConsentForDevice(device_id);
bool is_current_device_allowed =
@@ -403,7 +426,7 @@ bool PolicyManagerImpl::ReactOnUserDevConsentForApp(const std::string app_id,
bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id,
StringArray* nicknames,
StringArray* app_hmi_types) {
- LOG4CXX_INFO(logger_, "GetInitialAppData");
+ LOG4CXX_AUTO_TRACE(logger_);
const bool result = nicknames && app_hmi_types;
if (result) {
cache_->GetInitialAppData(application_id, *nicknames, *app_hmi_types);
@@ -411,9 +434,15 @@ bool PolicyManagerImpl::GetInitialAppData(const std::string& application_id,
return result;
}
+void PolicyManagerImpl::AddDevice(const std::string& device_id,
+ const std::string& connection_type) {
+ LOG4CXX_INFO(logger_, "SetDeviceInfo");
+ LOG4CXX_DEBUG(logger_, "Device :" << device_id);
+}
+
void PolicyManagerImpl::SetDeviceInfo(const std::string& device_id,
const DeviceInfo& device_info) {
- LOG4CXX_INFO(logger_, "SetDeviceInfo");
+ LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_, "Device :" << device_id);
}
@@ -454,7 +483,7 @@ PermissionConsent PolicyManagerImpl::EnsureCorrectPermissionConsent(
void PolicyManagerImpl::CheckPendingPermissionsChanges(
const std::string& policy_app_id,
const std::vector<FunctionalGroupPermission>& current_permissions) {
- LOG4CXX_INFO(logger_, "CheckPendingPermissionsChanges");
+ LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(app_permissions_diff_lock_);
std::map<std::string, AppPermissions>::iterator it_pending =
app_permissions_diff_.find(policy_app_id);
@@ -495,18 +524,23 @@ void PolicyManagerImpl::CheckPendingPermissionsChanges(
void PolicyManagerImpl::SetUserConsentForApp(
const PermissionConsent& permissions) {
- LOG4CXX_INFO(logger_, "SetUserConsentForApp");
+ LOG4CXX_AUTO_TRACE(logger_);
}
bool PolicyManagerImpl::GetDefaultHmi(const std::string& policy_app_id,
std::string* default_hmi) {
- LOG4CXX_INFO(logger_, "GetDefaultHmi");
- return false;
+ LOG4CXX_AUTO_TRACE(logger_);
+ const std::string device_id = GetCurrentDeviceId(policy_app_id);
+ DeviceConsent device_consent = GetUserConsentForDevice(device_id);
+ const std::string app_id =
+ policy::kDeviceAllowed != device_consent ? kPreDataConsentId :
+ policy_app_id;
+ return cache_->GetDefaultHMI(app_id, *default_hmi);
}
bool PolicyManagerImpl::GetPriority(const std::string& policy_app_id,
std::string* priority) {
- LOG4CXX_INFO(logger_, "GetPriority");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!priority) {
LOG4CXX_WARN(logger_, "Input priority parameter is null.");
return false;
@@ -523,7 +557,7 @@ std::vector<UserFriendlyMessage> PolicyManagerImpl::GetUserFriendlyMessages(
void PolicyManagerImpl::GetUserConsentForApp(
const std::string& device_id, const std::string& policy_app_id,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_INFO(logger_, "GetUserConsentForApp");
+ LOG4CXX_AUTO_TRACE(logger_);
FunctionalIdType group_types;
if (!cache_->GetPermissionsForApp(device_id, policy_app_id,
@@ -571,7 +605,7 @@ void PolicyManagerImpl::GetUserConsentForApp(
void PolicyManagerImpl::GetPermissionsForApp(
const std::string& device_id, const std::string& policy_app_id,
std::vector<FunctionalGroupPermission>& permissions) {
- LOG4CXX_INFO(logger_, "GetPermissionsForApp");
+ LOG4CXX_AUTO_TRACE(logger_);
std::string app_id_to_check = policy_app_id;
bool allowed_by_default = false;
@@ -639,7 +673,7 @@ void PolicyManagerImpl::SetSystemLanguage(const std::string& language) {
void PolicyManagerImpl::SetSystemInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
- LOG4CXX_INFO(logger_, "SetSystemInfo");
+ LOG4CXX_AUTO_TRACE(logger_);
}
void PolicyManagerImpl::OnSystemReady() {
@@ -652,7 +686,7 @@ void PolicyManagerImpl::OnSystemReady() {
uint32_t PolicyManagerImpl::GetNotificationsNumber(
const std::string& priority) {
- LOG4CXX_INFO(logger_, "GetNotificationsNumber");
+ LOG4CXX_AUTO_TRACE(logger_);
return cache_->GetNotificationsNumber(priority);
}
@@ -689,6 +723,7 @@ void PolicyManagerImpl::KmsChanged(int kilometers) {
LOG4CXX_AUTO_TRACE(logger_);
if (0 == cache_->KilometersBeforeExchange(kilometers)) {
LOG4CXX_INFO(logger_, "Enough kilometers passed to send for PT update.");
+ update_status_manager_.ScheduleUpdate();
StartPTExchange();
}
}
@@ -707,16 +742,25 @@ std::string PolicyManagerImpl::GetPolicyTableStatus() const {
return update_status_manager_.StringifiedUpdateStatus();
}
-int PolicyManagerImpl::NextRetryTimeout() {
+uint32_t PolicyManagerImpl::NextRetryTimeout() {
sync_primitives::AutoLock auto_lock(retry_sequence_lock_);
LOG4CXX_DEBUG(logger_, "Index: " << retry_sequence_index_);
- int next = 0;
- if (!retry_sequence_seconds_.empty()
- && retry_sequence_index_ < retry_sequence_seconds_.size()) {
- next = retry_sequence_seconds_[retry_sequence_index_];
- ++retry_sequence_index_;
+ uint32_t next = 0u;
+ if (retry_sequence_seconds_.empty() ||
+ retry_sequence_index_ >= retry_sequence_seconds_.size()) {
+ return next;
}
- return next;
+
+ ++retry_sequence_index_;
+
+ for (uint32_t i = 0u; i < retry_sequence_index_; ++i) {
+ next += retry_sequence_seconds_[i];
+ // According to requirement APPLINK-18244
+ next += retry_sequence_timeout_;
+ }
+
+ // Return miliseconds
+ return next * date_time::DateTime::MILLISECONDS_IN_SECOND;
}
void PolicyManagerImpl::RefreshRetrySequence() {
@@ -747,43 +791,42 @@ void PolicyManagerImpl::OnExceededTimeout() {
void PolicyManagerImpl::OnUpdateStarted() {
int update_timeout = TimeoutExchange();
- LOG4CXX_INFO(logger_, "Update timeout will be set to: " << update_timeout);
+ LOG4CXX_DEBUG(logger_, "Update timeout will be set to (sec): "
+ << update_timeout);
update_status_manager_.OnUpdateSentOut(update_timeout);
cache_->SaveUpdateRequired(true);
}
-void PolicyManagerImpl::PTUpdatedAt(int kilometers, int days_after_epoch) {
- LOG4CXX_INFO(logger_, "PTUpdatedAt");
- LOG4CXX_INFO(logger_,
- "Kilometers: " << kilometers << " Days: " << days_after_epoch);
+void PolicyManagerImpl::PTUpdatedAt(Counters counter, int value) {
+ LOG4CXX_AUTO_TRACE(logger_);
cache_->SetCountersPassedForSuccessfulUpdate(
- kilometers, days_after_epoch);
+ counter, value);
cache_->ResetIgnitionCycles();
}
void PolicyManagerImpl::Increment(usage_statistics::GlobalCounterId type) {
LOG4CXX_INFO(logger_, "Increment without app id" );
- sync_primitives::AutoLock locker(statistics_lock_);
+ cache_->Increment(type);
}
void PolicyManagerImpl::Increment(const std::string& app_id,
usage_statistics::AppCounterId type){
- LOG4CXX_INFO(logger_, "Increment " << app_id);
- sync_primitives::AutoLock locker(statistics_lock_);
+ LOG4CXX_DEBUG(logger_, "Increment " << app_id << " AppCounter: " << type);
+ cache_->Increment(app_id, type);
}
void PolicyManagerImpl::Set(const std::string& app_id,
usage_statistics::AppInfoId type,
const std::string& value) {
LOG4CXX_INFO(logger_, "Set " << app_id);
- sync_primitives::AutoLock locker(statistics_lock_);
+ cache_->Set(app_id, type, value);
}
void PolicyManagerImpl::Add(const std::string& app_id,
usage_statistics::AppStopwatchId type,
int32_t timespan_seconds) {
LOG4CXX_INFO(logger_, "Add " << app_id);
- sync_primitives::AutoLock locker(statistics_lock_);
+ cache_->Add(app_id, type, timespan_seconds);
}
bool PolicyManagerImpl::IsApplicationRevoked(const std::string& app_id) const {
@@ -829,8 +872,19 @@ bool PolicyManagerImpl::CanAppStealFocus(const std::string& app_id) {
void PolicyManagerImpl::MarkUnpairedDevice(const std::string& device_id) {
}
+void PolicyManagerImpl::OnAppRegisteredOnMobile(
+ const std::string& application_id) {
+ SendNotificationOnPermissionsUpdated(application_id);
+ StartPTExchange();
+}
+
+std::string PolicyManagerImpl::RetrieveCertificate() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ return cache_->GetCertificate();
+}
+
void PolicyManagerImpl::AddApplication(const std::string& application_id) {
- LOG4CXX_INFO(logger_, "AddApplication");
+ LOG4CXX_AUTO_TRACE(logger_);
const std::string device_id = GetCurrentDeviceId(application_id);
DeviceConsent device_consent = GetUserConsentForDevice(device_id);
sync_primitives::AutoLock lock(apps_registration_lock_);
@@ -841,8 +895,6 @@ void PolicyManagerImpl::AddApplication(const std::string& application_id) {
} else {
PromoteExistedApplication(application_id, device_consent);
}
- StartPTExchange();
- SendNotificationOnPermissionsUpdated(application_id);
}
void PolicyManagerImpl::RemoveAppConsentForGroup(const std::string& app_id,
@@ -920,7 +972,7 @@ bool PolicyManagerImpl::InitPT(const std::string& file_name) {
return ret;
}
-uint16_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const {
+uint32_t PolicyManagerImpl::HeartBeatTimeout(const std::string& app_id) const {
return cache_->HeartBeatTimeout(app_id);
}
@@ -933,5 +985,18 @@ void PolicyManagerImpl::set_cache_manager(
cache_ = cache_manager;
}
-} // namespace policy
+void PolicyManagerImpl::RetrySequence() {
+ LOG4CXX_INFO(logger_, "Start new retry sequence");
+ RequestPTUpdate();
+
+ uint32_t timeout = NextRetryTimeout();
+ if (!timeout && timer_retry_sequence_.IsRunning()) {
+ timer_retry_sequence_.Stop();
+ return;
+ }
+
+ timer_retry_sequence_.Start(timeout, true);
+}
+
+} // namespace policy
diff --git a/src/components/policy/src/policy/src/policy_table.cc b/src/components/policy/src/policy/src/policy_table.cc
index 991f2ee08d..700849c372 100644
--- a/src/components/policy/src/policy/src/policy_table.cc
+++ b/src/components/policy/src/policy/src/policy_table.cc
@@ -38,12 +38,10 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "PolicyTable")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
PolicyTable::PolicyTable()
- : pt_data_(
- new SQLPTRepresentation()
- ) {
+ : pt_data_(new SQLPTRepresentation()) {
}
PolicyTable::PolicyTable(utils::SharedPtr<PTRepresentation> pt_data)
diff --git a/src/components/policy/src/policy/src/sql_pt_ext_queries.cc b/src/components/policy/src/policy/src/sql_pt_ext_queries.cc
index 776b318991..13477054aa 100644
--- a/src/components/policy/src/policy/src/sql_pt_ext_queries.cc
+++ b/src/components/policy/src/policy/src/sql_pt_ext_queries.cc
@@ -111,7 +111,8 @@ const std::string kSelectAppLevels =
" `count_of_removals_for_bad_behavior`, "
" `count_of_run_attempts_while_revoked`, "
" `app_registration_language_gui`, "
- " `app_registration_language_vui` "
+ " `app_registration_language_vui`, "
+ " `count_of_tls_errors` "
"FROM `app_level`";
const std::string kUpdateGlobalCounters = "UPDATE `usage_and_error_count` SET "
diff --git a/src/components/policy/src/policy/src/sql_pt_ext_representation.cc b/src/components/policy/src/policy/src/sql_pt_ext_representation.cc
index a24141999b..1fa2e75012 100644
--- a/src/components/policy/src/policy/src/sql_pt_ext_representation.cc
+++ b/src/components/policy/src/policy/src/sql_pt_ext_representation.cc
@@ -1,5 +1,5 @@
-/*
- Copyright (c) 2013, Ford Motor Company
+/*
+ Copyright (c) 2015, Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, with or without
@@ -41,10 +41,10 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SQLPTRepresentation")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
bool SQLPTExtRepresentation::CanAppKeepContext(const std::string& app_id) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt_ext::kSelectKeepContext)) {
query.Bind(0, app_id);
if (query.Exec()) {
@@ -55,7 +55,7 @@ bool SQLPTExtRepresentation::CanAppKeepContext(const std::string& app_id) {
}
bool SQLPTExtRepresentation::CanAppStealFocus(const std::string& app_id) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt_ext::kSelectStealFocus)) {
query.Bind(0, app_id);
if (query.Exec()) {
@@ -70,7 +70,7 @@ bool SQLPTExtRepresentation::ResetUserConsent() {
}
bool SQLPTExtRepresentation::ResetDeviceConsents() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kResetDeviceConsents)) {
LOG4CXX_WARN(logger_, "Incorrect delete statement from device_consents.");
return false;
@@ -79,14 +79,14 @@ bool SQLPTExtRepresentation::ResetDeviceConsents() {
}
bool SQLPTExtRepresentation::ResetAppConsents() {
- return dbms::SQLQuery(db()).Exec(sql_pt_ext::kResetAppConsents);
+ return utils::dbms::SQLQuery(db()).Exec(sql_pt_ext::kResetAppConsents);
}
bool SQLPTExtRepresentation::GetUserPermissionsForDevice(
const std::string& device_id, StringArray* consented_groups,
StringArray* disallowed_groups) {
- LOG4CXX_INFO(logger_, "GetUserPermissionsForDevice");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) {
LOG4CXX_WARN(logger_, "Incorrect select from device consented groups");
return false;
@@ -112,7 +112,7 @@ bool SQLPTExtRepresentation::GetUserPermissionsForDevice(
bool SQLPTExtRepresentation::GetPermissionsForApp(
const std::string& device_id, const std::string& policy_app_id,
FunctionalIdType* group_types) {
- LOG4CXX_INFO(logger_, "GetPermissionsForApp");
+ LOG4CXX_AUTO_TRACE(logger_);
if (!group_types) {
LOG4CXX_WARN(logger_, "Input parameter for group types is null.");
return false;
@@ -165,7 +165,7 @@ bool SQLPTExtRepresentation::GetPermissionsForApp(
bool SQLPTExtRepresentation::GetDeviceGroupsFromPolicies(
policy_table::Strings* groups, policy_table::Strings* preconsented_groups) {
- LOG4CXX_INFO(logger_, "GetDeviceGroupsFromPolicies");
+ LOG4CXX_AUTO_TRACE(logger_);
if (groups) {
GatherAppGroup(kDeviceId, groups);
}
@@ -183,8 +183,8 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
const std::string& carrier,
const uint32_t number_of_ports,
const std::string& connection_type) {
- LOG4CXX_INFO(logger_, "SetDeviceData");
- dbms::SQLQuery count_query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery count_query(db());
if (!count_query.Prepare(sql_pt_ext::kCountDevice)) {
LOG4CXX_WARN(logger_, "Incorrect statement for count of device.");
return false;
@@ -201,7 +201,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
// Update old value
if (update) {
- dbms::SQLQuery update_query(db());
+ utils::dbms::SQLQuery update_query(db());
if (!update_query.Prepare(sql_pt_ext::kUpdateDevice)) {
LOG4CXX_WARN(logger_, "Incorrect statement for udpate device.");
return false;
@@ -225,7 +225,7 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
}
// Insert new data
- dbms::SQLQuery insert_query(db());
+ utils::dbms::SQLQuery insert_query(db());
if (!insert_query.Prepare(sql_pt_ext::kInsertDevice)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for device.");
return false;
@@ -253,8 +253,8 @@ bool SQLPTExtRepresentation::SetDeviceData(const std::string& device_id,
bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
const std::string& device_id, const StringArray& consented_groups,
const StringArray& disallowed_groups) {
- LOG4CXX_TRACE(logger_, "SetUserPermissionsForDevice");
- dbms::SQLQuery count_query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery count_query(db());
if (!count_query.Prepare(sql_pt_ext::kCountDeviceConsentGroup)) {
LOG4CXX_WARN(logger_, "Incorrect count of device consented groups");
return false;
@@ -270,7 +270,7 @@ bool SQLPTExtRepresentation::SetUserPermissionsForDevice(
bool update = count_query.GetInteger(0);
// TODO(AOleynik): Split to several methods?
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
// Update old values
if (update) {
if (!query.Prepare(sql_pt_ext::kUpdateDeviceConsentedGroup)) {
@@ -361,7 +361,7 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp(
// If app has only pre_DataConsented flag it should be only set to false and
// all groups get restored automatically
if (IsPredataPolicy(app_id)) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kHasAppPreloadedGroups)) {
LOG4CXX_WARN(logger_, "Incorrect statement for has app preloaded groups");
return false;
@@ -393,7 +393,7 @@ bool SQLPTExtRepresentation::ReactOnUserDevConsentForApp(
bool SQLPTExtRepresentation::SetUserPermissionsForApp(
const PermissionConsent& permissions) {
- LOG4CXX_INFO(logger_, "SetUserPermissionsForApp");
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(AOleynik): Handle situation, when no application was specified, i.e.
// general permissions were set
std::vector<FunctionalGroupPermission>::const_iterator it = permissions
@@ -401,9 +401,9 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
std::vector<FunctionalGroupPermission>::const_iterator it_end = permissions
.group_permissions.end();
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
for (; it != it_end; ++it) {
- dbms::SQLQuery counter(db());
+ utils::dbms::SQLQuery counter(db());
if (!counter.Prepare(sql_pt_ext::kCountAppConsents)) {
LOG4CXX_WARN(logger_, "Incorrect statement for consent group count.");
return false;
@@ -472,8 +472,8 @@ bool SQLPTExtRepresentation::SetUserPermissionsForApp(
}
std::vector<UserFriendlyMessage> SQLPTExtRepresentation::GetUserFriendlyMsg(
- const std::vector<std::string>& msg_codes, const std::string& language) {
- dbms::SQLQuery query(db());
+ const std::vector<std::string>& msg_codes, const std::string& language) {
+ utils::dbms::SQLQuery query(db());
std::vector<UserFriendlyMessage> result;
if (!query.Prepare(sql_pt_ext::kSelectFriendlyMsg)) {
LOG4CXX_WARN(logger_, "Incorrect statement for select friendly messages.");
@@ -530,7 +530,7 @@ bool SQLPTExtRepresentation::GatherConsumerFriendlyMessages(
return false;
}
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
bool result = query.Prepare(sql_pt_ext::kCollectFriendlyMsg);
if (result) {
@@ -563,7 +563,7 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version,
const std::string& wers_country_code,
const std::string& language) {
LOG4CXX_AUTO_TRACE(logger_);
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateMetaParams)) {
LOG4CXX_WARN(logger_, "Incorrect statement for insert to module meta.");
return false;
@@ -581,8 +581,8 @@ bool SQLPTExtRepresentation::SetMetaInfo(const std::string& ccpu_version,
}
bool SQLPTExtRepresentation::IsMetaInfoPresent() {
- LOG4CXX_INFO(logger_, "IsMetaInfoPresent");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectMetaParams)) {
LOG4CXX_WARN(logger_, "Incorrect statement for selecting meta info.");
return false;
@@ -597,8 +597,8 @@ bool SQLPTExtRepresentation::IsMetaInfoPresent() {
}
bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) {
- LOG4CXX_INFO(logger_, "SetSystemLanguage");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateMetaLanguage)) {
LOG4CXX_WARN(logger_, "Incorrect statement for update meta language.");
return false;
@@ -617,13 +617,13 @@ bool SQLPTExtRepresentation::SetSystemLanguage(const std::string& language) {
bool SQLPTExtRepresentation::SaveApplicationPoliciesSection(
const policy_table::ApplicationPoliciesSection& policies) {
LOG4CXX_INFO(logger_, "SaveApplicationPolicies ext");
- dbms::SQLQuery query_delete(db());
+ utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
return false;
}
- dbms::SQLQuery query_delete_preconsented(db());
+ utils::dbms::SQLQuery query_delete_preconsented(db());
if (!query_delete_preconsented.Exec(sql_pt_ext::kDeletePreconsentedGroups)) {
LOG4CXX_WARN(logger_, "Incorrect delete from preconsented_group.");
return false;
@@ -701,7 +701,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
SetIsDefault(app.first, false);
SetIsPredata(app.first, false);
- dbms::SQLQuery app_query(db());
+ utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt_ext::kInsertApplication)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
return false;
@@ -717,7 +717,7 @@ bool SQLPTExtRepresentation::SaveSpecificAppPolicy(
app_query.Bind(
5, app.second.is_null());
app_query.Bind(6, *app.second.memory_kb);
- app_query.Bind(7, *app.second.heart_beat_timeout_ms);
+ app_query.Bind(7, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
app.second.certificate.is_initialized() ?
app_query.Bind(8, *app.second.certificate) : app_query.Bind(8, std::string());
@@ -782,7 +782,7 @@ bool policy::SQLPTExtRepresentation::SaveDevicePolicy(
bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
LOG4CXX_INFO(logger_, "Gather applications policies");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectAppPolicies)) {
LOG4CXX_WARN(logger_, "Incorrect select from app_policies");
return false;
@@ -828,7 +828,7 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
params.keep_context = query.GetBoolean(3);
params.steal_focus = query.GetBoolean(4);
*params.memory_kb = query.GetInteger(5);
- *params.heart_beat_timeout_ms = query.GetInteger(6);
+ *params.heart_beat_timeout_ms = query.GetUInteger(6);
if (!query.IsNull(7)) {
*params.certificate = query.GetString(7);
}
@@ -852,7 +852,7 @@ bool SQLPTExtRepresentation::GatherApplicationPoliciesSection(
void SQLPTExtRepresentation::GatherPreconsentedGroup(
const std::string& app_id, policy_table::Strings* groups) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroups)) {
LOG4CXX_WARN(logger_, "Incorrect select from preconsented group");
return;
@@ -867,7 +867,7 @@ void SQLPTExtRepresentation::GatherPreconsentedGroup(
bool SQLPTExtRepresentation::GatherUsageAndErrorCounts(
policy_table::UsageAndErrorCounts* counts) const {
LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectUsageAndErrorCount) || !query.Exec()) {
LOG4CXX_INFO(logger_, "Failed select from user_and_error_count");
return false;
@@ -882,7 +882,7 @@ bool SQLPTExtRepresentation::GatherUsageAndErrorCounts(
bool SQLPTExtRepresentation::GatherAppLevels(
policy_table::AppLevels* apps) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectAppLevels)) {
LOG4CXX_INFO(logger_, "Failed select from app_level. SQLError = "
<< query.LastError().text());
@@ -905,6 +905,7 @@ bool SQLPTExtRepresentation::GatherAppLevels(
level.count_of_run_attempts_while_revoked = query.GetInteger(12);
level.app_registration_language_gui = query.GetString(13);
level.app_registration_language_vui = query.GetString(14);
+ level.count_of_tls_errors = query.GetInteger(15);
(*apps)[query.GetString(0)] = level;
}
@@ -914,7 +915,7 @@ bool SQLPTExtRepresentation::GatherAppLevels(
void SQLPTExtRepresentation::GatherDeviceData(
policy_table::DeviceData* data) const {
LOG4CXX_INFO(logger_, "Gather device data.");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectDeviceData)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for device data.");
return;
@@ -939,7 +940,7 @@ void SQLPTExtRepresentation::GatherConsentGroup(
const std::string& device_id,
policy_table::UserConsentRecords* records) const {
LOG4CXX_INFO(logger_, "Gather consent records.");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
// Fill data for device
if (!query.Prepare(sql_pt_ext::kSelectDeviceConsentedGroup)) {
LOG4CXX_WARN(logger_,
@@ -991,29 +992,29 @@ void SQLPTExtRepresentation::GatherConsentGroup(
bool SQLPTExtRepresentation::SaveDeviceData(
const policy_table::DeviceData& devices) {
- LOG4CXX_INFO(logger_, "SaveDeviceData");
- dbms::SQLQuery drop_device_query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery drop_device_query(db());
const std::string drop_device = "DELETE FROM `device`";
if (!drop_device_query.Exec(drop_device)) {
LOG4CXX_WARN(logger_, "Could not clear device table.");
return false;
}
- dbms::SQLQuery drop_device_consents_query(db());
+ utils::dbms::SQLQuery drop_device_consents_query(db());
const std::string drop_device_consents = "DELETE FROM `device_consent_group`";
if (!drop_device_consents_query.Exec(drop_device_consents)) {
LOG4CXX_WARN(logger_, "Could not clear device consents.");
return false;
}
- dbms::SQLQuery drop_user_consents_query(db());
+ utils::dbms::SQLQuery drop_user_consents_query(db());
const std::string drop_user_consents = "DELETE FROM `consent_group`";
if (!drop_user_consents_query.Exec(drop_user_consents)) {
LOG4CXX_WARN(logger_, "Could not clear user consents.");
return false;
}
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kInsertDeviceData)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
return false;
@@ -1048,8 +1049,8 @@ const policy_table::DeviceData& devices) {
bool SQLPTExtRepresentation::SaveConsentGroup(
const std::string& device_id,
const policy_table::UserConsentRecords& records) {
- LOG4CXX_INFO(logger_, "SaveConsentGroup");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
policy_table::UserConsentRecords::const_iterator it = records.begin();
policy_table::UserConsentRecords::const_iterator it_end = records.end();
@@ -1109,8 +1110,8 @@ bool SQLPTExtRepresentation::SaveConsentGroup(
bool SQLPTExtRepresentation::SavePreconsentedGroup(
const std::string& app_id, const policy_table::Strings& groups) {
- LOG4CXX_INFO(logger_, "SavePreconsentedGroup");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kInsertPreconsentedGroups)) {
LOG4CXX_WARN(logger_,
"Incorrect insert statement for preconsented groups");
@@ -1133,7 +1134,7 @@ bool SQLPTExtRepresentation::SavePreconsentedGroup(
void SQLPTExtRepresentation::GatherModuleMeta(
policy_table::ModuleMeta* meta) const {
LOG4CXX_INFO(logger_, "Gather Module Meta Info");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt_ext::kSelectModuleMeta) && query.Next()) {
*meta->ccpu_version = query.GetString(0);
*meta->language = query.GetString(1);
@@ -1146,7 +1147,7 @@ void SQLPTExtRepresentation::GatherModuleMeta(
}
void SQLPTExtRepresentation::Increment(const std::string& type) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
std::string update_counter = "UPDATE `usage_and_error_count` SET `" + type
+ "` = `" + type + "` + 1";
if (!query.Exec(update_counter)) {
@@ -1155,7 +1156,7 @@ void SQLPTExtRepresentation::Increment(const std::string& type) const {
}
bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kCountAppLevel)) {
LOG4CXX_INFO(logger_, "Incorrect statement of count app_level");
return false;
@@ -1171,7 +1172,7 @@ bool SQLPTExtRepresentation::IsExistAppLevel(const std::string& app_id) const {
bool SQLPTExtRepresentation::GetAllAppGroups(const std::string& policy_app_id,
FunctionalGroupIDs& all_groups) {
LOG4CXX_INFO(logger_, "GetAllAppGroups for '" << policy_app_id << "'");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectAppGroupsId)) {
LOG4CXX_WARN(logger_, "Incorrect statement for select app groups id.");
return false;
@@ -1190,8 +1191,8 @@ bool SQLPTExtRepresentation::GetConsentedGroups(
const std::string& policy_app_id, const std::string& device_id,
FunctionalGroupIDs& allowed_groups, FunctionalGroupIDs& disallowed_groups) {
- LOG4CXX_INFO(logger_, "GetConsentedGroups");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectConsentedGroupsId)) {
LOG4CXX_WARN(logger_, "Incorrect statement for select consent groups id.");
return false;
@@ -1213,8 +1214,8 @@ bool SQLPTExtRepresentation::GetConsentedGroups(
bool SQLPTExtRepresentation::GetPreconsentedGroups(
const std::string& policy_app_id, FunctionalGroupIDs& preconsented_groups) {
- LOG4CXX_INFO(logger_, "GetPreconsentedGroups");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectPreconsentedGroupsId)) {
LOG4CXX_WARN(logger_,
"Incorrect statement for select preconsented groups id.");
@@ -1232,8 +1233,8 @@ bool SQLPTExtRepresentation::GetPreconsentedGroups(
bool SQLPTExtRepresentation::GetFunctionalGroupNames(
FunctionalGroupNames& names) {
- LOG4CXX_INFO(logger_, "GetFunctionalGroupNames");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectFunctionalGroupNames)) {
LOG4CXX_WARN(logger_,
"Incorrect statement for select functional groups names.");
@@ -1272,7 +1273,7 @@ void SQLPTExtRepresentation::FillFunctionalGroupPermissions(
void SQLPTExtRepresentation::Increment(const std::string& app_id,
const std::string& type) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
std::string sql_counter;
if (IsExistAppLevel(app_id)) {
// update
@@ -1296,7 +1297,7 @@ void SQLPTExtRepresentation::Increment(const std::string& app_id,
void SQLPTExtRepresentation::Set(const std::string& app_id,
const std::string& type,
const std::string& value) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
std::string sql_info;
if (IsExistAppLevel(app_id)) {
// update
@@ -1320,7 +1321,7 @@ void SQLPTExtRepresentation::Set(const std::string& app_id,
void SQLPTExtRepresentation::Add(const std::string& app_id,
const std::string& type, int seconds) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
std::string sql_stopwatch;
if (IsExistAppLevel(app_id)) {
// update
@@ -1345,8 +1346,8 @@ void SQLPTExtRepresentation::Add(const std::string& app_id,
bool SQLPTExtRepresentation::GetDefaultHMI(const std::string& policy_app_id,
std::string* default_hmi) {
- LOG4CXX_INFO(logger_, "GetDefaultHMI");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectDefaultHmi)) {
LOG4CXX_INFO(logger_, "Incorrect statement for default hmi.");
return false;
@@ -1373,8 +1374,8 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups(
const std::string& policy_app_id,
const std::string& device_id,
int* result) const {
- LOG4CXX_INFO(logger_, "CountUnconsentedGroups");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kCountUnconsentedGroups)) {
LOG4CXX_WARN(logger_, "Incorrect select for unconsented groups.");
return false;
@@ -1395,7 +1396,7 @@ bool SQLPTExtRepresentation::CountUnconsentedGroups(
bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string &message,
const std::string &language) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kHasMsgLanguageCode)) {
LOG4CXX_WARN(logger_, "Incorrect statement for message language check.");
return false;
@@ -1415,7 +1416,7 @@ bool SQLPTExtRepresentation::IsMsgLanguagePresent(const std::string &message,
bool SQLPTExtRepresentation::SaveMessageString(
const std::string& type, const std::string& lang,
const policy_table::MessageString& strings) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageString)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for message.");
return false;
@@ -1444,7 +1445,7 @@ bool SQLPTExtRepresentation::SaveUsageAndErrorCounts(
bool SQLPTExtRepresentation::SaveModuleMeta(
const policy_table::ModuleMeta& meta) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSaveModuleMeta)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for module_meta.");
@@ -1470,7 +1471,7 @@ bool SQLPTExtRepresentation::SaveModuleMeta(
bool SQLPTExtRepresentation::SaveAppCounters(
const rpc::policy_table_interface_base::AppLevels& app_levels) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteAppLevel)) {
LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
return false;
@@ -1497,6 +1498,8 @@ bool SQLPTExtRepresentation::SaveAppCounters(
query.Bind(12, it->second.count_of_run_attempts_while_revoked);
query.Bind(13, it->second.app_registration_language_gui);
query.Bind(14, it->second.app_registration_language_vui);
+ query.Bind(15, it->second.count_of_tls_errors);
+
if (!query.Exec() || !query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into app level.");
return false;
@@ -1507,7 +1510,7 @@ bool SQLPTExtRepresentation::SaveAppCounters(
bool SQLPTExtRepresentation::SaveGlobalCounters(
const rpc::policy_table_interface_base::UsageAndErrorCounts& counts) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateGlobalCounters)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for global counters.");
return false;
@@ -1527,20 +1530,20 @@ bool SQLPTExtRepresentation::SaveGlobalCounters(
bool SQLPTExtRepresentation::CleanupUnpairedDevices(
const DeviceIds& device_ids) const {
- LOG4CXX_INFO(logger_, "CleanupUnpairedDevices");
- dbms::SQLQuery delete_device_query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery delete_device_query(db());
if (!delete_device_query.Prepare(sql_pt::kDeleteDevice)) {
LOG4CXX_WARN(logger_, "Incorrect statement for device delete.");
return true;
}
- dbms::SQLQuery delete_device_consent_query(db());
+ utils::dbms::SQLQuery delete_device_consent_query(db());
if (!delete_device_consent_query.Prepare(sql_pt_ext::kDeleteDeviceConsent)) {
LOG4CXX_WARN(logger_, "Incorrect statement for delete device consent.");
return false;
}
- dbms::SQLQuery delete_app_consent_query(db());
+ utils::dbms::SQLQuery delete_app_consent_query(db());
if (!delete_app_consent_query.Prepare(sql_pt_ext::kDeleteAppConsent)) {
LOG4CXX_WARN(logger_, "Incorrect statement for delete app consent.");
return false;
@@ -1572,7 +1575,7 @@ bool SQLPTExtRepresentation::CleanupUnpairedDevices(
}
bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
return false;
@@ -1613,7 +1616,7 @@ bool SQLPTExtRepresentation::SetDefaultPolicy(const std::string& app_id) {
bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) {
LOG4CXX_INFO(logger_, "SQLPTExtRepresentation::SetPredataPolicy for " << app_id);
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
return false;
@@ -1652,7 +1655,7 @@ bool SQLPTExtRepresentation::SetPredataPolicy(const std::string& app_id) {
}
bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectApplicationIsPreData)) {
LOG4CXX_WARN(logger_, "Incorrect select application is pre_dataConsented");
return false;
@@ -1669,7 +1672,7 @@ bool SQLPTExtRepresentation::IsPredataPolicy(const std::string& app_id) const {
bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id,
bool is_pre_data) {
LOG4CXX_TRACE(logger_, "Set flag is_predata of application");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateIsPredata)) {
LOG4CXX_WARN(logger_, "Incorect statement for updating is_predata");
return false;
@@ -1687,7 +1690,7 @@ bool SQLPTExtRepresentation::SetIsPredata(const std::string& app_id,
bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id,
bool unpaired) const {
LOG4CXX_TRACE(logger_, "Set unpaired device: " << device_id);
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateUnpairedDevice)) {
LOG4CXX_WARN(logger_, "Incorect statement for updating unpaired device");
return false;
@@ -1704,7 +1707,7 @@ bool SQLPTExtRepresentation::SetUnpairedDevice(const std::string& device_id,
bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const {
LOG4CXX_TRACE(logger_, "Get list of unpaired devices");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kSelectUnpairedDevices)) {
LOG4CXX_WARN(logger_, "Incorect statement for selecting unpaired devices");
return false;
@@ -1717,7 +1720,7 @@ bool SQLPTExtRepresentation::UnpairedDevicesList(DeviceIds* device_ids) const {
}
bool SQLPTExtRepresentation::SetVINValue(const std::string& value){
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kUpdateModuleMetaVinParam)) {
LOG4CXX_WARN(logger_, "Incorect statement for updating module_meta params");
return false;
@@ -1735,7 +1738,7 @@ bool SQLPTExtRepresentation::SetVINValue(const std::string& value){
bool SQLPTExtRepresentation::RemoveAppConsentForGroup(
const std::string& policy_app_id,
const std::string& functional_group_name) const {
- dbms::SQLQuery query_group_id(db());
+ utils::dbms::SQLQuery query_group_id(db());
if (!query_group_id.Prepare(sql_pt_ext::kSelectGroupId)) {
LOG4CXX_WARN(logger_, "Incorect statement for select group name.");
return false;
@@ -1750,7 +1753,7 @@ bool SQLPTExtRepresentation::RemoveAppConsentForGroup(
const int id = query_group_id.GetInteger(0);
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt_ext::kDeleteAppGroupConsent)) {
LOG4CXX_WARN(logger_, "Incorect statement for remove app consent.");
return false;
diff --git a/src/components/policy/src/policy/src/sql_pt_queries.cc b/src/components/policy/src/policy/src/sql_pt_queries.cc
index efc2d60c2f..d22cf4db8c 100644
--- a/src/components/policy/src/policy/src/sql_pt_queries.cc
+++ b/src/components/policy/src/policy/src/sql_pt_queries.cc
@@ -1,5 +1,5 @@
-/*
- Copyright (c) 2013, " Ford Motor Company
+/*
+ Copyright (c) 2015, " Ford Motor Company
All rights reserved.
Redistribution and use in source and binary forms, " with or without
@@ -72,13 +72,14 @@ const std::string kCreateSchema =
" `exchange_after_x_kilometers` INTEGER NOT NULL, "
" `exchange_after_x_days` INTEGER NOT NULL, "
" `timeout_after_x_seconds` INTEGER NOT NULL, "
+ " `certificate` TEXT, "
" `vehicle_make` VARCHAR(45), "
" `vehicle_model` VARCHAR(45), "
" `vehicle_year` VARCHAR(4) "
"); "
"CREATE TABLE IF NOT EXISTS `functional_group`( "
" `id` INTEGER PRIMARY KEY NOT NULL, "
- " `user_consent_prompt` TEXT UNIQUE ON CONFLICT REPLACE, "
+ " `user_consent_prompt` TEXT, "
" `name` VARCHAR(100) NOT NULL "
"); "
"CREATE TABLE IF NOT EXISTS `priority`( "
@@ -218,6 +219,7 @@ const std::string kCreateSchema =
" `count_of_rpcs_sent_in_hmi_none` INTEGER DEFAULT 0, "
" `count_of_removals_for_bad_behavior` INTEGER DEFAULT 0, "
" `count_of_run_attempts_while_revoked` INTEGER DEFAULT 0, "
+ " `count_of_tls_errors` INTEGER DEFAULT 0, "
" `app_registration_language_gui` VARCHAR(25), "
" `app_registration_language_vui` VARCHAR(25), "
" CONSTRAINT `fk_app_levels_application1` "
@@ -317,6 +319,9 @@ const std::string kCreateSchema =
" ON `message`(`language_code`);"
"CREATE INDEX IF NOT EXISTS `message.fk_message_consumer_friendly_messages1_idx` "
" ON `message`(`message_type_name`);"
+ "CREATE TABLE IF NOT EXISTS `_internal_data`( "
+ " `db_version_hash` INTEGER "
+ " ); "
"COMMIT;";
const std::string kInsertInitData =
@@ -342,6 +347,7 @@ const std::string kInsertInitData =
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND'); "
"INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE'); "
"INSERT OR IGNORE INTO `version` (`number`) VALUES('0'); "
+ "INSERT OR IGNORE INTO `_internal_data` (`db_version_hash`) VALUES(0); "
"";
const std::string kDropSchema =
@@ -391,6 +397,7 @@ const std::string kDropSchema =
"DROP TABLE IF EXISTS `module_meta`; "
"DROP TABLE IF EXISTS `usage_and_error_count`; "
"DROP TABLE IF EXISTS `device`; "
+ "DROP TABLE IF EXISTS `_internal_data`; "
"COMMIT; "
"VACUUM;";
@@ -496,7 +503,7 @@ const std::string kUpdateModuleConfig =
"UPDATE `module_config` SET `preloaded_pt` = ?, "
" `exchange_after_x_ignition_cycles` = ?,"
" `exchange_after_x_kilometers` = ?, `exchange_after_x_days` = ?, "
- " `timeout_after_x_seconds` = ?, `vehicle_make` = ?, "
+ " `timeout_after_x_seconds` = ?, `certificate` = ?, `vehicle_make` = ?, "
" `vehicle_model` = ?, `vehicle_year` = ?";
const std::string kInsertEndpoint =
@@ -522,7 +529,7 @@ const std::string kInsertAppLevel =
"`count_of_rejections_duplicate_name`,`count_of_rejected_rpcs_calls`,"
"`count_of_rpcs_sent_in_hmi_none`,`count_of_removals_for_bad_behavior`,"
"`count_of_run_attempts_while_revoked`,`app_registration_language_gui`,"
- "`app_registration_language_vui`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
+ "`app_registration_language_vui`, `count_of_tls_errors`) VALUES(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
const std::string kDeleteSecondsBetweenRetries =
"DELETE FROM `seconds_between_retry`";
@@ -542,7 +549,7 @@ const std::string kDeleteAppGroup = "DELETE FROM `app_group`";
const std::string kSelectModuleConfig =
"SELECT `preloaded_pt`, `exchange_after_x_ignition_cycles`, "
" `exchange_after_x_kilometers`, `exchange_after_x_days`, "
- " `timeout_after_x_seconds`, `vehicle_make`,"
+ " `timeout_after_x_seconds`, `certificate`, `vehicle_make`,"
" `vehicle_model`, `vehicle_year` "
" FROM `module_config`";
@@ -663,6 +670,12 @@ const std::string kSelectApplicationFull =
" `is_revoked`, `is_default`, `is_predata`, `memory_kb`,"
" `heart_beat_timeout_ms`, `certificate` FROM `application` WHERE `id` = ?";
+const std::string kSelectDBVersion =
+ "SELECT `db_version_hash` from `_internal_data`";
+
+const std::string kUpdateDBVersion =
+ "UPDATE `_internal_data` SET `db_version_hash` = ? ";
+
} // namespace sql_pt
} // namespace policy
diff --git a/src/components/policy/src/policy/src/sql_pt_representation.cc b/src/components/policy/src/policy/src/sql_pt_representation.cc
index 47eae02dd7..a49ca9307a 100644
--- a/src/components/policy/src/policy/src/sql_pt_representation.cc
+++ b/src/components/policy/src/policy/src/sql_pt_representation.cc
@@ -1,4 +1,4 @@
-/*
+/*
Copyright (c) 2013, Ford Motor Company
All rights reserved.
@@ -37,6 +37,8 @@
#include <unistd.h>
#include "utils/logger.h"
+#include "utils/file_system.h"
+#include "utils/gen_hash.h"
#include "policy/sql_pt_representation.h"
#include "policy/sql_wrapper.h"
#include "policy/sql_pt_queries.h"
@@ -46,7 +48,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SQLPTRepresentation")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
namespace {
template<typename T, typename K> void InsertUnique(K value, T* array) {
@@ -63,7 +65,7 @@ template<typename T, typename K> void InsertUnique(K value, T* array) {
const std::string SQLPTRepresentation::kDatabaseName = "policy";
SQLPTRepresentation::SQLPTRepresentation()
- : db_(new dbms::SQLDatabase(kDatabaseName)) {
+ : db_(new utils::dbms::SQLDatabase(kDatabaseName)) {
#ifndef __QNX__
std::string path = profile::Profile::instance()->app_storage_folder();
if (!path.empty()) {
@@ -81,7 +83,7 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
const PTString& hmi_level,
const PTString& rpc,
CheckPermissionResult& result) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRpc)) {
LOG4CXX_WARN(
@@ -111,12 +113,12 @@ void SQLPTRepresentation::CheckPermissions(const PTString& app_id,
}
bool SQLPTRepresentation::IsPTPreloaded() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
return query.Prepare(sql_pt::kSelectPreloaded) && query.Next();
}
int SQLPTRepresentation::IgnitionCyclesBeforeExchange() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectIgnitionCycles) || !query.Exec()) {
LOG4CXX_WARN(logger_, "Can not select ignition cycles");
return 0;
@@ -132,7 +134,7 @@ int SQLPTRepresentation::IgnitionCyclesBeforeExchange() {
}
int SQLPTRepresentation::KilometersBeforeExchange(int current) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectKilometers) || !query.Exec()) {
LOG4CXX_WARN(logger_, "Can not select kilometers");
return 0;
@@ -151,7 +153,7 @@ int SQLPTRepresentation::KilometersBeforeExchange(int current) {
bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
int kilometers, int days_after_epoch) {
LOG4CXX_AUTO_TRACE(logger_);
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateCountersSuccessfulUpdate)) {
LOG4CXX_WARN(logger_,
"Wrong update query for counters on successful update.");
@@ -167,7 +169,7 @@ bool SQLPTRepresentation::SetCountersPassedForSuccessfulUpdate(
}
int SQLPTRepresentation::DaysBeforeExchange(int current) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectDays) || !query.Exec()) {
LOG4CXX_WARN(logger_, "Can not select days");
return 0;
@@ -188,7 +190,7 @@ int SQLPTRepresentation::DaysBeforeExchange(int current) {
}
int SQLPTRepresentation::TimeoutResponse() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectTimeoutResponse) || !query.Exec()) {
LOG4CXX_INFO(logger_, "Can not select timeout response for retry sequence");
const int kDefault = 30;
@@ -198,7 +200,7 @@ int SQLPTRepresentation::TimeoutResponse() {
}
bool SQLPTRepresentation::SecondsBetweenRetries(std::vector<int>* seconds) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
LOG4CXX_INFO(logger_,
"Incorrect select statement from seconds between retries");
@@ -226,7 +228,7 @@ std::vector<UserFriendlyMessage> SQLPTRepresentation::GetUserFriendlyMsg(
EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
LOG4CXX_INFO(logger_, "SQLPTRepresentation::GetUpdateUrls for "
<< service_type);
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
EndpointUrls ret;
if (query.Prepare(sql_pt::kSelectEndpoint)) {
query.Bind(0, service_type);
@@ -246,7 +248,7 @@ EndpointUrls SQLPTRepresentation::GetUpdateUrls(int service_type) {
}
std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
std::string ret;
if (query.Prepare(sql_pt::kSelectLockScreenIcon)) {
query.Bind(0, std::string("lock_screen_icon_url"));
@@ -269,8 +271,8 @@ std::string SQLPTRepresentation::GetLockScreenIconUrl() const {
int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
- LOG4CXX_INFO(logger_, "GetNotificationsNumber");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNotificationsPerPriority)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for priority "
"notification number.");
@@ -291,12 +293,12 @@ int SQLPTRepresentation::GetNotificationsNumber(const std::string& priority) {
bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
std::string* priority) {
- LOG4CXX_INFO(logger_, "GetPriority");
+ LOG4CXX_AUTO_TRACE(logger_);
if (NULL == priority) {
LOG4CXX_WARN(logger_, "Input priority parameter is null.");
return false;
}
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectPriority)) {
LOG4CXX_INFO(logger_, "Incorrect statement for priority.");
return false;
@@ -321,7 +323,9 @@ bool SQLPTRepresentation::GetPriority(const std::string& policy_app_id,
InitResult SQLPTRepresentation::Init() {
LOG4CXX_AUTO_TRACE(logger_);
-
+#ifdef BUILD_TESTS
+ open_counter_ = 0;
+#endif // BUILD_TESTS
if (!db_->Open()) {
LOG4CXX_ERROR(logger_, "Failed opening database.");
LOG4CXX_INFO(logger_, "Starting opening retries.");
@@ -337,6 +341,9 @@ InitResult SQLPTRepresentation::Init() {
for (int i = 0; i < attempts; ++i) {
usleep(sleep_interval_mcsec);
LOG4CXX_INFO(logger_, "Attempt: " << i+1);
+#ifdef BUILD_TESTS
+ ++open_counter_;
+#endif // BUILD_TESTS
if (db_->Open()){
LOG4CXX_INFO(logger_, "Database opened.");
is_opened = true;
@@ -356,25 +363,26 @@ InitResult SQLPTRepresentation::Init() {
LOG4CXX_ERROR(logger_, "There are no read/write permissions for database");
return InitResult::FAIL;
}
+
#endif // __QNX__
- dbms::SQLQuery check_pages(db());
+ utils::dbms::SQLQuery check_pages(db());
if (!check_pages.Prepare(sql_pt::kCheckPgNumber) || !check_pages.Next()) {
LOG4CXX_WARN(logger_, "Incorrect pragma for page counting.");
} else {
if (0 < check_pages.GetInteger(0)) {
- dbms::SQLQuery db_check(db());
+ utils::dbms::SQLQuery db_check(db());
if (!db_check.Prepare(sql_pt::kCheckDBIntegrity)) {
LOG4CXX_WARN(logger_, "Incorrect pragma for integrity check.");
} else {
while (db_check.Next()) {
if (db_check.GetString(0).compare("ok") == 0) {
- dbms::SQLQuery check_first_run(db());
+ utils::dbms::SQLQuery check_first_run(db());
if (check_first_run.Prepare(sql_pt::kIsFirstRun) &&
check_first_run.Next()) {
LOG4CXX_INFO(logger_, "Selecting is first run "
<< check_first_run.GetBoolean(0));
if (check_first_run.GetBoolean(0)) {
- dbms::SQLQuery set_not_first_run(db());
+ utils::dbms::SQLQuery set_not_first_run(db());
set_not_first_run.Exec(sql_pt::kSetNotFirstRun);
return InitResult::SUCCESS;
}
@@ -392,7 +400,7 @@ InitResult SQLPTRepresentation::Init() {
}
}
}
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kCreateSchema)) {
LOG4CXX_ERROR(
logger_,
@@ -410,15 +418,21 @@ InitResult SQLPTRepresentation::Init() {
bool SQLPTRepresentation::Close() {
db_->Close();
- return db_->LastError().number() == dbms::OK;
+ return db_->LastError().number() == utils::dbms::OK;
}
-VehicleData SQLPTRepresentation::GetVehicleData() {
- return VehicleData();
+const VehicleInfo SQLPTRepresentation::GetVehicleInfo() const {
+ policy_table::ModuleConfig module_config;
+ GatherModuleConfig(&module_config);
+ VehicleInfo vehicle_info;
+ vehicle_info.vehicle_make = *module_config.vehicle_make;
+ vehicle_info.vehicle_model = *module_config.vehicle_model;
+ vehicle_info.vehicle_year = *module_config.vehicle_year;
+ return vehicle_info;
}
bool SQLPTRepresentation::Drop() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
LOG4CXX_WARN(logger_,
"Failed dropping database: " << query.LastError().text());
@@ -432,7 +446,7 @@ void SQLPTRepresentation::WriteDb() {
}
bool SQLPTRepresentation::Clear() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteData)) {
LOG4CXX_ERROR(logger_,
"Failed clearing database: " << query.LastError().text());
@@ -448,7 +462,7 @@ bool SQLPTRepresentation::Clear() {
}
bool SQLPTRepresentation::RefreshDB() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDropSchema)) {
LOG4CXX_WARN(logger_,
"Failed dropping database: " << query.LastError().text());
@@ -471,7 +485,7 @@ bool SQLPTRepresentation::RefreshDB() {
utils::SharedPtr<policy_table::Table>
SQLPTRepresentation::GenerateSnapshot() const {
- LOG4CXX_INFO(logger_, "GenerateSnapshot");
+ LOG4CXX_AUTO_TRACE(logger_);
utils::SharedPtr<policy_table::Table> table = new policy_table::Table();
GatherModuleMeta(&*table->policy_table.module_meta);
GatherModuleConfig(&table->policy_table.module_config);
@@ -494,7 +508,7 @@ void SQLPTRepresentation::GatherModuleMeta(
void SQLPTRepresentation::GatherModuleConfig(
policy_table::ModuleConfig* config) const {
LOG4CXX_INFO(logger_, "Gather Configuration Info");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectModuleConfig) || !query.Next()) {
LOG4CXX_WARN(logger_, "Incorrect select statement for module config");
} else {
@@ -506,19 +520,23 @@ void SQLPTRepresentation::GatherModuleConfig(
*config->vehicle_make = query.GetString(5);
*config->vehicle_model = query.GetString(6);
*config->vehicle_year = query.GetString(7);
+ *config->preloaded_date = query.GetString(8);
+ *config->certificate = query.GetString(9);
}
- dbms::SQLQuery endpoints(db());
+ utils::dbms::SQLQuery endpoints(db());
if (!endpoints.Prepare(sql_pt::kSelectEndpoints)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for endpoints");
} else {
while (endpoints.Next()) {
- config->endpoints[endpoints.GetString(1)][endpoints.GetString(2)]
+ std::stringstream stream;
+ stream << "0x0" << endpoints.GetInteger(1);
+ config->endpoints[stream.str()][endpoints.GetString(2)]
.push_back(endpoints.GetString(0));
}
}
- dbms::SQLQuery notifications(db());
+ utils::dbms::SQLQuery notifications(db());
if (!notifications.Prepare(sql_pt::kSelectNotificationsPerMin)) {
LOG4CXX_WARN(logger_, "Incorrect select statement for notifications");
} else {
@@ -527,7 +545,7 @@ void SQLPTRepresentation::GatherModuleConfig(
notifications.GetInteger(1);
}
}
- dbms::SQLQuery seconds(db());
+ utils::dbms::SQLQuery seconds(db());
if (!seconds.Prepare(sql_pt::kSelectSecondsBetweenRetries)) {
LOG4CXX_INFO(logger_,
"Incorrect select statement from seconds between retries");
@@ -541,7 +559,7 @@ void SQLPTRepresentation::GatherModuleConfig(
bool SQLPTRepresentation::GatherUsageAndErrorCounts(
policy_table::UsageAndErrorCounts* counts) const {
LOG4CXX_INFO(logger_, "Gather Usage and Error Counts.");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectAppLevels)) {
policy_table::AppLevel app_level_empty;
app_level_empty.mark_initialized();
@@ -557,7 +575,7 @@ void SQLPTRepresentation::GatherDeviceData(
LOG4CXX_INFO(logger_, "Gather device data.");
data->mark_initialized();
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (query.Prepare(sql_pt::kSelectDeviceData)) {
policy_table::DeviceParams device_data_empty;
device_data_empty.mark_initialized();
@@ -570,12 +588,12 @@ void SQLPTRepresentation::GatherDeviceData(
bool SQLPTRepresentation::GatherFunctionalGroupings(
policy_table::FunctionalGroupings* groups) const {
LOG4CXX_INFO(logger_, "Gather Functional Groupings info");
- dbms::SQLQuery func_group(db());
+ utils::dbms::SQLQuery func_group(db());
if (!func_group.Prepare(sql_pt::kSelectFunctionalGroups)) {
LOG4CXX_WARN(logger_, "Incorrect select from functional_groupings");
return false;
}
- dbms::SQLQuery rpcs(db());
+ utils::dbms::SQLQuery rpcs(db());
if (!rpcs.Prepare(sql_pt::kSelectAllRpcs)) {
LOG4CXX_WARN(logger_, "Incorrect select all from rpc");
return false;
@@ -613,7 +631,7 @@ bool SQLPTRepresentation::GatherFunctionalGroupings(
bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
policy_table::ConsumerFriendlyMessages* messages) const {
LOG4CXX_INFO(logger_, "Gather Consumer Friendly Messages");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectUserMsgsVersion) || !query.Next()) {
LOG4CXX_WARN(logger_, "Incorrect select from consumer_friendly_messages");
return false;
@@ -625,7 +643,7 @@ bool SQLPTRepresentation::GatherConsumerFriendlyMessages(
bool SQLPTRepresentation::GatherApplicationPoliciesSection(
policy_table::ApplicationPoliciesSection* policies) const {
LOG4CXX_INFO(logger_, "Gather applications policies");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppPolicies)) {
LOG4CXX_WARN(logger_, "Incorrect select from app_policies");
return false;
@@ -657,7 +675,8 @@ bool SQLPTRepresentation::GatherApplicationPoliciesSection(
params.priority = priority;
*params.memory_kb = query.GetInteger(2);
- *params.heart_beat_timeout_ms = query.GetInteger(3);
+
+ *params.heart_beat_timeout_ms = query.GetUInteger(3);
if (!query.IsNull(3)) {
*params.certificate = query.GetString(4);
}
@@ -718,13 +737,13 @@ bool SQLPTRepresentation::Save(const policy_table::Table& table) {
bool SQLPTRepresentation::SaveFunctionalGroupings(
const policy_table::FunctionalGroupings& groups) {
- dbms::SQLQuery query_delete(db());
+ utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteRpc)) {
LOG4CXX_WARN(logger_, "Incorrect delete from rpc.");
return false;
}
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteFunctionalGroup)) {
LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
return false;
@@ -765,8 +784,8 @@ bool SQLPTRepresentation::SaveFunctionalGroupings(
bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
const policy_table::Rpc& rpcs) {
- dbms::SQLQuery query(db());
- dbms::SQLQuery query_parameter(db());
+ utils::dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query_parameter(db());
if (!query.Prepare(sql_pt::kInsertRpc)
|| !query_parameter.Prepare(sql_pt::kInsertRpcWithParameter)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for rpc");
@@ -811,7 +830,7 @@ bool SQLPTRepresentation::SaveRpcs(int64_t group_id,
bool SQLPTRepresentation::SaveApplicationPoliciesSection(
const policy_table::ApplicationPoliciesSection& policies) {
- dbms::SQLQuery query_delete(db());
+ utils::dbms::SQLQuery query_delete(db());
if (!query_delete.Exec(sql_pt::kDeleteAppGroup)) {
LOG4CXX_WARN(logger_, "Incorrect delete from app_group.");
return false;
@@ -864,7 +883,7 @@ bool SQLPTRepresentation::SaveApplicationPoliciesSection(
bool SQLPTRepresentation::SaveSpecificAppPolicy(
const policy_table::ApplicationPolicies::value_type& app) {
- dbms::SQLQuery app_query(db());
+ utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement into application (device).");
return false;
@@ -874,10 +893,9 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
app_query.Bind(1, std::string(policy_table::EnumToJsonString(app.second.priority)));
app_query.Bind(2, app.second.is_null());
app_query.Bind(3, *app.second.memory_kb);
- app_query.Bind(4, *app.second.heart_beat_timeout_ms);
+ app_query.Bind(4, static_cast<int64_t>(*app.second.heart_beat_timeout_ms));
app.second.certificate.is_initialized() ?
app_query.Bind(5, *app.second.certificate) : app_query.Bind(5);
-
if (!app_query.Exec() || !app_query.Reset()) {
LOG4CXX_WARN(logger_, "Incorrect insert into application.");
return false;
@@ -912,7 +930,7 @@ bool SQLPTRepresentation::SaveSpecificAppPolicy(
bool policy::SQLPTRepresentation::SaveDevicePolicy(
const policy_table::DevicePolicy& device) {
- dbms::SQLQuery app_query(db());
+ utils::dbms::SQLQuery app_query(db());
if (!app_query.Prepare(sql_pt::kInsertApplication)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
return false;
@@ -930,16 +948,12 @@ bool policy::SQLPTRepresentation::SaveDevicePolicy(
return false;
}
- if (!SaveAppGroup(kDeviceId, device.groups)) {
- return false;
- }
-
return true;
}
bool SQLPTRepresentation::SaveAppGroup(
const std::string& app_id, const policy_table::Strings& app_groups) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppGroup)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for app group");
return false;
@@ -964,7 +978,7 @@ bool SQLPTRepresentation::SaveAppGroup(
bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
const policy_table::Strings& nicknames) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNickname)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for nickname");
return false;
@@ -985,7 +999,7 @@ bool SQLPTRepresentation::SaveNickname(const std::string& app_id,
bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
const policy_table::AppHMITypes& types) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertAppType)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for app type");
return false;
@@ -1007,7 +1021,7 @@ bool SQLPTRepresentation::SaveAppType(const std::string& app_id,
bool SQLPTRepresentation::SaveRequestType(
const std::string& app_id,
const policy_table::RequestTypes& types) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertRequestType)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for request types.");
return false;
@@ -1033,7 +1047,7 @@ bool SQLPTRepresentation::SaveModuleMeta(const policy_table::ModuleMeta& meta) {
bool SQLPTRepresentation::SaveModuleConfig(
const policy_table::ModuleConfig& config) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateModuleConfig)) {
LOG4CXX_WARN(logger_, "Incorrect update statement for module config");
return false;
@@ -1047,12 +1061,13 @@ bool SQLPTRepresentation::SaveModuleConfig(
query.Bind(2, config.exchange_after_x_kilometers);
query.Bind(3, config.exchange_after_x_days);
query.Bind(4, config.timeout_after_x_seconds);
+ query.Bind(5, (*config.certificate));
config.vehicle_make.is_initialized() ?
- query.Bind(5, *(config.vehicle_make)) : query.Bind(5);
+ query.Bind(6, *(config.vehicle_make)) : query.Bind(6);
config.vehicle_model.is_initialized() ?
- query.Bind(6, *(config.vehicle_model)) : query.Bind(6);
+ query.Bind(7, *(config.vehicle_model)) : query.Bind(7);
config.vehicle_year.is_initialized() ?
- query.Bind(7, *(config.vehicle_year)) : query.Bind(7);
+ query.Bind(8, *(config.vehicle_year)) : query.Bind(8);
if (!query.Exec()) {
LOG4CXX_WARN(logger_, "Incorrect update module config");
@@ -1077,7 +1092,7 @@ bool SQLPTRepresentation::SaveModuleConfig(
bool SQLPTRepresentation::SaveServiceEndpoints(
const policy_table::ServiceEndpoints& endpoints) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteEndpoint)) {
LOG4CXX_WARN(logger_, "Incorrect delete from endpoint.");
return false;
@@ -1118,7 +1133,7 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
// the current local consumer_friendly_messages section shall be maintained in
// the policy table. So it won't be changed/updated
if (messages.messages.is_initialized()) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteMessageString)) {
LOG4CXX_WARN(logger_, "Incorrect delete from message.");
return false;
@@ -1160,7 +1175,7 @@ bool SQLPTRepresentation::SaveConsumerFriendlyMessages(
}
bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertMessageType)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for message type.");
return false;
@@ -1176,7 +1191,7 @@ bool SQLPTRepresentation::SaveMessageType(const std::string& type) {
}
bool SQLPTRepresentation::SaveLanguage(const std::string& code) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertLanguage)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for language.");
return false;
@@ -1200,7 +1215,7 @@ bool SQLPTRepresentation::SaveMessageString(
bool SQLPTRepresentation::SaveSecondsBetweenRetries(
const policy_table::SecondsBetweenRetries& seconds) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteSecondsBetweenRetries)) {
LOG4CXX_WARN(logger_, "Incorrect delete from seconds between retries.");
return false;
@@ -1225,7 +1240,7 @@ bool SQLPTRepresentation::SaveSecondsBetweenRetries(
bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
const policy_table::NumberOfNotificationsPerMinute& notifications) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertNotificationsByPriority)) {
LOG4CXX_WARN(logger_,
"Incorrect insert statement for notifications by priority.");
@@ -1247,7 +1262,7 @@ bool SQLPTRepresentation::SaveNumberOfNotificationsPerMinute(
bool SQLPTRepresentation::SaveDeviceData(
const policy_table::DeviceData& devices) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertDeviceData)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement for device data.");
return false;
@@ -1268,7 +1283,7 @@ bool SQLPTRepresentation::SaveDeviceData(
bool SQLPTRepresentation::SaveUsageAndErrorCounts(
const policy_table::UsageAndErrorCounts& counts) {
const_cast<policy_table::UsageAndErrorCounts&>(counts).mark_initialized();
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kDeleteAppLevel)) {
LOG4CXX_WARN(logger_, "Incorrect delete from app level.");
return false;
@@ -1292,22 +1307,22 @@ bool SQLPTRepresentation::SaveUsageAndErrorCounts(
}
void SQLPTRepresentation::IncrementIgnitionCycles() {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kIncrementIgnitionCycles)) {
LOG4CXX_WARN(logger_, "Failed incrementing ignition cycles");
}
}
void SQLPTRepresentation::ResetIgnitionCycles() {
- LOG4CXX_INFO(logger_, "ResetIgnitionCycles");
- dbms::SQLQuery query(db());
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
if (!query.Exec(sql_pt::kResetIgnitionCycles)) {
LOG4CXX_WARN(logger_, "Failed to reset ignition cycles number.");
}
}
bool SQLPTRepresentation::UpdateRequired() const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectFlagUpdateRequired) || !query.Exec()) {
LOG4CXX_WARN(logger_,
"Failed select update required flag from module meta");
@@ -1317,7 +1332,7 @@ bool SQLPTRepresentation::UpdateRequired() const {
}
void SQLPTRepresentation::SaveUpdateRequired(bool value) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
// TODO(AOleynik): Quick fix, will be reworked
if (!query.Prepare(/*sql_pt::kUpdateFlagUpdateRequired*/
"UPDATE `module_meta` SET `flag_update_required` = ?")) {
@@ -1336,12 +1351,12 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
StringArray* nicknames,
StringArray* app_types) {
LOG4CXX_INFO(logger_, "Getting initial application data.");
- dbms::SQLQuery app_names(db());
+ utils::dbms::SQLQuery app_names(db());
if (!app_names.Prepare(sql_pt::kSelectNicknames)) {
LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
return false;
}
- dbms::SQLQuery app_hmi_types(db());
+ utils::dbms::SQLQuery app_hmi_types(db());
if (!app_hmi_types.Prepare(sql_pt::kSelectAppTypes)) {
LOG4CXX_WARN(logger_, "Incorrect select from app types");
return false;
@@ -1361,13 +1376,13 @@ bool SQLPTRepresentation::GetInitialAppData(const std::string& app_id,
bool SQLPTRepresentation::GetFunctionalGroupings(
policy_table::FunctionalGroupings& groups) {
- LOG4CXX_INFO(logger_, "GetFunctionalGroupings");
+ LOG4CXX_AUTO_TRACE(logger_);
return GatherFunctionalGroupings(&groups);
}
bool SQLPTRepresentation::GatherAppType(
const std::string& app_id, policy_table::AppHMITypes* app_types) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppTypes)) {
LOG4CXX_WARN(logger_, "Incorrect select from app types");
return false;
@@ -1387,7 +1402,7 @@ bool SQLPTRepresentation::GatherAppType(
bool SQLPTRepresentation::GatherRequestType(
const std::string& app_id,
policy_table::RequestTypes* request_types) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectRequestTypes)) {
LOG4CXX_WARN(logger_, "Incorrect select from request types.");
return false;
@@ -1406,7 +1421,7 @@ bool SQLPTRepresentation::GatherRequestType(
bool SQLPTRepresentation::GatherNickName(
const std::string& app_id, policy_table::Strings* nicknames) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectNicknames)) {
LOG4CXX_WARN(logger_, "Incorrect select from app nicknames");
return false;
@@ -1421,7 +1436,7 @@ bool SQLPTRepresentation::GatherNickName(
bool SQLPTRepresentation::GatherAppGroup(
const std::string& app_id, policy_table::Strings* app_groups) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectAppGroups)) {
LOG4CXX_WARN(logger_, "Incorrect select from app groups");
return false;
@@ -1438,7 +1453,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
bool is_revoked,
bool is_default,
bool is_predata) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateApplicationCustomData)) {
LOG4CXX_WARN(logger_, "Incorrect update in application");
return false;
@@ -1460,7 +1475,7 @@ bool SQLPTRepresentation::SaveApplicationCustomData(const std::string& app_id,
bool SQLPTRepresentation::IsApplicationRevoked(
const std::string& app_id) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRevoked)) {
LOG4CXX_WARN(logger_, "Incorrect select from is_revoked of application");
}
@@ -1475,7 +1490,7 @@ bool SQLPTRepresentation::IsApplicationRevoked(
}
bool SQLPTRepresentation::IsApplicationRepresented(
const std::string& app_id) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationRepresented)) {
LOG4CXX_WARN(logger_, "Incorrect select application by id");
return false;
@@ -1490,7 +1505,7 @@ bool SQLPTRepresentation::IsApplicationRepresented(
}
bool SQLPTRepresentation::IsDefaultPolicy(const std::string& app_id) const {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kSelectApplicationIsDefault)) {
LOG4CXX_WARN(logger_, "Incorrect select application by id");
return false;
@@ -1509,7 +1524,7 @@ bool SQLPTRepresentation::IsPredataPolicy(const std::string& app_id) const {
}
bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kDeleteAppGroupByApplicationId)) {
LOG4CXX_ERROR(logger_, "Incorrect statement to delete from app_group.");
return false;
@@ -1537,7 +1552,7 @@ bool SQLPTRepresentation::SetDefaultPolicy(const std::string& app_id) {
bool SQLPTRepresentation::SetIsDefault(const std::string& app_id,
bool is_default) const {
LOG4CXX_TRACE(logger_, "Set flag is_default of application");
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdateIsDefault)) {
LOG4CXX_WARN(logger_, "Incorect statement for updating is_default");
return false;
@@ -1552,9 +1567,56 @@ bool SQLPTRepresentation::SetIsDefault(const std::string& app_id,
return true;
}
-dbms::SQLDatabase* SQLPTRepresentation::db() const {
+void SQLPTRepresentation::RemoveDB() const {
+ file_system::DeleteFile(db_->get_path());
+}
+
+bool SQLPTRepresentation::IsDBVersionActual() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kSelectDBVersion) || !query.Exec()) {
+ LOG4CXX_ERROR(logger_, "Failed to get DB version: "
+ << query.LastError().text());
+ return false;
+ }
+
+ const int32_t saved_db_version = query.GetInteger(0);
+ const int32_t current_db_version = GetDBVersion();
+ LOG4CXX_DEBUG(logger_, "Saved DB version is: " << saved_db_version
+ << ". Current DB vesion is: " << current_db_version);
+
+ return current_db_version == saved_db_version;
+}
+
+bool SQLPTRepresentation::UpdateDBVersion() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+ utils::dbms::SQLQuery query(db());
+ if (!query.Prepare(sql_pt::kUpdateDBVersion)) {
+ LOG4CXX_ERROR(logger_, "Incorrect DB version query: "
+ << query.LastError().text());
+ return false;
+ }
+
+ const int32_t db_version = GetDBVersion();
+ LOG4CXX_DEBUG(logger_, "DB version will be updated to: " << db_version);
+ query.Bind(0, db_version);
+
+ if (!query.Exec()) {
+ LOG4CXX_ERROR(logger_, "DB version getting failed: "
+ << query.LastError().text());
+ return false;
+ }
+
+ return true;
+}
+
+const int32_t SQLPTRepresentation::GetDBVersion() const {
+ return utils::Djb2HashFromString(sql_pt::kCreateSchema);
+}
+
+utils::dbms::SQLDatabase* SQLPTRepresentation::db() const {
#ifdef __QNX__
- dbms::SQLDatabase* db = new dbms::SQLDatabase(kDatabaseName);
+ utils::dbms::SQLDatabase* db = new utils::dbms::SQLDatabase(kDatabaseName);
db->Open();
return db;
#else
@@ -1564,7 +1626,7 @@ dbms::SQLDatabase* SQLPTRepresentation::db() const {
bool SQLPTRepresentation::CopyApplication(const std::string& source,
const std::string& destination) {
- dbms::SQLQuery source_app(db());
+ utils::dbms::SQLQuery source_app(db());
if (!source_app.Prepare(sql_pt::kSelectApplicationFull)) {
LOG4CXX_WARN(logger_, "Incorrect select statement from application.");
return false;
@@ -1575,7 +1637,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
return false;
}
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kInsertApplicationFull)) {
LOG4CXX_WARN(logger_, "Incorrect insert statement into application.");
return false;
@@ -1607,7 +1669,7 @@ bool SQLPTRepresentation::CopyApplication(const std::string& source,
}
void SQLPTRepresentation::SetPreloaded(bool value) {
- dbms::SQLQuery query(db());
+ utils::dbms::SQLQuery query(db());
if (!query.Prepare(sql_pt::kUpdatePreloaded)) {
LOG4CXX_WARN(logger_, "Incorrect statement of updating preloaded.");
return;
diff --git a/src/components/policy/src/policy/src/update_status_manager.cc b/src/components/policy/src/policy/src/update_status_manager.cc
index e5cc74a315..2f805cbfcb 100644
--- a/src/components/policy/src/policy/src/update_status_manager.cc
+++ b/src/components/policy/src/policy/src/update_status_manager.cc
@@ -36,7 +36,7 @@
namespace policy {
-CREATE_LOGGERPTR_GLOBAL(logger_, "UpdateStatusManager")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Policy")
UpdateStatusManager::UpdateStatusManager() :
listener_(NULL),
@@ -65,7 +65,7 @@ void UpdateStatusManager::set_listener(PolicyListener* listener) {
}
void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) {
- LOG4CXX_INFO(logger_, "OnUpdateSentOut");
+ LOG4CXX_AUTO_TRACE(logger_);
DCHECK(update_status_thread_delegate_);
const unsigned milliseconds_in_second = 1000;
update_status_thread_delegate_->updateTimeOut(update_timeout *
@@ -76,7 +76,7 @@ void UpdateStatusManager::OnUpdateSentOut(uint32_t update_timeout) {
}
void UpdateStatusManager::OnUpdateTimeoutOccurs() {
- LOG4CXX_INFO(logger_, "OnUpdateTimeoutOccurs");
+ LOG4CXX_AUTO_TRACE(logger_);
set_update_required(true);
set_exchange_in_progress(false);
set_exchange_pending(false);
@@ -85,21 +85,22 @@ void UpdateStatusManager::OnUpdateTimeoutOccurs() {
}
void UpdateStatusManager::OnValidUpdateReceived() {
- LOG4CXX_INFO(logger_, "OnValidUpdateReceived");
+ LOG4CXX_AUTO_TRACE(logger_);
update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
set_exchange_pending(false);
set_exchange_in_progress(false);
}
void UpdateStatusManager::OnWrongUpdateReceived() {
- LOG4CXX_INFO(logger_, "OnWrongUpdateReceived");
+ LOG4CXX_AUTO_TRACE(logger_);
update_status_thread_delegate_->updateTimeOut(0); // Stop Timer
set_update_required(true);
set_exchange_in_progress(false);
+ set_exchange_pending(false);
}
void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {
- LOG4CXX_INFO(logger_, "OnResetDefaultPT");
+ LOG4CXX_AUTO_TRACE(logger_);
exchange_in_progress_ = false;
update_required_ = is_update_required;
exchange_pending_ = false;
@@ -107,7 +108,7 @@ void UpdateStatusManager::OnResetDefaultPT(bool is_update_required) {
}
void UpdateStatusManager::OnResetRetrySequence() {
- LOG4CXX_INFO(logger_, "OnResetRetrySequence");
+ LOG4CXX_AUTO_TRACE(logger_);
if (exchange_in_progress_) {
set_exchange_pending(true);
}
@@ -115,12 +116,12 @@ void UpdateStatusManager::OnResetRetrySequence() {
}
void UpdateStatusManager::OnNewApplicationAdded() {
- LOG4CXX_INFO(logger_, "OnNewApplicationAdded");
+ LOG4CXX_AUTO_TRACE(logger_);
set_update_required(true);
}
void UpdateStatusManager::OnPolicyInit(bool is_update_required) {
- LOG4CXX_INFO(logger_, "OnPolicyInit");
+ LOG4CXX_AUTO_TRACE(logger_);
update_required_ = is_update_required;
}
diff --git a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/app_stopwatch.h b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/app_stopwatch.h
new file mode 100644
index 0000000000..45883163c4
--- /dev/null
+++ b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/app_stopwatch.h
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
+#define SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
+
+#include "statistics_manager.h"
+
+namespace usage_statistics {
+
+class AppStopwatch {
+ public:
+ virtual ~AppStopwatch() {}
+ virtual void Start(AppStopwatchId stopwatch_type) = 0;
+ virtual void Switch(AppStopwatchId stopwatch_type) = 0;
+ virtual void WriteTime() = 0;
+};
+
+} // namespace usage_statistics
+
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_APP_STOPWATCH_H_
diff --git a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h
index 6ccfb0a426..a4bc3263da 100644
--- a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h
+++ b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/counter.h
@@ -35,64 +35,71 @@
#include <ctime>
#include "usage_statistics/statistics_manager.h"
+#include "usage_statistics/app_stopwatch.h"
#include "utils/shared_ptr.h"
-#include "utils/timer_thread.h"
+#include "utils/timer.h"
+#include "utils/macro.h"
namespace usage_statistics {
+using timer::Timer;
+
class GlobalCounter {
public:
- GlobalCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ GlobalCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
GlobalCounterId counter_type);
void operator++() const;
+
private:
GlobalCounterId counter_type_;
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_;
+ utils::SharedPtr<StatisticsManager> statistics_manager_;
};
class AppCounter {
public:
- AppCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppCounterId counter_type);
void operator++() const;
+
private:
std::string app_id_;
AppCounterId counter_type_;
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_;
+ utils::SharedPtr<StatisticsManager> statistics_manager_;
};
class AppInfo {
public:
- AppInfo(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+ AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppInfoId info_type);
void Update(const std::string& new_info) const;
+
private:
std::string app_id_;
AppInfoId info_type_;
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_;
+ utils::SharedPtr<StatisticsManager> statistics_manager_;
};
-class AppStopwatch {
+class AppStopwatchImpl : public AppStopwatch {
public:
- AppStopwatch(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
- const std::string& app_id);
- AppStopwatch(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
- const std::string& app_id,
- std::uint32_t time_out);
- ~AppStopwatch();
- void Start(AppStopwatchId stopwatch_type);
- void Switch(AppStopwatchId stopwatch_type);
- void WriteTime();
+ AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager,
+ const std::string& app_id);
+ AppStopwatchImpl(utils::SharedPtr<StatisticsManager> statistics_manager,
+ const std::string& app_id,
+ std::uint32_t timeout);
+ void Start(AppStopwatchId stopwatch_type) OVERRIDE;
+ void Switch(AppStopwatchId stopwatch_type) OVERRIDE;
+ void WriteTime() OVERRIDE;
+
private:
// Fields
std::string app_id_;
AppStopwatchId stopwatch_type_;
- utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager_;
- typedef timer::TimerThread<AppStopwatch> Timer;
- Timer* timer_;
+ utils::SharedPtr<StatisticsManager> statistics_manager_;
+ timer::Timer timer_;
const std::uint32_t time_out_;
+ DISALLOW_COPY_AND_ASSIGN(AppStopwatchImpl);
};
} // namespace usage_statistics
diff --git a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h
index 3af8f4c195..2323fa024b 100644
--- a/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h
+++ b/src/components/policy/src/policy/usage_statistics/include/usage_statistics/statistics_manager.h
@@ -1,33 +1,33 @@
/*
- 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.
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
@@ -38,16 +38,9 @@
namespace usage_statistics {
-enum GlobalCounterId {
- IAP_BUFFER_FULL,
- SYNC_OUT_OF_MEMORY,
- SYNC_REBOOTS
-};
+enum GlobalCounterId { IAP_BUFFER_FULL, SYNC_OUT_OF_MEMORY, SYNC_REBOOTS };
-enum AppInfoId {
- LANGUAGE_GUI,
- LANGUAGE_VUI
-};
+enum AppInfoId { LANGUAGE_GUI, LANGUAGE_VUI };
enum AppStopwatchId {
SECONDS_HMI_FULL,
@@ -64,7 +57,8 @@ enum AppCounterId {
REJECTED_RPC_CALLS,
RPCS_IN_HMI_NONE,
REMOVALS_MISBEHAVED,
- RUN_ATTEMPTS_WHILE_REVOKED
+ RUN_ATTEMPTS_WHILE_REVOKED,
+ COUNT_OF_TLS_ERRORS,
};
class StatisticsManager {
@@ -72,7 +66,8 @@ class StatisticsManager {
virtual ~StatisticsManager() {}
virtual void Increment(GlobalCounterId type) = 0;
virtual void Increment(const std::string& app_id, AppCounterId type) = 0;
- virtual void Set(const std::string& app_id, AppInfoId type,
+ virtual void Set(const std::string& app_id,
+ AppInfoId type,
const std::string& value) = 0;
virtual void Add(const std::string& app_id,
AppStopwatchId type,
@@ -81,4 +76,4 @@ class StatisticsManager {
} // namespace usage_statistics
-#endif // SRC_COMPONENTS_POLICY_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
+#endif // SRC_COMPONENTS_INCLUDE_POLICY_USAGE_STATISTICS_STATISTICS_MANAGER_H_
diff --git a/src/components/policy/src/policy/usage_statistics/src/counter.cc b/src/components/policy/src/policy/usage_statistics/src/counter.cc
index 070de140b3..4da0e469fc 100644
--- a/src/components/policy/src/policy/usage_statistics/src/counter.cc
+++ b/src/components/policy/src/policy/usage_statistics/src/counter.cc
@@ -33,16 +33,18 @@
#ifndef SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_
#define SRC_COMPONENTS_POLICY_INCLUDE_POLICY_STATISTICS_MANAGER_H_
-#include "usage_statistics/counter.h"
#include <cassert>
+#include "usage_statistics/counter.h"
+#include "utils/date_time.h"
+#include "utils/make_shared.h"
+#include "utils/timer_task_impl.h"
namespace usage_statistics {
-GlobalCounter::GlobalCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
- GlobalCounterId counter_type)
- : counter_type_(counter_type),
- statistics_manager_(statistics_manager) {
-}
+GlobalCounter::GlobalCounter(
+ utils::SharedPtr<StatisticsManager> statistics_manager,
+ GlobalCounterId counter_type)
+ : counter_type_(counter_type), statistics_manager_(statistics_manager) {}
void GlobalCounter::operator++() const {
if (statistics_manager_) {
@@ -50,13 +52,12 @@ void GlobalCounter::operator++() const {
}
}
-AppCounter::AppCounter(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+AppCounter::AppCounter(utils::SharedPtr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppCounterId counter_type)
- : app_id_(app_id),
- counter_type_(counter_type),
- statistics_manager_(statistics_manager) {
-}
+ : app_id_(app_id)
+ , counter_type_(counter_type)
+ , statistics_manager_(statistics_manager) {}
void AppCounter::operator++() const {
if (statistics_manager_) {
@@ -64,13 +65,12 @@ void AppCounter::operator++() const {
}
}
-AppInfo::AppInfo(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
+AppInfo::AppInfo(utils::SharedPtr<StatisticsManager> statistics_manager,
const std::string& app_id,
AppInfoId info_type)
- : app_id_(app_id),
- info_type_(info_type),
- statistics_manager_(statistics_manager) {
-}
+ : app_id_(app_id)
+ , info_type_(info_type)
+ , statistics_manager_(statistics_manager) {}
void AppInfo::Update(const std::string& new_info) const {
if (statistics_manager_) {
@@ -78,43 +78,39 @@ void AppInfo::Update(const std::string& new_info) const {
}
}
-AppStopwatch::AppStopwatch(utils::SharedPtr<usage_statistics::StatisticsManager> statistics_manager,
- const std::string& app_id)
- : app_id_(app_id),
- stopwatch_type_(SECONDS_HMI_NONE),
- statistics_manager_(statistics_manager),
- timer_(new Timer("HMI levels timer",this, &AppStopwatch::WriteTime, true)),
- time_out_(60) {
-}
-
-AppStopwatch::AppStopwatch(utils::SharedPtr<StatisticsManager> statistics_manager,
- const std::string& app_id,
- std::uint32_t time_out)
- : app_id_(app_id),
- stopwatch_type_(SECONDS_HMI_NONE),
- statistics_manager_(statistics_manager),
- timer_(new Timer("HMI levels timer",this, &AppStopwatch::WriteTime, true)),
- time_out_(time_out) {
-
-}
-
-AppStopwatch::~AppStopwatch() {
- if (NULL != timer_) {
- timer_->stop();
- delete timer_;
- }
-}
-
-void AppStopwatch::Start(AppStopwatchId stopwatch_type) {
+AppStopwatchImpl::AppStopwatchImpl(
+ utils::SharedPtr<StatisticsManager> statistics_manager,
+ const std::string& app_id)
+ : app_id_(app_id)
+ , stopwatch_type_(SECONDS_HMI_NONE)
+ , statistics_manager_(statistics_manager)
+ , timer_("HMI levels timer",
+ new timer::TimerTaskImpl<AppStopwatchImpl>(
+ this, &AppStopwatchImpl::WriteTime))
+ , time_out_(60) {}
+
+AppStopwatchImpl::AppStopwatchImpl(
+ utils::SharedPtr<StatisticsManager> statistics_manager,
+ const std::string& app_id,
+ uint32_t timeout)
+ : app_id_(app_id)
+ , stopwatch_type_(SECONDS_HMI_NONE)
+ , statistics_manager_(statistics_manager)
+ , timer_("HMI levels timer",
+ new timer::TimerTaskImpl<AppStopwatchImpl>(
+ this, &AppStopwatchImpl::WriteTime))
+ , time_out_(timeout) {}
+
+void AppStopwatchImpl::Start(AppStopwatchId stopwatch_type) {
stopwatch_type_ = stopwatch_type;
- timer_->start(time_out_);
+ timer_.Start(time_out_ * date_time::DateTime::MILLISECONDS_IN_SECOND, true);
}
-void AppStopwatch::Switch(AppStopwatchId stopwatch_type) {
+void AppStopwatchImpl::Switch(AppStopwatchId stopwatch_type) {
Start(stopwatch_type);
}
-void AppStopwatch::WriteTime() {
+void AppStopwatchImpl::WriteTime() {
if (statistics_manager_) {
statistics_manager_->Add(app_id_, stopwatch_type_, time_out_);
}
diff --git a/src/components/policy/test/CMakeLists.txt b/src/components/policy/test/CMakeLists.txt
index d23a50e7fe..a511a71f20 100644
--- a/src/components/policy/test/CMakeLists.txt
+++ b/src/components/policy/test/CMakeLists.txt
@@ -30,16 +30,17 @@
include_directories(
include
+ ${COMPONENTS_DIR}
${GMOCK_INCLUDE_DIRECTORY}
${JSONCPP_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/policy/src/policy/include/
- ${COMPONENTS_DIR}/policy/src/policy/sqlite_wrapper/include
- ${COMPONENTS_DIR}/policy/src/policy/qdb_wrapper/include
${COMPONENTS_DIR}/policy/src/policy/usage_statistics/include
${COMPONENTS_DIR}/rpc_base/include
${COMPONENTS_DIR}/config_profile/include
${COMPONENTS_DIR}/utils/include/
+ ${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct
${COMPONENTS_DIR}/policy/src/policy/policy_table/
+ ${COMPONENTS_DIR}/policy/test/include/
)
set(testLibraries
@@ -50,46 +51,31 @@ set(testLibraries
)
set(testSources
- usage_statistics_test.cc
- shared_library_test.cc
- generated_code_test.cc
- #policy_manager_impl_test.cc
+ counter_test.cc
+ shared_library_test.cc
+ generated_code_test.cc
+ policy_manager_impl_test.cc
+ update_status_manager_test.cc
)
- include_directories(${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct)
- list (APPEND testSources
- sql_pt_representation_test.cc
- )
-
-if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
- list(REMOVE_ITEM testLibraries dl)
- # --- Tests for QDB Wrapper
- include_directories(../src/policy/qdb_wrapper/include)
- list (APPEND testSources
- qdb_wrapper/sql_database_test.cc
- qdb_wrapper/sql_query_test.cc
- )
- file(COPY qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
- file(COPY test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
- file(COPY policy.sql DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-else ()
- # --- Tests for SQLite Wrapper
- find_package(Sqlite3 REQUIRED)
- include_directories(../src/policy/sqlite_wrapper/include)
- list (APPEND testSources
- sqlite_wrapper/sql_database_test.cc
- sqlite_wrapper/sql_query_test.cc
- generated_code_with_sqlite_test.cc
-
- # TODO{ALeshin} AssertTrue in SetUpTestCase() return false
- #policy_manager_impl_stress_test.cc
- )
- list (APPEND testLibraries sqlite3)
-endif()
+list (APPEND testSources
+ sql_pt_representation_test.cc
+)
create_test("policy_test" "${testSources}" "${testLibraries}")
file(COPY valid_sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY PTU.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY PTU2.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY PTU3.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY PTU4.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY ptu_requestType.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY ptu2_requestType.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY smartDeviceLink.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY smartDeviceLink2.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY smartDeviceLink3.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY sdl_pt_first_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY sdl_pt_second_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/components/policy/test/PTU.json b/src/components/policy/test/PTU.json
new file mode 100644
index 0000000000..a200667e54
--- /dev/null
+++ b/src/components/policy/test/PTU.json
@@ -0,0 +1,1949 @@
+ {
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-12-08",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [1,
+ 5,
+ 25,
+ 125,
+ 625],
+ "endpoints": {
+ "0x07": {
+ "default": ["http://policies.telematics.ford.com/api/policies"]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.019",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?"
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?"
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push"
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["Base-4"],
+ "RequestType": [
+ "HTTP",
+ "FILE_RESUME"
+ ]
+ },
+ "1234": "default",
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["DataConsent-2"]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ }
+ }
+ }
+ }
+
diff --git a/src/components/policy/test/PTU2.json b/src/components/policy/test/PTU2.json
new file mode 100644
index 0000000000..4062e94516
--- /dev/null
+++ b/src/components/policy/test/PTU2.json
@@ -0,0 +1,1953 @@
+ {
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-12-08",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [1,
+ 5,
+ 25,
+ 125,
+ 625],
+ "endpoints": {
+ "0x07": {
+ "default": ["http://policies.telematics.ford.com/api/policies"]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.019",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?"
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?"
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push"
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["Base-4"]
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["DataConsent-2"]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"]
+ },
+ "1234": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"],
+ "RequestType": [
+ "TRAFFIC_MESSAGE_CHANNEL",
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY",
+ "NAVIGATION",
+ "MEDIA"
+ ]
+ }
+ }
+ }
+ }
diff --git a/src/components/policy/test/PTU3.json b/src/components/policy/test/PTU3.json
new file mode 100644
index 0000000000..812fbfd36a
--- /dev/null
+++ b/src/components/policy/test/PTU3.json
@@ -0,0 +1,1951 @@
+ {
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-12-08",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [1,
+ 5,
+ 25,
+ 125,
+ 625],
+ "endpoints": {
+ "0x07": {
+ "default": ["http://policies.telematics.ford.com/api/policies"]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.019",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?"
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?"
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push"
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["Base-4"],
+ "RequestType": [
+ "HTTP",
+ "FILE_RESUMED",
+ "INVALID_REQUEST_TYPE"
+ ]
+ },
+ "1234": "default",
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["DataConsent-2"]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY",
+ "INVALID_REQUEST_TYPE"
+ ]
+ }
+ }
+ }
+ }
+
diff --git a/src/components/policy/test/PTU4.json b/src/components/policy/test/PTU4.json
new file mode 100644
index 0000000000..ab4c2f8927
--- /dev/null
+++ b/src/components/policy/test/PTU4.json
@@ -0,0 +1,1954 @@
+ {
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-12-08",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [1,
+ 5,
+ 25,
+ 125,
+ 625],
+ "endpoints": {
+ "0x07": {
+ "default": ["http://policies.telematics.ford.com/api/policies"]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "AddSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Alert": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GenericResponse": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnButtonPress": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "OnCommand": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PerformInteraction": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": ["FULL"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "Show": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "Slider": {
+ "hmi_levels": ["FULL"]
+ },
+ "Speak": {
+ "hmi_levels": ["FULL",
+ "LIMITED"]
+ },
+ "SubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["gps",
+ "speed"]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": ["BACKGROUND"]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "GetDTCs": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ReadDID": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "OnVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"],
+ "parameters": ["airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED"]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "DeleteFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "ListFiles": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHashChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "PutFile": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetAppIcon": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "SystemRequest": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": ["BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.019",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?"
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible"
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\n\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\n\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. /r Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements. /r Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. See your Owner Guide for more information."
+ },
+ "es-en": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?"
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push"
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app authorization information for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["Base-4"]
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["DataConsent-2"]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"]
+ },
+ "1234": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": ["BaseBeforeDataConsent"],
+ "RequestType": [
+ "TRAFFIC_MESSAGE_CHANNEL",
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY",
+ "NAVIGATION",
+ "MEDIA",
+ "INVALID_REQUEST_TYPE"
+ ]
+ }
+ }
+ }
+ }
diff --git a/src/components/policy/test/usage_statistics_test.cc b/src/components/policy/test/counter_test.cc
index be9d9ff81f..4644754582 100644
--- a/src/components/policy/test/usage_statistics_test.cc
+++ b/src/components/policy/test/counter_test.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, Ford Motor Company
+/* Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,7 +28,8 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "gtest/gtest.h"
+
+#include "gmock/gmock.h"
#include "mock_statistics_manager.h"
#include "usage_statistics/counter.h"
@@ -36,8 +37,11 @@
using ::testing::StrictMock;
using ::testing::InSequence;
-namespace usage_statistics {
namespace test {
+namespace components {
+namespace usage_statistics_test {
+
+using namespace usage_statistics;
// TEST(A, B_C_D) { ... }
// A - What you test
@@ -46,151 +50,131 @@ namespace test {
// D - Expected result
TEST(StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) {
- //Arrange
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
GlobalCounter reboots_counter(msm, SYNC_REBOOTS);
- //Assert
+ // Assert
EXPECT_CALL(*msm, Increment(SYNC_REBOOTS));
- //Act
+ // Act
++reboots_counter;
}
TEST(StatisticsManagerIncrementMethod1Arg, GlobalCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) {
- //Arrange
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
GlobalCounter reboots_counter(msm, SYNC_REBOOTS);
- //Assert
+ // Assert
EXPECT_CALL(*msm, Increment(SYNC_REBOOTS)).Times(2);
- //Act
+ // Act
++reboots_counter;
++reboots_counter;
}
TEST(StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallONCE_StatisticsManagerIncrementCalledONCE) {
- //Arrange
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS);
- //Assert
+ // Assert
EXPECT_CALL(*msm, Increment("HelloApp", USER_SELECTIONS));
- //Act
+ // Act
++user_selections_counter;
}
TEST(StatisticsManagerIncrementMethod2Args, AppCounterOverloadedIncrement_CallTWICE_StatisticsManagerIncrementCalledTWICE) {
- //Arrange
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
AppCounter user_selections_counter(msm, "HelloApp", USER_SELECTIONS);
- //Assert
+ // Assert
EXPECT_CALL(*msm, Increment("HelloApp", USER_SELECTIONS)).Times(2);
- //Act
+ // Act
++user_selections_counter;
++user_selections_counter;
}
//---
TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallONCE_StatisticsManagerSetMethodCalledONCE) {
- //Arrange
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI);
- //Assert
+ // Assert
EXPECT_CALL(*msm, Set("HelloApp", LANGUAGE_GUI, "Klingon"));
- //Act
+ // Act
gui_language_info.Update("Klingon");
}
TEST(StatisticsManagerSetMethod, AppInfoUpdateMethod_CallTWICE_StatisticsManagerSetMethodCalledTWICE) {
- //Arrange
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
AppInfo gui_language_info(msm, "HelloApp", LANGUAGE_GUI);
- //Assert
+ // Assert
EXPECT_CALL(*msm, Set("HelloApp", LANGUAGE_GUI, "Klingon"));
EXPECT_CALL(*msm, Set("HelloApp", LANGUAGE_GUI, "UA"));
- //Act
+ // Act
gui_language_info.Update("Klingon");
gui_language_info.Update("UA");
}
-TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) {
- //Arrange
+TEST(StatisticsManagerAddMethod, AppStopwatchStartMethod_CallONCE_StatisticsManagerAddMethodCalledONCE) {
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
const std::uint32_t time_out = 1;
- AppStopwatch hmi_full_stopwatch(msm, "HelloApp", time_out);
-
- //Assert
- EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 0));
+ AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out);
- //Act
hmi_full_stopwatch.Start(SECONDS_HMI_FULL);
-}
-
-TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchStartMethod_Call_StatisticsManagerAddMethodCALLED) {
- //Arrange
+ // Assert
+ EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, time_out));
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
- const std::uint32_t time_out = 1;
- AppStopwatch hmi_full_stopwatch(msm, "HelloApp", time_out);
-
- //Assert
- EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 0));
-
- //Act
- hmi_full_stopwatch.Start(SECONDS_HMI_FULL);
- sleep(2);
+ // Act
+ hmi_full_stopwatch.WriteTime();
}
-TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCALLED) {
- //Arrange
+TEST(StatisticsManagerAddMethod, AppStopwatchSwitchMethod_Call_StatisticsManagerAddMethodCalled) {
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
- AppStopwatch hmi_full_stopwatch(msm, "HelloApp");
+ AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp");
hmi_full_stopwatch.Start(SECONDS_HMI_FULL);
- //Assert
- EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 0)).Times(2); // Once in stop(), once in destructor
-
- //Act
hmi_full_stopwatch.Switch(SECONDS_HMI_FULL);
-}
+ // Assert
+ EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 60));
-TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchStartMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) {
- //Arrange
- MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
- AppStopwatch hmi_full_stopwatch(msm, "HelloApp");
+ // Act
+ hmi_full_stopwatch.WriteTime();
- //Assert
- EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_FULL, 1));
-
- //Act
- hmi_full_stopwatch.Start(SECONDS_HMI_FULL);
- sleep(1);
}
-
-TEST(StatisticsManagerAddMethod, DISABLED_AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) {
- //Arrange
+TEST(StatisticsManagerAddMethod, AppStopwatchSwitchMethod_CallAnd1SecSleepAfter_StatisticsManagerAddMethodCalledWith1SecTimespan) {
+ // Arrange
MockStatisticsManager* msm = new StrictMock<MockStatisticsManager>();
const std::uint32_t time_out = 1;
- AppStopwatch hmi_full_stopwatch(msm, "HelloApp", time_out);
-
- //Assert
- EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_NONE, 0));
- EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_BACKGROUND, 1));
+ AppStopwatchImpl hmi_full_stopwatch(msm, "HelloApp", time_out);
- //Act
+ // Act
hmi_full_stopwatch.Start(SECONDS_HMI_NONE);
+ // Assert
+ EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_NONE, time_out));
+ // Act
+ hmi_full_stopwatch.WriteTime();
+
hmi_full_stopwatch.Switch(SECONDS_HMI_BACKGROUND);
- sleep(2);
+ // Assert
+ EXPECT_CALL(*msm, Add("HelloApp", SECONDS_HMI_BACKGROUND, time_out));
+ // Act
+ hmi_full_stopwatch.WriteTime();
}
+
+} // namespace usage_statistics_test
+} // namespace components
} // namespace test
-} // namespace usage_statistics
diff --git a/src/components/policy/test/generated_code_test.cc b/src/components/policy/test/generated_code_test.cc
index 5b590ce46c..52bf4c639b 100644
--- a/src/components/policy/test/generated_code_test.cc
+++ b/src/components/policy/test/generated_code_test.cc
@@ -35,8 +35,8 @@
#include "json/reader.h"
#include "json/value.h"
-#include "./enums.h"
-#include "./types.h"
+#include "table_struct/enums.h"
+#include "table_struct/types.h"
#include "rpc_base/gtest_support.h"
using rpc::policy_table_interface_base::Table;
@@ -45,8 +45,7 @@ namespace test {
namespace components {
namespace policy {
-TEST(PolicyGeneratedCodeTest, DISABLED_TestValidPTPreloadJsonIsValid) {
- // TODO(AGaliuzov) APPLINK-10657 neet to enable this tests
+TEST(PolicyGeneratedCodeTest, TestValidPTPreloadJsonIsValid) {
std::ifstream json_file("sdl_preloaded_pt.json");
ASSERT_TRUE(json_file.is_open());
Json::Value valid_table;
@@ -57,8 +56,7 @@ TEST(PolicyGeneratedCodeTest, DISABLED_TestValidPTPreloadJsonIsValid) {
ASSERT_RPCTYPE_VALID(table);
}
-TEST(PolicyGeneratedCodeTest, DISABLED_TestValidPTUpdateJsonIsValid) {
- // TODO(AGaliuzov) APPLINK-10657 neet to enable this tests
+TEST(PolicyGeneratedCodeTest, TestValidPTUpdateJsonIsValid) {
std::ifstream json_file("valid_sdl_pt_update.json");
ASSERT_TRUE(json_file.is_open());
Json::Value valid_table;
diff --git a/src/components/policy/test/include.cmake b/src/components/policy/test/include.cmake
index 0474df54dc..0c23af00b0 100644
--- a/src/components/policy/test/include.cmake
+++ b/src/components/policy/test/include.cmake
@@ -58,8 +58,8 @@ list(APPEND testSources
# ${POLICY_DIR}/test/shared_library_test.cc
)
- include_directories(${POLICY_DIR}/src/policy/policy_table/table_struct)
- list (APPEND testSources ${POLICY_DIR}/test/sql_pt_representation_test.cc)
+include_directories(${POLICY_DIR}/src/policy/policy_table/table_struct_ext)
+list (APPEND testSources ${POLICY_DIR}/test/sql_pt_ext_representation_test.cc)
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
list(REMOVE_ITEM test_exec_libraries dl)
@@ -86,4 +86,4 @@ else ()
endif()
file(COPY ${POLICY_DIR}/test/valid_sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${POLICY_DIR}/test/sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) \ No newline at end of file
+file(COPY ${POLICY_DIR}/test/sdl_preloaded_pt.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/components/policy/test/include/mock_app_stopwatch.h b/src/components/policy/test/include/mock_app_stopwatch.h
new file mode 100644
index 0000000000..317649a8bb
--- /dev/null
+++ b/src/components/policy/test/include/mock_app_stopwatch.h
@@ -0,0 +1,54 @@
+/* Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_
+
+#include "gmock/gmock.h"
+#include "usage_statistics/app_stopwatch.h"
+#include "usage_statistics/statistics_manager.h"
+
+namespace test {
+namespace components {
+namespace usage_statistics_test {
+
+class MockAppStopwatch : public usage_statistics::AppStopwatch {
+ public:
+ MOCK_METHOD1(Start, void(usage_statistics::AppStopwatchId stopwatch_type));
+ MOCK_METHOD1(Switch, void(usage_statistics::AppStopwatchId stopwatch_type));
+ MOCK_METHOD0(WriteTime, void());
+};
+
+} // namespace usage_statistics_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_APP_STOPWATCH_H_
diff --git a/src/components/policy/test/include/mock_cache_manager.h b/src/components/policy/test/include/mock_cache_manager.h
index 0494eae4f4..70fdbea3b1 100644
--- a/src/components/policy/test/include/mock_cache_manager.h
+++ b/src/components/policy/test/include/mock_cache_manager.h
@@ -55,7 +55,7 @@ class MockCacheManagerInterface : public CacheManagerInterface {
MOCK_METHOD1(KilometersBeforeExchange,
int(int current));
MOCK_METHOD2(SetCountersPassedForSuccessfulUpdate,
- bool(int kilometers, int days_after_epoch));
+ bool(Counters counter, int value));
MOCK_METHOD1(DaysBeforeExchange,
int(int current));
MOCK_METHOD0(IncrementIgnitionCycles,
@@ -66,20 +66,22 @@ class MockCacheManagerInterface : public CacheManagerInterface {
int());
MOCK_METHOD1(SecondsBetweenRetries,
bool(std::vector<int> &seconds));
- MOCK_METHOD0(GetVehicleData,
- VehicleData());
+ MOCK_CONST_METHOD0(GetVehicleInfo,
+ const VehicleInfo());
MOCK_METHOD1(SetVINValue,
bool(const std::string& value));
MOCK_METHOD2(GetUserFriendlyMsg,
std::vector<UserFriendlyMessage>(const std::vector<std::string>& msg_codes, const std::string& language));
+ MOCK_METHOD2(GetUpdateUrls,
+ void(int service_type, EndpointUrls& end_points));
+ MOCK_METHOD1(GetNotificationsNumber,
+ policy_table::NumberOfNotificationsType(const std::string& priority));
+ MOCK_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id, std::string& priority));
MOCK_METHOD2(GetServiceUrls,
void(const std::string& service_type, EndpointUrls& end_points));
MOCK_CONST_METHOD0(GetLockScreenIconUrl,
std::string());
- MOCK_METHOD1(GetNotificationsNumber,
- int(const std::string& priority));
- MOCK_METHOD2(GetPriority,
- bool(const std::string& policy_app_id, std::string& priority));
MOCK_METHOD1(Init,
bool(const std::string& file_name));
MOCK_METHOD0(GenerateSnapshot,
@@ -122,6 +124,8 @@ class MockCacheManagerInterface : public CacheManagerInterface {
bool(const std::string& device_id, const std::string& app_id, FunctionalIdType &group_types));
MOCK_METHOD2(GetDeviceGroupsFromPolicies,
bool(rpc::policy_table_interface_base::Strings &groups, rpc::policy_table_interface_base::Strings &preconsented_groups));
+ MOCK_METHOD2(AddDevice,
+ bool(const std::string& device_id, const std::string& connection_type));
MOCK_METHOD8(SetDeviceData,
bool(const std::string& device_id, const std::string& hardware, const std::string& firmware, const std::string& os, const std::string& os_version, const std::string& carrier, const uint32_t number_of_ports, const std::string& connection_type));
MOCK_METHOD3(SetUserPermissionsForDevice,
@@ -170,12 +174,12 @@ class MockCacheManagerInterface : public CacheManagerInterface {
bool(const std::string& file_name));
MOCK_METHOD0(LoadFromBackup,
bool());
- MOCK_METHOD1(LoadFromFile,
- bool(const std::string& file_name));
+ MOCK_METHOD2(LoadFromFile,
+ bool(const std::string& file_name, policy_table::Table&));
MOCK_METHOD0(Backup,
void());
MOCK_CONST_METHOD1(HeartBeatTimeout,
- uint16_t(const std::string& app_id));
+ uint32_t(const std::string& app_id));
MOCK_CONST_METHOD2(GetAppRequestTypes,
void(const std::string& policy_app_id,
std::vector<std::string>& request_types));
@@ -187,7 +191,9 @@ class MockCacheManagerInterface : public CacheManagerInterface {
void(const std::string& device_id, const std::string& policy_app_id, const policy::Permissions& permissions));
MOCK_METHOD3(IsPermissionsCalculated,
bool(const std::string& device_id, const std::string& policy_app_id, policy::Permissions& permission));
- MOCK_CONST_METHOD0(RemoteAppsUrl, std::string());
+ MOCK_CONST_METHOD0(GetPT, utils::SharedPtr<policy_table::Table>());
+ MOCK_CONST_METHOD0(GetCertificate, std::string());
+ MOCK_METHOD1(SetDecryptedCertificate, void(const std::string&));
};
} // namespace policy
diff --git a/src/components/policy/test/include/mock_policy_listener.h b/src/components/policy/test/include/mock_policy_listener.h
index 6cbca0557a..8a50ad62fc 100644
--- a/src/components/policy/test/include/mock_policy_listener.h
+++ b/src/components/policy/test/include/mock_policy_listener.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, Ford Motor Company
+/* Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -32,19 +32,21 @@
#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_LISTENER_H_
#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_LISTENER_H_
-
#include <string>
#include "gmock/gmock.h"
#include "policy/policy_listener.h"
#include "rpc_base/rpc_base.h"
-#include "./types.h"
+#include "table_struct/types.h"
+#include "utils/custom_string.h"
namespace policy_table = ::rpc::policy_table_interface_base;
namespace policy {
+namespace custom_str = utils::custom_string;
+
class MockPolicyListener : public PolicyListener {
public:
MOCK_METHOD3(OnPermissionsUpdated,
@@ -56,30 +58,22 @@ class MockPolicyListener : public PolicyListener {
const Permissions& permissions));
MOCK_METHOD1(OnPendingPermissionChange,
void(const std::string& policy_app_id));
- MOCK_METHOD1(OnUpdateStatusChanged,
- void(const std::string& status));
+ MOCK_METHOD1(OnUpdateStatusChanged, void(const std::string& status));
MOCK_METHOD1(OnCurrentDeviceIdUpdateRequired,
std::string(const std::string& policy_app_id));
- MOCK_METHOD0(OnSystemInfoUpdateRequired,
- void());
+ MOCK_METHOD0(OnSystemInfoUpdateRequired, void());
MOCK_METHOD1(GetAppName,
- std::string(const std::string& policy_app_id));
- MOCK_METHOD0(OnUserRequestedUpdateCheckRequired,
- void());
+ custom_str::CustomString(const std::string& policy_app_id));
+ MOCK_METHOD0(OnUserRequestedUpdateCheckRequired, void());
MOCK_METHOD2(OnDeviceConsentChanged,
- void(const std::string& device_id,
- bool is_allowed));
- MOCK_METHOD1(OnUpdateHMIAppType,
- void(std::map<std::string, StringArray>));
- MOCK_METHOD1(GetAvailableApps,
- void(std::queue<std::string>&));
- MOCK_METHOD3(OnSnapshotCreated,
- void(const BinaryMessage& pt_string,
- const std::vector<int>& retry_seconds,
- int timeout_exceed));
- MOCK_METHOD0(CanUpdate,
- bool());
- MOCK_METHOD1(OnCertificateUpdated, void (const std::string&));
+ void(const std::string& device_id, bool is_allowed));
+ MOCK_METHOD1(OnUpdateHMIAppType, void(std::map<std::string, StringArray>));
+ MOCK_METHOD1(GetAvailableApps, void(std::queue<std::string>&));
+ MOCK_METHOD1(OnSnapshotCreated, void(const BinaryMessage& pt_string));
+ MOCK_METHOD0(CanUpdate, bool());
+ MOCK_METHOD1(OnCertificateUpdated, void(const std::string&));
+ MOCK_CONST_METHOD2(SendOnAppPermissionsChanged,
+ void(const AppPermissions&, const std::string&));
};
} // namespace policy
diff --git a/src/components/policy/test/include/mock_policy_manager.h b/src/components/policy/test/include/mock_policy_manager.h
new file mode 100644
index 0000000000..c2f9a4b6ea
--- /dev/null
+++ b/src/components/policy/test/include/mock_policy_manager.h
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_MANAGER_H_
+#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_MANAGER_H_
+
+#include <string>
+#include <vector>
+#include "gmock/gmock.h"
+#include "policy/policy_listener.h"
+#include "policy/policy_types.h"
+#include "usage_statistics/statistics_manager.h"
+
+#include "rpc_base/rpc_base.h"
+#include "./types.h"
+
+namespace policy_table = ::rpc::policy_table_interface_base;
+
+namespace policy_manager {
+
+using namespace policy;
+
+class MockPolicyManager : public PolicyManager {
+ public:
+ MOCK_METHOD1(set_listener, void(PolicyListener* listener));
+ MOCK_METHOD1(InitPT, bool(const std::string& file_name));
+ MOCK_METHOD2(LoadPT,
+ bool(const std::string& file, const BinaryMessage& pt_content));
+ MOCK_METHOD1(ResetPT, bool(const std::string& file_name));
+ MOCK_CONST_METHOD1(GetUpdateUrl, std::string(int service_type));
+ MOCK_METHOD2(GetUpdateUrls, void(int service_type, EndpointUrls& end_points));
+ MOCK_METHOD0(RequestPTUpdate, bool());
+ MOCK_METHOD5(CheckPermissions,
+ void(const PTString& app_id, const PTString& hmi_level,
+ const PTString& rpc, const RPCParams& rpc_params,
+ CheckPermissionResult& result));
+ MOCK_METHOD0(ResetUserConsent, bool());
+ MOCK_CONST_METHOD0(GetPolicyTableStatus, std::string());
+ MOCK_METHOD1(KmsChanged, void(int kilometers));
+ MOCK_METHOD0(IncrementIgnitionCycles, void());
+ MOCK_METHOD0(ForcePTExchange, std::string());
+ MOCK_METHOD0(ResetRetrySequence, void());
+ MOCK_METHOD0(NextRetryTimeout, int());
+ MOCK_METHOD0(TimeoutExchange, int());
+ MOCK_METHOD0(RetrySequenceDelaysSeconds, const std::vector<int>());
+ MOCK_METHOD0(OnExceededTimeout, void());
+ MOCK_METHOD0(OnUpdateStarted, void());
+ MOCK_METHOD1(GetUserConsentForDevice,
+ DeviceConsent(const std::string& device_id));
+ MOCK_METHOD3(GetUserConsentForApp,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<policy::FunctionalGroupPermission>& permissions));
+ MOCK_METHOD2(SetUserConsentForDevice,
+ void(const std::string& device_id, bool is_allowed));
+ MOCK_METHOD2(ReactOnUserDevConsentForApp,
+ bool(const std::string app_id, bool is_device_allowed));
+ MOCK_METHOD2(PTUpdatedAt, void(policy::Counters counter, int value));
+
+ MOCK_METHOD3(GetInitialAppData,
+ bool(const std::string&, policy::StringArray*, policy::StringArray*));
+
+ MOCK_METHOD2(AddDevice, void(const std::string& device_id,
+ const std::string& connection_type));
+ MOCK_METHOD2(SetDeviceInfo, void(const std::string& device_id,
+ const policy::DeviceInfo& device_info));
+ MOCK_METHOD1(SetUserConsentForApp,
+ void(const policy::PermissionConsent& permissions));
+ MOCK_METHOD2(GetDefaultHmi, bool(const std::string& policy_app_id,
+ std::string* default_hmi));
+ MOCK_METHOD2(GetPriority,
+ bool(const std::string& policy_app_id, std::string* priority));
+ MOCK_METHOD2(GetUserFriendlyMessages,
+ std::vector<policy::UserFriendlyMessage>(
+ const std::vector<std::string>& message_code,
+ const std::string& language));
+ MOCK_CONST_METHOD1(IsApplicationRevoked, bool(const std::string& app_id));
+ MOCK_METHOD3(GetPermissionsForApp,
+ void(const std::string& device_id,
+ const std::string& policy_app_id,
+ std::vector<policy::FunctionalGroupPermission>& permissions));
+ MOCK_METHOD1(GetAppPermissionsChanges,
+ policy::AppPermissions(const std::string& policy_app_id));
+ MOCK_METHOD1(RemovePendingPermissionChanges, void(const std::string& app_id));
+ MOCK_METHOD1(GetCurrentDeviceId,
+ std::string&(const std::string& policy_app_id));
+ MOCK_METHOD1(SetSystemLanguage, void(const std::string& language));
+ MOCK_METHOD3(SetSystemInfo, void(const std::string& ccpu_version,
+ const std::string& wers_country_code,
+ const std::string& language));
+ MOCK_METHOD1(SendNotificationOnPermissionsUpdated,
+ void(const std::string& application_id));
+ MOCK_METHOD1(MarkUnpairedDevice, void(const std::string& device_id));
+ MOCK_METHOD1(AddApplication, void(const std::string& application_id));
+ MOCK_METHOD0(CleanupUnpairedDevices, bool());
+ MOCK_METHOD1(CanAppKeepContext, bool(const std::string& app_id));
+ MOCK_METHOD1(CanAppStealFocus, bool(const std::string& app_id));
+ MOCK_METHOD0(OnSystemReady, void());
+ MOCK_METHOD1(GetNotificationsNumber, uint32_t(const std::string& priority));
+ MOCK_METHOD1(SetVINValue, void(const std::string& value));
+ MOCK_METHOD1(IsPredataPolicy, bool(const std::string& policy_app_id));
+ MOCK_CONST_METHOD1(HeartBeatTimeout, uint32_t(const std::string& app_id));
+ MOCK_METHOD1(SaveUpdateStatusRequired, void(bool is_update_needed));
+ MOCK_METHOD0(OnAppsSearchStarted, void());
+ MOCK_METHOD0(OnAppsSearchCompleted, void());
+ MOCK_METHOD1(OnAppRegisteredOnMobile,
+ void(const std::string& application_id));
+ MOCK_CONST_METHOD1(GetAppRequestTypes, const std::vector<std::string>(
+ const std::string policy_app_id));
+ MOCK_CONST_METHOD0(GetVehicleInfo, const policy::VehicleInfo());
+ MOCK_CONST_METHOD0(RetrieveCertificate, std::string());
+ MOCK_METHOD1 (SetDecryptedCertificate, void(const std::string&));
+ MOCK_METHOD0(ExceededIgnitionCycles, bool());
+ MOCK_METHOD0(ExceededDays, bool());
+ MOCK_METHOD0(StartPTExchange, void());
+ MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
+ MOCK_METHOD2(Increment, void(const std::string& app_id,
+ usage_statistics::AppCounterId type));
+ MOCK_METHOD3(Set,
+ void(const std::string& app_id, usage_statistics::AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add, void(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds));
+};
+
+} // namespace policy_manager
+
+#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_POLICY_MANAGER_H_
diff --git a/src/components/policy/test/include/mock_pt_ext_representation.h b/src/components/policy/test/include/mock_pt_ext_representation.h
index fd779dc1f0..17a46cb0f6 100644
--- a/src/components/policy/test/include/mock_pt_ext_representation.h
+++ b/src/components/policy/test/include/mock_pt_ext_representation.h
@@ -40,7 +40,7 @@
#include "policy/pt_ext_representation.h"
#include "rpc_base/rpc_base.h"
-#include "./types.h"
+#include "table_struct/types.h"
#include "mock_pt_representation.h"
namespace policy_table = ::rpc::policy_table_interface_base;
diff --git a/src/components/policy/test/include/mock_pt_representation.h b/src/components/policy/test/include/mock_pt_representation.h
index 720c646aba..ad70155af7 100644
--- a/src/components/policy/test/include/mock_pt_representation.h
+++ b/src/components/policy/test/include/mock_pt_representation.h
@@ -39,7 +39,7 @@
#include "policy/pt_representation.h"
#include "rpc_base/rpc_base.h"
-#include "./types.h"
+#include "table_struct/types.h"
namespace policy_table = ::rpc::policy_table_interface_base;
@@ -72,8 +72,8 @@ class MockPTRepresentation : virtual public PTRepresentation {
bool(std::vector<int>* seconds));
MOCK_METHOD2(GetPriority,
bool(const std::string& app_id, std::string* priority));
- MOCK_METHOD0(GetVehicleData,
- VehicleData());
+ MOCK_CONST_METHOD0(GetVehicleInfo,
+ const VehicleInfo());
MOCK_METHOD1(SetVINValue,
bool(const std::string& value));
MOCK_METHOD2(GetUserFriendlyMsg,
diff --git a/src/components/policy/test/include/mock_statistics_manager.h b/src/components/policy/test/include/mock_statistics_manager.h
index 2de072f095..86d944468e 100644
--- a/src/components/policy/test/include/mock_statistics_manager.h
+++ b/src/components/policy/test/include/mock_statistics_manager.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2013, Ford Motor Company
+/* Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -28,31 +28,36 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_STATISTICS_MANAGER_H_
-#define SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_STATISTICS_MANAGER_H_
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_STATISTICS_MANAGER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_STATISTICS_MANAGER_H_
#include <string>
#include "gmock/gmock.h"
-
#include "usage_statistics/statistics_manager.h"
-namespace usage_statistics {
namespace test {
+namespace components {
+namespace usage_statistics_test {
-class MockStatisticsManager: public StatisticsManager {
+class MockStatisticsManager : public usage_statistics::StatisticsManager {
public:
- MOCK_METHOD1(Increment, void(GlobalCounterId type));
- MOCK_METHOD2(Increment, void(const std::string& app_id, AppCounterId type));
- MOCK_METHOD3(Set, void(const std::string& app_id,
- AppInfoId type,
- const std::string& value));
- MOCK_METHOD3(Add, void(const std::string& app_id,
- AppStopwatchId type,
- int32_t timespan_seconds));
+ MOCK_METHOD1(Increment, void(usage_statistics::GlobalCounterId type));
+ MOCK_METHOD2(Increment,
+ void(const std::string& app_id,
+ usage_statistics::AppCounterId type));
+ MOCK_METHOD3(Set,
+ void(const std::string& app_id,
+ usage_statistics::AppInfoId type,
+ const std::string& value));
+ MOCK_METHOD3(Add,
+ void(const std::string& app_id,
+ usage_statistics::AppStopwatchId type,
+ int32_t timespan_seconds));
};
+} // namespace usage_statistics_test
+} // namespace components
} // namespace test
-} // namespace usage_statistics
-#endif // SRC_COMPONENTS_POLICY_TEST_POLICY_INCLUDE_MOCK_STATISTICS_MANAGER_H_
+#endif // SRC_COMPONENTS_INCLUDE_TEST_POLICY_USAGE_STATISTICS_MOCK_STATISTICS_MANAGER_H_
diff --git a/src/components/policy/test/policy.sql b/src/components/policy/test/policy.sql
deleted file mode 100644
index c9905f3f8d..0000000000
--- a/src/components/policy/test/policy.sql
+++ /dev/null
@@ -1,295 +0,0 @@
-BEGIN TRANSACTION;
- CREATE TABLE IF NOT EXISTS `device`(
- `id` VARCHAR(100) PRIMARY KEY NOT NULL,
- `hardware` VARCHAR(45),
- `firmware_rev` VARCHAR(45),
- `os` VARCHAR(45),
- `os_version` VARCHAR(45),
- `carrier` VARCHAR(45),
- `max_number_rfcom_ports` INTEGER ,
- `connection_type` VARCHAR(45),
- `unpaired` BOOL
- );
- CREATE TABLE IF NOT EXISTS `usage_and_error_count`(
- `count_of_iap_buffer_full` INTEGER,
- `count_sync_out_of_memory` INTEGER,
- `count_of_sync_reboots` INTEGER
- );
- INSERT OR IGNORE INTO `usage_and_error_count` (
- `count_of_iap_buffer_full`, `count_sync_out_of_memory`,
- `count_of_sync_reboots`) VALUES (0, 0, 0);
- CREATE TABLE IF NOT EXISTS `module_meta`(
- `ccpu_version` VARCHAR(45),
- `language` VARCHAR(45),
- `wers_country_code` VARCHAR(45),
- `pt_exchanged_at_odometer_x` INTEGER NOT NULL DEFAULT 0,
- `pt_exchanged_x_days_after_epoch` INTEGER NOT NULL DEFAULT 0,
- `ignition_cycles_since_last_exchange` INTEGER NOT NULL DEFAULT 0,
- `vin` VARCHAR(45),
- `flag_update_required` BOOL NOT NULL
- );
- INSERT OR IGNORE INTO `module_meta` (`pt_exchanged_at_odometer_x`,
- `pt_exchanged_x_days_after_epoch`, `ignition_cycles_since_last_exchange`,
- `flag_update_required`)
- VALUES (0, 0, 0, 0);
- CREATE TABLE IF NOT EXISTS `module_config`(
- `preloaded_pt` BOOL NOT NULL,
- `is_first_run` BOOL NOT NULL,
- `exchange_after_x_ignition_cycles` INTEGER NOT NULL,
- `exchange_after_x_kilometers` INTEGER NOT NULL,
- `exchange_after_x_days` INTEGER NOT NULL,
- `timeout_after_x_seconds` INTEGER NOT NULL,
- `vehicle_make` VARCHAR(45),
- `vehicle_model` VARCHAR(45),
- `vehicle_year` VARCHAR(4)
- );
- INSERT OR IGNORE INTO `module_config` (`preloaded_pt`, `is_first_run`,
- `exchange_after_x_ignition_cycles`, `exchange_after_x_kilometers`,
- `exchange_after_x_days`, `timeout_after_x_seconds`)
- VALUES(1, 1, 0, 0, 0, 0);
- CREATE TABLE IF NOT EXISTS `functional_group`(
- `id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,
- `user_consent_prompt` TEXT UNIQUE ON CONFLICT REPLACE,
- `name` VARCHAR(100) NOT NULL
- );
- CREATE TABLE IF NOT EXISTS `priority`(
- `value` VARCHAR(45) PRIMARY KEY NOT NULL
- );
- INSERT OR IGNORE INTO `priority`(`value`) VALUES ('EMERGENCY');
- INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NAVIGATION');
- INSERT OR IGNORE INTO `priority`(`value`) VALUES ('VOICECOMMUNICATION');
- INSERT OR IGNORE INTO `priority`(`value`) VALUES ('COMMUNICATION');
- INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NORMAL');
- INSERT OR IGNORE INTO `priority`(`value`) VALUES ('NONE');
- CREATE TABLE IF NOT EXISTS `hmi_level`(
- `value` VARCHAR(45) PRIMARY KEY NOT NULL
- );
- INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('FULL');
- INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('LIMITED');
- INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('BACKGROUND');
- INSERT OR IGNORE INTO `hmi_level`(`value`) VALUES ('NONE');
- CREATE TABLE IF NOT EXISTS `notifications_by_priority`(
- `priority_value` VARCHAR(45) PRIMARY KEY NOT NULL,
- `value` INTEGER NOT NULL,
- CONSTRAINT `fk_notifications_by_priority_priority1`
- FOREIGN KEY(`priority_value`)
- REFERENCES `priority`(`value`)
- );
- CREATE INDEX IF NOT EXISTS
- `notifications_by_priority.fk_notifications_by_priority_priority1_idx`
- ON `notifications_by_priority`(`priority_value`);
- CREATE TABLE IF NOT EXISTS `language`(
- `code` VARCHAR(25) PRIMARY KEY NOT NULL
- );
- CREATE TABLE IF NOT EXISTS `message_type`(
- `name` VARCHAR(45) PRIMARY KEY NOT NULL
- );
- CREATE TABLE IF NOT EXISTS `version`(
- `number` VARCHAR(45) NOT NULL
- );
- INSERT OR IGNORE INTO `version` (`number`) VALUES('0');
- CREATE TABLE IF NOT EXISTS `rpc`(
- `id` INTEGER PRIMARY KEY NOT NULL,
- `name` VARCHAR(45) NOT NULL,
- `parameter` VARCHAR(45),
- `hmi_level_value` VARCHAR(45) NOT NULL,
- `functional_group_id` INTEGER NOT NULL,
- CONSTRAINT `fk_rpc_hmi_level1`
- FOREIGN KEY(`hmi_level_value`)
- REFERENCES `hmi_level`(`value`),
- CONSTRAINT `fk_rpc_functional_group1`
- FOREIGN KEY(`functional_group_id`)
- REFERENCES `functional_group`(`id`)
- );
- CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_hmi_level1_idx`
- ON `rpc`(`hmi_level_value`);
- CREATE INDEX IF NOT EXISTS `rpc.fk_rpc_functional_group1_idx`
- ON `rpc`(`functional_group_id`);
- 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,
- `keep_context` BOOLEAN,
- `steal_focus` BOOLEAN,
- `default_hmi` VARCHAR(45),
- `priority_value` VARCHAR(45),
- `is_revoked` BOOLEAN,
- `is_default` BOOLEAN,
- `is_predata` BOOLEAN,
- `memory_kb` INTEGER NOT NULL,
- `heart_beat_timeout_ms` INTEGER NOT NULL,
- `certificate` VARCHAR(45),
- CONSTRAINT `fk_application_hmi_level1`
- FOREIGN KEY(`default_hmi`)
- REFERENCES `hmi_level`(`value`),
- CONSTRAINT `fk_application_priorities1`
- FOREIGN KEY(`priority_value`)
- REFERENCES `priority`(`value`)
- );
- CREATE INDEX IF NOT EXISTS `application.fk_application_hmi_level1_idx`
- ON `application`(`default_hmi`);
- CREATE INDEX IF NOT EXISTS `application.fk_application_priorities1_idx`
- ON `application`(`priority_value`);
- CREATE TABLE IF NOT EXISTS `app_group`(
- `application_id` VARCHAR(45) NOT NULL,
- `functional_group_id` INTEGER NOT NULL,
- PRIMARY KEY(`application_id`,`functional_group_id`),
- CONSTRAINT `fk_application_has_functional_group_application1`
- FOREIGN KEY(`application_id`)
- REFERENCES `application`(`id`),
- CONSTRAINT `fk_application_has_functional_group_functional_group1`
- FOREIGN KEY(`functional_group_id`)
- REFERENCES `functional_group`(`id`)
- );
- 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`);
- CREATE TABLE IF NOT EXISTS `preconsented_group`(
- `application_id` VARCHAR(45) NOT NULL,
- `functional_group_id` INTEGER NOT NULL,
- PRIMARY KEY(`application_id`,`functional_group_id`),
- CONSTRAINT `fk_application_has_functional_group_application2`
- FOREIGN KEY(`application_id`)
- REFERENCES `application`(`id`),
- CONSTRAINT `fk_application_has_functional_group_functional_group2`
- FOREIGN KEY(`functional_group_id`)
- REFERENCES `functional_group`(`id`)
- );
- CREATE INDEX IF NOT EXISTS
- `preconsented_group.fk_application_has_functional_group_functional_group2_idx`
- 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`);
- CREATE TABLE IF NOT EXISTS `seconds_between_retry`(
- `index` INTEGER PRIMARY KEY NOT NULL,
- `value` INTEGER NOT NULL
- );
- CREATE TABLE IF NOT EXISTS `device_consent_group`(
- `device_id` VARCHAR(100) NOT NULL,
- `functional_group_id` INTEGER NOT NULL,
- `is_consented` BOOL NOT NULL,
- `input` VARCHAR(45),
- `time_stamp` DATETIME DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY(`device_id`,`functional_group_id`),
- CONSTRAINT `fk_device_has_functional_group_device1`
- FOREIGN KEY(`device_id`)
- REFERENCES `device`(`id`),
- CONSTRAINT `fk_device_has_functional_group_functional_group1`
- FOREIGN KEY(`functional_group_id`)
- REFERENCES `functional_group`(`id`)
- );
- CREATE INDEX IF NOT EXISTS
- `device_consent_group.fk_device_has_functional_group_functional_group1_idx`
- ON `device_consent_group`(`functional_group_id`);
- CREATE INDEX IF NOT EXISTS
- `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,
- `minutes_in_hmi_full` INTEGER DEFAULT 0,
- `minutes_in_hmi_limited` INTEGER DEFAULT 0,
- `minutes_in_hmi_background` INTEGER DEFAULT 0,
- `minutes_in_hmi_none` INTEGER DEFAULT 0,
-
- `count_of_user_selections` INTEGER DEFAULT 0,
- `count_of_rejections_sync_out_of_memory` INTEGER DEFAULT 0,
- `count_of_rejections_nickname_mismatch` INTEGER DEFAULT 0,
- `count_of_rejections_duplicate_name` INTEGER DEFAULT 0,
- `count_of_rejected_rpcs_calls` INTEGER DEFAULT 0,
- `count_of_rpcs_sent_in_hmi_none` INTEGER DEFAULT 0,
- `count_of_removals_for_bad_behavior` INTEGER DEFAULT 0,
- `count_of_run_attempts_while_revoked` INTEGER DEFAULT 0,
- `app_registration_language_gui` VARCHAR(25),
- `app_registration_language_vui` VARCHAR(25),
- CONSTRAINT `fk_app_levels_application1`
- FOREIGN KEY(`application_id`)
- REFERENCES `application`(`id`),
- CONSTRAINT `fk_app_level_language1`
- FOREIGN KEY(`app_registration_language_gui`)
- REFERENCES `language`(`code`),
- CONSTRAINT `fk_app_level_language2`
- FOREIGN KEY(`app_registration_language_vui`)
- REFERENCES `language`(`code`)
- );
- CREATE INDEX IF NOT EXISTS `app_level.fk_app_levels_application1_idx`
- ON `app_level`(`application_id`);
- 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,
- 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`);
- CREATE TABLE IF NOT EXISTS `app_type`(
- `name` VARCHAR(50) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
- 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`);
- CREATE TABLE IF NOT EXISTS `consent_group`(
- `device_id` VARCHAR(100) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
- `functional_group_id` INTEGER NOT NULL,
- `is_consented` BOOL NOT NULL,
- `input` VARCHAR(45),
- `time_stamp` DATETIME DEFAULT CURRENT_TIMESTAMP,
- PRIMARY KEY(`application_id`,`functional_group_id`,`device_id`),
- CONSTRAINT `fk_consent_group_device1`
- FOREIGN KEY(`device_id`)
- REFERENCES `device`(`id`),
- CONSTRAINT `fk_consent_group_application1`
- FOREIGN KEY(`application_id`)
- REFERENCES `application`(`id`),
- CONSTRAINT `fk_consent_group_functional_group1`
- FOREIGN KEY(`functional_group_id`)
- REFERENCES `functional_group`(`id`)
- );
- CREATE INDEX IF NOT EXISTS
- `consent_group.fk_consent_group_device1_idx`
- ON `device_consent_group`(`device_id`);
- CREATE INDEX IF NOT EXISTS `consent_group.fk_consent_group_functional_group1_idx`
- ON `consent_group`(`functional_group_id`);
- CREATE TABLE IF NOT EXISTS `endpoint`(
- `service` VARCHAR(100) NOT NULL,
- `url` VARCHAR(100) NOT NULL,
- `application_id` VARCHAR(45) NOT NULL,
- 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`);
- CREATE TABLE IF NOT EXISTS `message`(
- `id` INTEGER PRIMARY KEY NOT NULL,
- `tts` TEXT,
- `label` TEXT,
- `line1` TEXT,
- `line2` TEXT,
- `textBody` TEXT,
- `language_code` VARCHAR(25) NOT NULL,
- `message_type_name` VARCHAR(45) NOT NULL,
- CONSTRAINT `fk_messages_languages1`
- FOREIGN KEY(`language_code`)
- REFERENCES `language`(`code`),
- CONSTRAINT `fk_message_consumer_friendly_messages1`
- FOREIGN KEY(`message_type_name`)
- REFERENCES `message_type`(`name`)
- );
- CREATE INDEX IF NOT EXISTS `message.fk_messages_languages1_idx`
- ON `message`(`language_code`);
- CREATE INDEX IF NOT EXISTS `message.fk_message_consumer_friendly_messages1_idx`
- ON `message`(`message_type_name`);
-COMMIT;
diff --git a/src/components/policy/test/policy/CMakeLists.txt b/src/components/policy/test/policy/CMakeLists.txt
deleted file mode 100644
index e390901cfb..0000000000
--- a/src/components/policy/test/policy/CMakeLists.txt
+++ /dev/null
@@ -1,86 +0,0 @@
-include_directories(
- ./
- ./include
- ${LOG4CXX_INCLUDE_DIRECTORY}
- ${GMOCK_INCLUDE_DIRECTORY}
- ${JSONCPP_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/include/
- ${CMAKE_SOURCE_DIR}/src/components/rpc_base/include
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/sqlite_wrapper/include
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/qdb_wrapper/include
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/usage_statistics/include
- ${CMAKE_SOURCE_DIR}/src/components/utils/include/
-)
-
-set(LIBRARIES
- gtest
- gtest_main
- gmock
- gmock_main
- Policy
- ConfigProfile
- ${RTLIB}
-)
-
-set(SHARED_LIBRARY_LIBRARIES
- gtest
- gtest_main
- gmock
- gmock_main
- dl
-)
-
-if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
- list(REMOVE_ITEM SHARED_LIBRARY_LIBRARIES dl)
-endif()
-
-set(SHARED_LIBRARY_SOURCES
- ./src/test_shared_library.cc
-)
-
-set(SQL_PT_REPRESENTATION_SOURCES
- ./src/test_sql_pt_representation.cc
-)
-
-set(GENERATED_CODE_SOURCES
- ./src/generated_code_test.cc
-)
-
-set(GENERATED_CODE_WITH_SQLITE_SOURCES
- ./src/generated_code_with_sqlite_test.cc
-)
-
-set(POLICY_MANAGER_IMPL_SOURCES
- ./src/test_policy_manager_impl.cc
-)
-
-set(STRESS_POLICY_MANAGER_IMPL_SOURCES
- ./src/test_stress_policy_manager_impl.cc
-)
-
-add_subdirectory(usage_statistics)
-
-
-
-if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
- # --- Tests for QDB Wrapper
- add_subdirectory(qdb_wrapper)
- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-else ()
- # --- Tests for SQLite Wrapper
- add_subdirectory(sqlite_wrapper)
- create_test("test_generated_code_with_sqlite" "${GENERATED_CODE_WITH_SQLITE_SOURCES}" "${LIBRARIES}")
-
- include_directories(${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/policy_table/table_struct)
- # TODO(KKolodiy): test crashes in QNX and failed for extended policy
- create_test("test_stress_PolicyManagerImpl" "${STRESS_POLICY_MANAGER_IMPL_SOURCES}" "${LIBRARIES}")
-endif()
-
-create_test("test_generated_policy_code" "${GENERATED_CODE_SOURCES}" "${LIBRARIES}")
-create_test("test_SharedLibrary" "${SHARED_LIBRARY_SOURCES}" "${SHARED_LIBRARY_LIBRARIES}")
-create_test("test_SQLPTRepresentation" "${SQL_PT_REPRESENTATION_SOURCES}" "${LIBRARIES}")
-create_test("test_PolicyManagerImpl" "${POLICY_MANAGER_IMPL_SOURCES}" "${LIBRARIES}")
-
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/valid_sdl_pt_update.json DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt b/src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt
deleted file mode 100644
index 16191eaf50..0000000000
--- a/src/components/policy/test/policy/qdb_wrapper/CMakeLists.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-find_package(Sqlite3 REQUIRED)
-
-include_directories(
- ${LOG4CXX_INCLUDE_DIRECTORY}
- ${GMOCK_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/qdb_wrapper/include
-)
-
-set(LIBRARIES
- gtest
- gtest_main
- gmock
- gmock_main
- dbms
-)
-
-set(DATABASE_SOURCES
- ./src/test_sql_database.cc
-)
-
-set(QUERY_SOURCES
- ./src/test_sql_query.cc
-)
-
-create_test("test_SQLDatabase" "${DATABASE_SOURCES}" "${LIBRARIES}")
-create_test("test_SQLQuery" "${QUERY_SOURCES}" "${LIBRARIES}")
-
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/../test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt b/src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt
deleted file mode 100644
index 40a901ed82..0000000000
--- a/src/components/policy/test/policy/sqlite_wrapper/CMakeLists.txt
+++ /dev/null
@@ -1,27 +0,0 @@
-find_package(Sqlite3 REQUIRED)
-
-include_directories(
- ${LOG4CXX_INCLUDE_DIRECTORY}
- ${GMOCK_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/policy/src/policy/sqlite_wrapper/include
-)
-
-set(LIBRARIES
- gtest
- gtest_main
- gmock
- gmock_main
- dbms
- sqlite3
-)
-
-set(DATABASE_SOURCES
- ./src/test_sql_database.cc
-)
-
-set(QUERY_SOURCES
- ./src/test_sql_query.cc
-)
-
-create_test("test_SQLDatabase" "${DATABASE_SOURCES}" "${LIBRARIES}")
-create_test("test_SQLQuery" "${QUERY_SOURCES}" "${LIBRARIES}")
diff --git a/src/components/policy/test/policy/usage_statistics/CMakeLists.txt b/src/components/policy/test/policy/usage_statistics/CMakeLists.txt
deleted file mode 100644
index 25717b4cad..0000000000
--- a/src/components/policy/test/policy/usage_statistics/CMakeLists.txt
+++ /dev/null
@@ -1,17 +0,0 @@
-include_directories(
- include
- ${LOG4CXX_INCLUDE_DIRECTORY}
- ${CMAKE_SOURCE_DIR}/src/components/policy/usage_statistics/include
- ${GMOCK_INCLUDE_DIRECTORY}
-)
-
-set(LIBRARIES
- gmock_main
- UsageStatistics
-)
-
-set(SOURCES
- src/test_counter.cc
-)
-
-create_test("test_counter" "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/policy/test/policy_manager_impl_stress_test.cc b/src/components/policy/test/policy_manager_impl_stress_test.cc
deleted file mode 100644
index 1f85f738c7..0000000000
--- a/src/components/policy/test/policy_manager_impl_stress_test.cc
+++ /dev/null
@@ -1,289 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gtest/gtest.h"
-#include <fstream>
-#include "config_profile/profile.h"
-#include "mock_policy_listener.h"
-#include "policy/policy_manager_impl.h"
-
-using ::testing::_;
-using ::policy::PolicyManagerImpl;
-using ::policy::BinaryMessage;
-using ::policy::MockPolicyListener;
-
-namespace test {
-namespace components {
-namespace policy {
-
-class PolicyManagerImplStressTest : public ::testing::Test {
- protected:
- static const std::string kNameFile;
- static const int kNumberGroups = 3; //10;
- static const int kNumberFuncs = 4; //100;
- static const int kNumberApps = 5;
- static const int kNumberAppGroups = 5;
- static PolicyManagerImpl* manager;
- static MockPolicyListener* mock_listener;
-
- static void SetUpTestCase();
- static void TearDownTestCase();
- static void CreateTable(std::ofstream& ofs);
- static void CreateGroups(std::ofstream& ofs);
- static void CreateFuncs(std::ofstream& ofs);
- static void CreateApps(std::ofstream& ofs);
- static void CreateAppGroups(std::ofstream& ofs);
-};
-
-const std::string PolicyManagerImplStressTest::kNameFile =
- "sdl_preloaded_pt.json";
-PolicyManagerImpl* PolicyManagerImplStressTest::manager = 0;
-MockPolicyListener* PolicyManagerImplStressTest::mock_listener = 0;
-
-void PolicyManagerImplStressTest::SetUpTestCase() {
- std::ofstream ofs;
- ofs.open(kNameFile.c_str(), std::ofstream::out);
- CreateTable(ofs);
- ofs.close();
-
- profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
-
- manager = new PolicyManagerImpl();
- mock_listener = new MockPolicyListener();
- manager->set_listener(mock_listener);
-
- //TODO(AGaliuzov) APPLINK-10657
- ASSERT_TRUE(manager->InitPT(kNameFile));
-}
-
-void PolicyManagerImplStressTest::TearDownTestCase() {
- delete manager;
- delete mock_listener;
- remove(kNameFile.c_str());
-#ifndef __QNX__
- remove("policy.sqlite");
-#endif // __QNX__
-}
-
-void PolicyManagerImplStressTest::CreateGroups(std::ofstream& ofs) {
- std::stringstream ss;
- std::string number;
- for (int i = 0; i < kNumberGroups - 1; ++i) {
- ss << i << std::endl;
- ss >> number;
- ofs << "\"Group-" << number << "\":{\n \t\"rpcs\":{\n";
- CreateFuncs(ofs);
- ofs << "} },\n";
- }
- ss << kNumberGroups - 1 << std::endl;
- ss >> number;
- ofs << "\"Group-" << number << "\":{\n \t\"rpcs\":{\n";
- CreateFuncs(ofs);
- ofs << "} }\n";
-}
-
-void PolicyManagerImplStressTest::CreateFuncs(std::ofstream& ofs) {
- std::string func = "{\n"
- "\t\t\"hmi_levels\":["
- "\"BACKGROUND\","
- "\"FULL\","
- "\"LIMITED\""
- "]"
- "}";
-
- std::stringstream ss;
- std::string number;
- for (int i = 0; i < kNumberFuncs - 1; ++i) {
- ss << i << std::endl;
- ss >> number;
- ofs << "\t\"Func-" << number << "\":" << func << ",\n";
- }
- ss << kNumberFuncs - 1 << std::endl;
- ss >> number;
- ofs << "\t\"Func-" << number << "\":" + func;
-}
-
-void PolicyManagerImplStressTest::CreateApps(std::ofstream& ofs) {
-
- ofs << "\"default\":{\n";
- ofs << "\"keep_context\": true,\n"
- "\"steal_focus\": true,\n"
- "\"priority\": \"NORMAL\",\n"
- "\"default_hmi\": \"FULL\",\n";
- ofs << "\"groups\":["
- "\"Group-1\""
- "]"
- "},\n";
-
- std::stringstream ss;
- std::string number;
- for (int i = 0; i < kNumberApps - 1; ++i) {
- ss << i << std::endl;
- ss >> number;
- ofs << "\"" << number << "\" : {";
- ofs << "\n\"keep_context\": true,\n"
- "\"steal_focus\": true,\n"
- "\"priority\": \"NORMAL\",\n"
- "\"default_hmi\": \"FULL\",\n";
-
- ofs << "\"groups\": ";
- CreateAppGroups(ofs);
- ofs << "},\n";
- }
- ss << kNumberApps - 1 << std::endl;
- ss >> number;
- ofs << "\"" << number << "\" : {";
- ofs << "\n\"keep_context\": true,\n"
- "\"steal_focus\": true,\n"
- "\"priority\": \"NORMAL\",\n"
- "\"default_hmi\": \"FULL\",\n";
-
- ofs << "\"groups\": ";
- CreateAppGroups(ofs);
- ofs << "}\n";
-}
-
-void PolicyManagerImplStressTest::CreateAppGroups(std::ofstream& ofs) {
- ofs << "[";
-
- std::stringstream ss;
- std::string number;
- std::set<int> app_groups;
- for (int i = 0; i < kNumberAppGroups; ++i) {
- app_groups.insert(rand() % kNumberGroups);
- }
-
- std::set<int>::const_iterator i = app_groups.begin();
- ss << *i << std::endl;
- ss >> number;
- ofs << "\"Group-" << number << "\"";
- ++i;
- for (; i != app_groups.end(); ++i) {
- ss << *i << std::endl;
- ss >> number;
- ofs << ",\"Group-" << number << "\"";
- }
- ofs << "]\n";
-}
-
-void PolicyManagerImplStressTest::CreateTable(std::ofstream& ofs) {
- ofs << "{"
- "\"policy_table\":{\n"
- "\"module_config\":{\n"
- "\t\"preloaded_pt\":true,\n"
- "\t\"endpoints\":{\n"
- "\t\t\"default\": {\n"
- "\t\t\t\"default\":["
- "\"http://sdl.net/api\""
- "]\n"
- "\t\t}\n"
- "\t},\n"
-
- "\"notifications_per_minute_by_priority\": {\n"
- "\t\"EMERGENCY\": 60,\n"
- "\t\"NAVIGATION\": 15,\n"
- "\t\"COMMUNICATION\": 6,\n"
- "\t\"NORMAL\": 4,\n"
- "\t\"NONE\": 0\n"
- "},\n"
-
- "\"exchange_after_x_ignition_cycles\": 40,\n"
- "\"exchange_after_x_kilometers\" : 2,\n"
- "\"exchange_after_x_days\" : 23,\n"
- "\"timeout_after_x_seconds\" : 20,\n"
- "\"seconds_between_retries\" : [10, 7, 5, 3, 1]\n"
- "},"
- "\"consumer_friendly_messages\":{\n"
- "\t\"version\":\"001.001.001\",\n"
- "\t\"messages\":{} },\n"
- "\"functional_groupings\":{\n";
-
- CreateGroups(ofs);
-
- ofs << "}, \"app_policies\":{";
-
- CreateApps(ofs);
-
- ofs << "} } }";
-}
-
-TEST_F(PolicyManagerImplStressTest, OneCheck_AppAndFunctuionExisting_RpcAllowed) {
- ::policy::RPCParams input_params;
- ::policy::CheckPermissionResult output;
- manager->CheckPermissions("2", "FULL", "Func-1", input_params, output);
- EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
-}
-
-TEST_F(PolicyManagerImplStressTest, NoApp_AppDoesNotExisted_RpcDissallowed) {
- ::policy::RPCParams input_params;
- ::policy::CheckPermissionResult output;
- manager->CheckPermissions("150", "FULL", "Func-88", input_params, output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
-}
-
-TEST_F(PolicyManagerImplStressTest, NoFunc_FuncDoesNotExisted_RpcDissallowed) {
- ::policy::RPCParams input_params;
- ::policy::CheckPermissionResult output;
- manager->CheckPermissions("2", "FULL", "Func-400", input_params, output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
-}
-
-TEST_F(PolicyManagerImplStressTest, NoHmi_HMIInLevelNone_RpcDissallowed) {
- ::policy::RPCParams input_params;
- ::policy::CheckPermissionResult output;
- manager->CheckPermissions("2", "NONE", "Func-88", input_params, output);
- EXPECT_EQ(::policy::kRpcDisallowed, output.hmi_level_permitted);
-}
-
-TEST_F(PolicyManagerImplStressTest, FewChecks_CheckSeveralFunctions_RpcAllowed) {
- const int kNumberOfCheckings = kNumberFuncs; //100;
- std::stringstream ss;
- int app, func;
- std::string app_number, func_number;
- for (int i = 0; i < kNumberOfCheckings; ++i) {
- app = rand() % kNumberApps;
- func = rand() % kNumberFuncs;
- ss << app << std::endl;
- ss >> app_number;
- ss << func << std::endl;
- ss >> func_number;
-
- ::policy::RPCParams input_params;
- ::policy::CheckPermissionResult output;
- manager->CheckPermissions(app_number, "FULL", "Func-" + func_number,
- input_params, output);
- EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
- }
-}
-
-} // namespace policy
-} // namespace components
-} // namespace test
diff --git a/src/components/policy/test/policy_manager_impl_test.cc b/src/components/policy/test/policy_manager_impl_test.cc
index 84fbcf1116..ad28ebe2ac 100644
--- a/src/components/policy/test/policy_manager_impl_test.cc
+++ b/src/components/policy/test/policy_manager_impl_test.cc
@@ -1,4 +1,5 @@
-/* Copyright (c) 2014, Ford Motor Company
+/*
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,32 +31,37 @@
*/
#include <vector>
+#include <fstream>
+#include <string>
+#include <ctime>
+#include "json/reader.h"
#include "gtest/gtest.h"
#include "mock_policy_listener.h"
-#include "mock_pt_ext_representation.h"
+#include "mock_pt_representation.h"
#include "mock_cache_manager.h"
#include "mock_update_status_manager.h"
#include "policy/policy_manager_impl.h"
+#include "config_profile/profile.h"
+#include "table_struct/enums.h"
+#include "table_struct/types.h"
+#include "utils/file_system.h"
+#include "utils/date_time.h"
+#include "utils/make_shared.h"
-using ::testing::_;
using ::testing::Return;
-using ::testing::DoAll;
-using ::testing::SetArgReferee;
using ::testing::NiceMock;
+using ::testing::_;
+using ::testing::SetArgReferee;
using ::testing::AtLeast;
-using ::policy::PTRepresentation;
using ::policy::MockPolicyListener;
-using ::policy::MockPTRepresentation;
-using ::policy::MockPTExtRepresentation;
-using ::policy::MockCacheManagerInterface;
+using ::policy::MockCacheManagerInterface;
using ::policy::MockUpdateStatusManager;
using ::policy::PolicyManagerImpl;
using ::policy::PolicyTable;
-using ::policy::EndpointUrls;
namespace policy_table = rpc::policy_table_interface_base;
@@ -63,82 +69,428 @@ namespace test {
namespace components {
namespace policy {
+namespace custom_str = utils::custom_string;
+
+typedef std::multimap<std::string, policy_table::Rpcs&>
+ UserConsentPromptToRpcsConnections;
+
+template <typename T>
+std::string NumberToString(T Number) {
+ std::ostringstream ss;
+ ss << Number;
+ return ss.str();
+}
+
+template <typename T>
+void SortAndCheckEquality(std::vector<T> first, std::vector<T> second) {
+ ASSERT_EQ(first.size(), second.size());
+ std::sort(first.begin(), first.end());
+ std::sort(second.begin(), second.end());
+ // Checks
+ for (uint32_t i = 0; i < first.size(); ++i) {
+ EXPECT_EQ(first[i], second[i]);
+ }
+}
+
class PolicyManagerImplTest : public ::testing::Test {
protected:
PolicyManagerImpl* manager;
MockCacheManagerInterface* cache_manager;
- MockUpdateStatusManager update_manager;
- MockPolicyListener* listener;
+ NiceMock<MockPolicyListener> listener;
- void SetUp() {
+ void SetUp() OVERRIDE {
manager = new PolicyManagerImpl();
-
+ manager->set_listener(&listener);
cache_manager = new MockCacheManagerInterface();
manager->set_cache_manager(cache_manager);
-
- listener = new MockPolicyListener();
- manager->set_listener(listener);
}
- void TearDown() {
+ void TearDown() OVERRIDE {
delete manager;
- delete listener;
}
::testing::AssertionResult IsValid(const policy_table::Table& table) {
- if (table.is_valid()) {
- return ::testing::AssertionSuccess();
- } else {
- ::rpc::ValidationReport report(" - table");
- table.ReportErrors(&report);
- return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report);
+ if (table.is_valid()) {
+ return ::testing::AssertionSuccess();
+ } else {
+ ::rpc::ValidationReport report(" - table");
+ table.ReportErrors(&report);
+ return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report);
+ }
+ }
+};
+
+class PolicyManagerImplTest2 : public ::testing::Test {
+ public:
+ PolicyManagerImplTest2()
+ : app_id1("123456789")
+ , app_id2("1766825573")
+ , dev_id1("XXX123456789ZZZ")
+ , dev_id2("08-00-27-CE-76-FE")
+ , PTU_request_types(Json::arrayValue) {}
+
+ protected:
+ PolicyManagerImpl* manager;
+ NiceMock<MockPolicyListener> listener;
+ std::vector<std::string> hmi_level;
+ std::vector<std::string> PT_request_types;
+ uint32_t PTU_request_types_size;
+ unsigned int index;
+ const std::string app_id1;
+ const std::string app_id2;
+ const std::string dev_id1;
+ const std::string dev_id2;
+ Json::Value PTU_request_types;
+
+ void SetUp() OVERRIDE {
+ file_system::CreateDirectory("storage1");
+
+ profile::Profile::instance()->config_file_name("smartDeviceLink2.ini");
+ manager = new PolicyManagerImpl();
+ manager->set_listener(&listener);
+ const char* levels[] = {"BACKGROUND", "FULL", "LIMITED", "NONE"};
+ hmi_level.assign(levels, levels + sizeof(levels) / sizeof(levels[0]));
+ srand(time(NULL));
+ index = rand() % 3;
+ }
+
+ std::vector<std::string> JsonToVectorString(
+ const Json::Value& PTU_request_types) {
+ std::vector<std::string> result;
+ for (uint32_t i = 0; i < PTU_request_types.size(); ++i) {
+ result.push_back(PTU_request_types[i].asString());
+ }
+ return result;
+ }
+
+ const Json::Value GetPTU(std::string file_name) {
+ // Get PTU
+ std::ifstream ifile(file_name);
+ Json::Reader reader;
+ std::string json;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ json = root.toStyledString();
+ }
+ ifile.close();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ // Load Json to cache
+ EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ return root;
+ }
+
+ void CreateLocalPT(std::string file_name) {
+ file_system::remove_directory_content("storage1");
+ ASSERT_TRUE(manager->InitPT(file_name));
+ }
+
+ void AddRTtoPT(const std::string& update_file_name,
+ const std::string& section_name,
+ const uint32_t rt_number,
+ const uint32_t invalid_rt_number) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ // Get RequestTypes from section of preloaded_pt app_policies
+ PT_request_types = manager->GetAppRequestTypes(section_name);
+ EXPECT_EQ(rt_number, PT_request_types.size());
+ Json::Value root = GetPTU(update_file_name);
+ // Get Request Types from JSON (PTU)
+ PTU_request_types =
+ root["policy_table"]["app_policies"][section_name]["RequestType"];
+ PTU_request_types_size = PTU_request_types.size();
+ PT_request_types.clear();
+ // Get RequestTypes from section of PT app policies after update
+ PT_request_types = manager->GetAppRequestTypes(section_name);
+ // Check number of RT in PTU and PT now are equal
+ ASSERT_EQ(PTU_request_types_size - invalid_rt_number,
+ PT_request_types.size());
+ }
+
+ void AddRTtoAppSectionPT(const std::string& update_file_name,
+ const std::string& section_name,
+ const uint32_t rt_number,
+ const uint32_t invalid_rt_number) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ // Add app
+ manager->AddApplication(section_name);
+ // Check app gets RequestTypes from pre_DataConsent of app_policies
+ // section
+ PT_request_types = manager->GetAppRequestTypes(section_name);
+ EXPECT_EQ(rt_number, PT_request_types.size());
+ EXPECT_CALL(listener, OnPendingPermissionChange(section_name)).Times(1);
+ Json::Value root = GetPTU(update_file_name);
+
+ // Get App Request Types from PTU
+ PTU_request_types =
+ root["policy_table"]["app_policies"][section_name]["RequestType"];
+ PTU_request_types_size = PTU_request_types.size();
+
+ PT_request_types.clear();
+ // Get RequestTypes from <app_id> section of app policies after PT update
+ PT_request_types = manager->GetAppRequestTypes(section_name);
+ // Check sizes of Request types of PT and PTU
+ ASSERT_EQ(PTU_request_types_size - invalid_rt_number,
+ PT_request_types.size());
+
+ ::policy::AppPermissions permissions =
+ manager->GetAppPermissionsChanges(section_name);
+ EXPECT_TRUE(permissions.requestTypeChanged);
+ }
+
+ std::vector<policy_table::RequestType> PushRequestTypesToContainer(
+ const std::vector<std::string>& temp_result) {
+ policy_table::RequestType filtered_result;
+ std::vector<policy_table::RequestType> final_result;
+ for (uint32_t i = 0; i < temp_result.size(); ++i) {
+ if (policy_table::EnumFromJsonString(temp_result[i], &filtered_result)) {
+ final_result.push_back(filtered_result);
+ }
+ }
+ return final_result;
+ }
+
+ void CheckResultForValidRT() {
+ // Convert Json Array to std::vector<std::string>
+ const std::vector<std::string>& result =
+ JsonToVectorString(PTU_request_types);
+ // Checks
+ SortAndCheckEquality(PT_request_types, result);
+ }
+
+ void CheckResultForInvalidRT() {
+ // Convert Json Array to std::vector<std::string>
+ const std::vector<std::string>& temp_result =
+ JsonToVectorString(PTU_request_types);
+ std::vector<policy_table::RequestType> result1 =
+ PushRequestTypesToContainer(temp_result);
+ std::vector<policy_table::RequestType> result2 =
+ PushRequestTypesToContainer(PT_request_types);
+ // Checks
+ SortAndCheckEquality(result1, result2);
+ }
+ void FillMultimapFromFunctionalGroupings(
+ UserConsentPromptToRpcsConnections& input_multimap,
+ policy_table::FunctionalGroupings& fg_table) {
+ policy_table::FunctionalGroupings::iterator fg_itter = fg_table.begin();
+ const policy_table::FunctionalGroupings::iterator fg_itter_end =
+ fg_table.end();
+ for (; fg_itter != fg_itter_end; ++fg_itter) {
+ // RPCS getting
+ policy_table::Rpcs& rpcs_ref = fg_itter->second;
+ // User_consent_prompt getting
+ rpc::Optional<rpc::String<1, 255> >& optional_ref =
+ rpcs_ref.user_consent_prompt;
+ rpc::String<1, 255>& ucp_string = *optional_ref;
+ const std::string& ucp_std_string =
+ static_cast<const std::string&>(ucp_string);
+ // Multimap inserting
+ input_multimap.insert(std::pair<std::string, policy_table::Rpcs&>(
+ ucp_std_string, rpcs_ref));
}
}
-};
-TEST_F(PolicyManagerImplTest, RefreshRetrySequence_SetSecondsBetweenRetries_ExpectRetryTimeoutSequenceWithSameSeconds) {
+ void GetFunctionalGroupingsFromManager(
+ policy_table::FunctionalGroupings& input_functional_groupings) {
+ // Get cache
+ ::policy::CacheManagerInterfaceSPtr cache = manager->GetCache();
+ // Get table_snapshot
+ utils::SharedPtr<policy_table::Table> table = cache->GenerateSnapshot();
+ // Set functional groupings from policy table
+ input_functional_groupings = table->policy_table.functional_groupings;
+ }
- //arrange
- std::vector<int> seconds;
- seconds.push_back(50);
- seconds.push_back(100);
- seconds.push_back(200);
+ void TearDown() OVERRIDE {
+ profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
+ delete manager;
+ }
+};
- //assert
- EXPECT_CALL(*cache_manager, TimeoutResponse()).WillOnce(Return(60));
- EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_)).WillOnce(
- DoAll(SetArgReferee<0>(seconds), Return(true)));
+Json::Value CreatePTforLoad() {
+ const std::string load_table(
+ "{"
+ "\"policy_table\": {"
+ "\"module_config\": {"
+ "\"preloaded_pt\": true,"
+ "\"exchange_after_x_ignition_cycles\": 10,"
+ "\"exchange_after_x_kilometers\": 100,"
+ "\"exchange_after_x_days\": 5,"
+ "\"timeout_after_x_seconds\": 500,"
+ "\"seconds_between_retries\": [10, 20, 30],"
+ "\"endpoints\": {"
+ "\"0x00\": {"
+ "\"default\": [\"http://ford.com/cloud/default\"]"
+ "}"
+ "},"
+ "\"notifications_per_minute_by_priority\": {"
+ "\"emergency\": 1,"
+ "\"navigation\": 2,"
+ "\"VOICECOMM\": 3,"
+ "\"communication\": 4,"
+ "\"normal\": 5,"
+ "\"none\": 6"
+ "},"
+ "\"vehicle_make\" : \"MakeT\","
+ "\"vehicle_model\" : \"ModelT\","
+ "\"vehicle_year\": \"2014\""
+ "},"
+ "\"app_policies\": {"
+ "\"default\": {"
+ "\"memory_kb\": 50,"
+ "\"heart_beat_timeout_ms\": 100,"
+ "\"groups\": [\"default\"],"
+ "\"keep_context\": true,"
+ "\"steal_focus\": true,"
+ "\"priority\": \"EMERGENCY\","
+ "\"default_hmi\": \"FULL\","
+ "\"certificate\": \"sign\""
+ "}, "
+ "\"pre_DataConsent\": {"
+ "\"memory_kb\": 50,"
+ "\"heart_beat_timeout_ms\": 100,"
+ "\"groups\": [\"default\"],"
+ "\"keep_context\": true,"
+ "\"steal_focus\": true,"
+ "\"priority\": \"EMERGENCY\","
+ "\"default_hmi\": \"FULL\","
+ "\"certificate\": \"sign\""
+ "}, "
+ "\"device\": {"
+ "\"memory_kb\": 50,"
+ "\"heart_beat_timeout_ms\": 100,"
+ "\"groups\": [\"default\"],"
+ "\"keep_context\": true,"
+ "\"steal_focus\": true,"
+ "\"priority\": \"EMERGENCY\","
+ "\"default_hmi\": \"FULL\","
+ "\"certificate\": \"sign\""
+ "},"
+ "\"1234\": {"
+ "\"memory_kb\": 50,"
+ "\"heart_beat_timeout_ms\": 100,"
+ "\"groups\": [\"default\"],"
+ "\"keep_context\": true,"
+ "\"steal_focus\": true,"
+ "\"priority\": \"EMERGENCY\","
+ "\"default_hmi\": \"FULL\","
+ "\"certificate\": \"sign\""
+ "}"
+ "},"
+ "\"consumer_friendly_messages\": {"
+ "\"version\": \"1.2\""
+ "},"
+ "\"functional_groupings\": {"
+ "\"default\": {"
+ "\"rpcs\": {"
+ "\"Update\": {"
+ "\"hmi_levels\": [\"FULL\"],"
+ "\"parameters\" : [\"speed\"]"
+ "}"
+ "}"
+ "}"
+ "}"
+ "}"
+ "}");
+ Json::Value table(Json::objectValue);
+ Json::Reader reader;
+ EXPECT_TRUE(reader.parse(load_table, table));
+ return table;
+}
- //act
- manager->RefreshRetrySequence();
+TEST_F(PolicyManagerImplTest, GetNotificationsNumber) {
+ const std::string priority = "EMERGENCY";
+ const uint32_t notif_number = 100u;
+ EXPECT_CALL(*cache_manager, GetNotificationsNumber(priority))
+ .WillOnce(Return(notif_number));
- //assert
- EXPECT_EQ(50, manager->NextRetryTimeout());
- EXPECT_EQ(100, manager->NextRetryTimeout());
- EXPECT_EQ(200, manager->NextRetryTimeout());
- EXPECT_EQ(0, manager->NextRetryTimeout());
+ EXPECT_EQ(notif_number, manager->GetNotificationsNumber(priority));
}
-TEST_F(PolicyManagerImplTest, DISABLED_GetUpdateUrl) {
+TEST_F(PolicyManagerImplTest2, GetNotificationsNumberAfterPTUpdate) {
+ // Arrange
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+ update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
+ // Act
+ const std::string json = table.toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ EXPECT_CALL(listener, OnUpdateStatusChanged(_));
+ EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+
+ std::string priority = "emergency";
+ uint32_t notif_number = manager->GetNotificationsNumber(priority);
+ EXPECT_EQ(1u, notif_number);
+
+ priority = "navigation";
+ notif_number = manager->GetNotificationsNumber(priority);
+ EXPECT_EQ(2u, notif_number);
+
+ priority = "emergency";
+ notif_number = manager->GetNotificationsNumber(priority);
+ EXPECT_EQ(1u, notif_number);
+
+ priority = "VOICECOMM";
+ notif_number = manager->GetNotificationsNumber(priority);
+ EXPECT_EQ(3u, notif_number);
- EXPECT_CALL(*cache_manager, GetServiceUrls("7",_));
- EXPECT_CALL(*cache_manager, GetServiceUrls("4",_));
+ priority = "normal";
+ notif_number = manager->GetNotificationsNumber(priority);
+ EXPECT_EQ(5u, notif_number);
- EndpointUrls ep_7;
+ priority = "none";
+ notif_number = manager->GetNotificationsNumber(priority);
+ EXPECT_EQ(6u, notif_number);
+}
+
+TEST_F(PolicyManagerImplTest2, IsAppRevoked_SetRevokedAppID_ExpectAppRevoked) {
+ // Arrange
+ std::ifstream ifile("sdl_preloaded_pt.json");
+ Json::Reader reader;
+ std::string json;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ root["policy_table"]["app_policies"][app_id1] = Json::nullValue;
+ json = root.toStyledString();
+ }
+ ifile.close();
- manager->GetServiceUrls("7", ep_7);
- EXPECT_EQ("http://policies.telematics.ford.com/api/policies", ep_7[0].url[0] );
+ ::policy::BinaryMessage msg(json.begin(), json.end());
+ ASSERT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+ EXPECT_TRUE(manager->IsApplicationRevoked(app_id1));
+}
+
+TEST_F(PolicyManagerImplTest, IncrementGlobalCounter) {
+ // Assert
+ EXPECT_CALL(*cache_manager, Increment(usage_statistics::SYNC_REBOOTS));
+ manager->Increment(usage_statistics::SYNC_REBOOTS);
+}
- EndpointUrls ep_4;
- manager->GetServiceUrls("4", ep_4);
- EXPECT_EQ("http://policies.ford.com/api/policies", ep_4[0].url[0]);
+TEST_F(PolicyManagerImplTest, IncrementAppCounter) {
+ // Assert
+ EXPECT_CALL(*cache_manager,
+ Increment("12345", usage_statistics::USER_SELECTIONS));
+ manager->Increment("12345", usage_statistics::USER_SELECTIONS);
+}
+TEST_F(PolicyManagerImplTest, SetAppInfo) {
+ // Assert
+ EXPECT_CALL(*cache_manager,
+ Set("12345", usage_statistics::LANGUAGE_GUI, "de-de"));
+ manager->Set("12345", usage_statistics::LANGUAGE_GUI, "de-de");
}
+TEST_F(PolicyManagerImplTest, AddAppStopwatch) {
+ // Assert
+ EXPECT_CALL(*cache_manager,
+ Add("12345", usage_statistics::SECONDS_HMI_FULL, 30));
+ manager->Add("12345", usage_statistics::SECONDS_HMI_FULL, 30);
+}
TEST_F(PolicyManagerImplTest, ResetPT) {
- EXPECT_CALL(*cache_manager, ResetPT("filename")).WillOnce(Return(true))
+ EXPECT_CALL(*cache_manager, ResetPT("filename"))
+ .WillOnce(Return(true))
.WillOnce(Return(false));
+ EXPECT_CALL(*cache_manager, ResetCalculatedPermissions()).Times(AtLeast(1));
EXPECT_CALL(*cache_manager, TimeoutResponse());
EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_));
@@ -146,166 +498,301 @@ TEST_F(PolicyManagerImplTest, ResetPT) {
EXPECT_FALSE(manager->ResetPT("filename"));
}
-TEST_F(PolicyManagerImplTest, CheckPermissions_SetHmiLevelFullForAlert_ExpectAllowedPermissions) {
+TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) {
+ // Arrange
+ Json::Value table = CreatePTforLoad();
+ policy_table::Table update(&table);
+ update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
- //arrange
- ::policy::CheckPermissionResult expected;
- expected.hmi_level_permitted = ::policy::kRpcAllowed;
- expected.list_of_allowed_params.push_back("speed");
- expected.list_of_allowed_params.push_back("gps");
+ // Assert
+ ASSERT_TRUE(IsValid(update));
- //assert
- EXPECT_CALL(*cache_manager, CheckPermissions("12345678", "FULL", "Alert", _)).
- WillOnce(SetArgReferee<3>(expected));
+ EXPECT_CALL(*cache_manager, GetHMIAppTypeAfterUpdate(_)).Times(AtLeast(1));
- //act
- ::policy::RPCParams input_params;
- ::policy::CheckPermissionResult output;
- manager->CheckPermissions("12345678", "FULL", "Alert", input_params, output);
+ // Act
+ const std::string json = table.toStyledString();
+ ::policy::BinaryMessage msg(json.begin(), json.end());
- //assert
- EXPECT_EQ(::policy::kRpcAllowed, output.hmi_level_permitted);
+ utils::SharedPtr<policy_table::Table> snapshot =
+ utils::MakeShared<policy_table::Table>(update.policy_table);
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(snapshot));
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
+ EXPECT_CALL(listener, GetAppName("1234"))
+ .WillOnce(Return(custom_str::CustomString("")));
+ EXPECT_CALL(listener, OnUpdateStatusChanged(_));
+ EXPECT_CALL(*cache_manager, SaveUpdateRequired(false));
+ EXPECT_CALL(*cache_manager, TimeoutResponse());
+ EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_));
- ASSERT_TRUE(!output.list_of_allowed_params.empty());
- ASSERT_EQ(2u, output.list_of_allowed_params.size());
- EXPECT_EQ("speed", output.list_of_allowed_params[0]);
- EXPECT_EQ("gps", output.list_of_allowed_params[1]);
+ EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
}
-TEST_F(PolicyManagerImplTest, LoadPT_SetPT_PTIsLoaded) {
-
- //arrange
+TEST_F(PolicyManagerImplTest, LoadPT_SetInvalidUpdatePT_PTIsNotLoaded) {
+ // Arrange
Json::Value table(Json::objectValue);
- table["policy_table"] = Json::Value(Json::objectValue);
-
- Json::Value& policy_table = table["policy_table"];
- policy_table["module_config"] = Json::Value(Json::objectValue);
- policy_table["functional_groupings"] = Json::Value(Json::objectValue);
- policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue);
- policy_table["app_policies"] = Json::Value(Json::objectValue);
-
- Json::Value& module_config = policy_table["module_config"];
- module_config["preloaded_pt"] = Json::Value(true);
- module_config["exchange_after_x_ignition_cycles"] = Json::Value(10);
- module_config["exchange_after_x_kilometers"] = Json::Value(100);
- module_config["exchange_after_x_days"] = Json::Value(5);
- module_config["timeout_after_x_seconds"] = Json::Value(500);
- module_config["seconds_between_retries"] = Json::Value(Json::arrayValue);
- module_config["seconds_between_retries"][0] = Json::Value(10);
- module_config["seconds_between_retries"][1] = Json::Value(20);
- module_config["seconds_between_retries"][2] = Json::Value(30);
- module_config["endpoints"] = Json::Value(Json::objectValue);
- module_config["endpoints"]["0x00"] = Json::Value(Json::objectValue);
- module_config["endpoints"]["0x00"]["default"] = Json::Value(Json::arrayValue);
- module_config["endpoints"]["0x00"]["default"][0] = Json::Value(
- "http://ford.com/cloud/default");
- module_config["notifications_per_minute_by_priority"] = Json::Value(
- Json::objectValue);
- module_config["notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(1);
- module_config["notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(2);
- module_config["notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(3);
- module_config["notifications_per_minute_by_priority"]["communication"] =
- Json::Value(4);
- module_config["notifications_per_minute_by_priority"]["normal"] = Json::Value(
- 5);
- module_config["notifications_per_minute_by_priority"]["none"] = Json::Value(
- 6);
- module_config["vehicle_make"] = Json::Value("MakeT");
- module_config["vehicle_model"] = Json::Value("ModelT");
- module_config["vehicle_year"] = Json::Value("2014");
-
- Json::Value& functional_groupings = policy_table["functional_groupings"];
- functional_groupings["default"] = Json::Value(Json::objectValue);
- Json::Value& default_group = functional_groupings["default"];
- default_group["rpcs"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"]["hmi_levels"] = Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL");
- default_group["rpcs"]["Update"]["parameters"] = Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed");
-
- Json::Value& consumer_friendly_messages =
- policy_table["consumer_friendly_messages"];
- consumer_friendly_messages["version"] = Json::Value("1.2");
-
- Json::Value& app_policies = policy_table["app_policies"];
- app_policies["default"] = Json::Value(Json::objectValue);
- app_policies["default"]["memory_kb"] = Json::Value(50);
- app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["default"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["default"]["groups"][0] = Json::Value("default");
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["default_hmi"] = Json::Value("FULL");
- app_policies["default"]["keep_context"] = Json::Value(true);
- app_policies["default"]["steal_focus"] = Json::Value(true);
- app_policies["default"]["certificate"] = Json::Value("sign");
- app_policies["1234"] = Json::Value(Json::objectValue);
- app_policies["1234"]["memory_kb"] = Json::Value(50);
- app_policies["1234"]["heart_beat_timeout_ms"] = Json::Value(100);
- app_policies["1234"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["1234"]["groups"][0] = Json::Value("default");
- app_policies["1234"]["priority"] = Json::Value("EMERGENCY");
- app_policies["1234"]["default_hmi"] = Json::Value("FULL");
- app_policies["1234"]["keep_context"] = Json::Value(true);
- app_policies["1234"]["steal_focus"] = Json::Value(true);
- app_policies["1234"]["certificate"] = Json::Value("sign");
policy_table::Table update(&table);
update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
- //assert
- ASSERT_TRUE(IsValid(update));
-
+ // Assert update is invalid
+ ASSERT_FALSE(IsValid(update));
- //act
+ // Act
std::string json = table.toStyledString();
::policy::BinaryMessage msg(json.begin(), json.end());
- utils::SharedPtr<policy_table::Table> snapshot = new policy_table::Table(
- update.policy_table);
+ // Assert
+ EXPECT_CALL(*cache_manager, GenerateSnapshot()).Times(0);
+ EXPECT_CALL(*cache_manager, ApplyUpdate(_)).Times(0);
+ EXPECT_CALL(listener, GetAppName(_)).Times(0);
+ EXPECT_CALL(listener, OnUpdateStatusChanged(_)).Times(1);
+ EXPECT_CALL(*cache_manager, SaveUpdateRequired(false)).Times(0);
+ EXPECT_CALL(*cache_manager, TimeoutResponse()).Times(0);
+ EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_)).Times(0);
+ EXPECT_FALSE(manager->LoadPT("file_pt_update.json", msg));
+}
- //assert
- EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(snapshot));
- EXPECT_CALL(*cache_manager, ApplyUpdate(_)).WillOnce(Return(true));
- EXPECT_CALL(*listener, GetAppName("1234")).WillOnce(Return(""));
- EXPECT_CALL(*listener, OnUpdateStatusChanged(_));
- EXPECT_CALL(*cache_manager, SaveUpdateRequired(false));
- EXPECT_CALL(*cache_manager, TimeoutResponse());
- EXPECT_CALL(*cache_manager, SecondsBetweenRetries(_));
+TEST_F(PolicyManagerImplTest2,
+ KmsChanged_SetExceededKms_ExpectCorrectSchedule) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ ::policy::Counters counter = ::policy::Counters::KILOMETERS;
+ manager->PTUpdatedAt(counter, 50000);
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ // Set kms changed but not exceed limit
+ manager->KmsChanged(51500);
+ EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
+ // Set kms changed and exceed limit
+ manager->KmsChanged(52500);
+ EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
+}
- EXPECT_TRUE(manager->LoadPT("file_pt_update.json", msg));
+TEST_F(
+ PolicyManagerImplTest2,
+ AddApplication_AddNewApplicationFromDeviceWithoutConsent_ExpectUpdateRequired) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ manager->AddApplication(app_id1);
+ EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
+}
+
+TEST_F(
+ PolicyManagerImplTest2,
+ AddApplication_AddExistingApplicationFromDeviceWithoutConsent_ExpectNoUpdateRequired) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ GetPTU("valid_sdl_pt_update.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ // Try to add existing app
+ manager->AddApplication(app_id2);
+ // Check no update required
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+}
+
+TEST_F(PolicyManagerImplTest2,
+ PTUpdatedAt_DaysNotExceedLimit_ExpectNoUpdateRequired) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ TimevalStruct current_time = date_time::DateTime::getCurrentTime();
+ const int kSecondsInDay = 60 * 60 * 24;
+ int days = current_time.tv_sec / kSecondsInDay;
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+
+ GetPTU("valid_sdl_pt_update.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+
+ manager->AddApplication(app_id2);
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ ::policy::Counters counter = ::policy::Counters::DAYS_AFTER_EPOCH;
+ // Set PT was updated 10 days ago (limit is 30 days for now)
+ // So no limit exceeded
+ manager->PTUpdatedAt(counter, days - 10);
+ manager->OnAppRegisteredOnMobile(app_id2);
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+}
+
+TEST_F(PolicyManagerImplTest2, ForcePTExchange_ExpectUpdateNeeded) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+ // Force OT Exchange
+ manager->ForcePTExchange();
+ // Check update required
+ EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
+}
+
+TEST_F(PolicyManagerImplTest2, OnSystemReady) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ // Check
+ EXPECT_CALL(listener, OnSystemInfoUpdateRequired());
+ manager->OnSystemReady();
+}
+
+TEST_F(PolicyManagerImplTest2, ResetRetrySequence) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ manager->ResetRetrySequence();
+ EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
+ manager->OnUpdateStarted();
+ EXPECT_EQ("UPDATING", manager->GetPolicyTableStatus());
}
-TEST_F(PolicyManagerImplTest, RequestPTUpdate_SetPT_GeneratedSnapshotAndPTUpdate) {
+TEST_F(PolicyManagerImplTest2, NextRetryTimeout_ExpectTimeoutsFromPT) {
+ // Arrange
+ std::ifstream ifile("sdl_preloaded_pt.json");
+ Json::Reader reader;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ Json::Value seconds_between_retries = Json::Value(Json::arrayValue);
+ seconds_between_retries =
+ root["policy_table"]["module_config"]["seconds_between_retries"];
+ uint32_t size = seconds_between_retries.size();
+ CreateLocalPT("sdl_preloaded_pt.json");
+
+ uint32_t waiting_timeout = 0u;
+
+ for (uint32_t retry_number = 0u; retry_number < size; ++retry_number) {
+ waiting_timeout += seconds_between_retries[retry_number].asInt();
+ waiting_timeout += manager->TimeoutExchange();
+
+ // it's in miliseconds
+ EXPECT_EQ(waiting_timeout * date_time::DateTime::MILLISECONDS_IN_SECOND,
+ manager->NextRetryTimeout());
+ }
+ }
+}
- //arrange
- ::utils::SharedPtr< ::policy_table::Table > p_table =
- new ::policy_table::Table();
+TEST_F(PolicyManagerImplTest2, TimeOutExchange) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ // Check value taken from PT
+ EXPECT_EQ(70, manager->TimeoutExchange());
+}
- //assert
- EXPECT_CALL(*cache_manager, GenerateSnapshot()).WillOnce(Return(p_table));
+TEST_F(PolicyManagerImplTest2, GetPolicyTableStatus_ExpectUpToDate) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ // Check
+ EXPECT_EQ("UP_TO_DATE", manager->GetPolicyTableStatus());
+}
+
+TEST_F(PolicyManagerImplTest2,
+ RetrySequenceDelaysSeconds_Expect_CorrectValues) {
+ // Arrange
+ std::ifstream ifile("sdl_preloaded_pt.json");
+ Json::Reader reader;
+ Json::Value root(Json::objectValue);
+ if (ifile.is_open() && reader.parse(ifile, root, true)) {
+ Json::Value seconds_between_retries = Json::Value(Json::arrayValue);
+ seconds_between_retries =
+ root["policy_table"]["module_config"]["seconds_between_retries"];
+ uint32_t size = seconds_between_retries.size();
+ CreateLocalPT("sdl_preloaded_pt.json");
+ std::vector<int> delaySecs = manager->RetrySequenceDelaysSeconds();
+ // Check
+ ASSERT_EQ(size, delaySecs.size());
+ for (uint32_t i = 0; i < size; ++i) {
+ EXPECT_EQ(seconds_between_retries[i], delaySecs[i]);
+ }
+ }
+}
- //act
- manager->RequestPTUpdate();
+TEST_F(PolicyManagerImplTest2,
+ OnExceededTimeout_GetPolicyTableStatus_ExpectUpdateNeeded) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ manager->OnExceededTimeout();
+ // Check
+ EXPECT_EQ("UPDATE_NEEDED", manager->GetPolicyTableStatus());
}
+TEST_F(PolicyManagerImplTest2, GetInitialAppData_ExpectReceivedConsentCorrect) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ manager->AddApplication(app_id2);
+ ::policy::StringArray app_nicknames;
+ ::policy::StringArray app_hmi_types;
+ manager->GetInitialAppData(app_id2, &app_nicknames, &app_hmi_types);
+ // Expect Empty nicknames and AppHMITypes
+ EXPECT_EQ(0u, app_nicknames.size());
+ EXPECT_EQ(0u, app_hmi_types.size());
+
+ Json::Value root = GetPTU("valid_sdl_pt_update.json");
+
+ Json::Value appHmiTypes = Json::Value(Json::arrayValue);
+ appHmiTypes = root["policy_table"]["app_policies"][app_id2]["AppHMIType"];
+ uint32_t appHmiType_size = appHmiTypes.size();
+
+ Json::Value appNicknames = Json::Value(Json::arrayValue);
+ appNicknames = root["policy_table"]["app_policies"][app_id2]["nicknames"];
+ uint32_t appNicknames_size = appNicknames.size();
+
+ ::policy::StringArray app_nicknames1;
+ ::policy::StringArray app_hmi_types1;
+ manager->GetInitialAppData(app_id2, &app_nicknames1, &app_hmi_types1);
+ uint32_t nick_names_size = app_nicknames1.size();
+ uint32_t app_hmi_types_size = app_hmi_types1.size();
+ ASSERT_EQ(appHmiType_size, app_hmi_types_size);
+ ASSERT_EQ(appNicknames_size, nick_names_size);
+ ASSERT_GT(nick_names_size, 0u);
+ ASSERT_GT(app_hmi_types_size, 0u);
+ // Check nicknames match
+ for (uint32_t i = 0; i < nick_names_size; ++i) {
+ EXPECT_EQ(app_nicknames1[i], appNicknames[i].asString());
+ }
+ // Check AppHMITypes match
+ for (uint32_t i = 0; i < app_hmi_types_size; ++i) {
+ EXPECT_EQ(app_hmi_types1[i], appHmiTypes[i].asString());
+ }
+}
-TEST_F(PolicyManagerImplTest, DISABLED_AddApplication) {
- // TODO(AOleynik): Implementation of method should be changed to avoid
- // using of snapshot
- //manager->AddApplication("12345678");
+TEST_F(PolicyManagerImplTest2,
+ CanAppKeepContext_SetPoliciesForAppUpdated_ExpectAppCanKeepContext) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ manager->AddApplication(app_id2);
+ GetPTU("valid_sdl_pt_update.json");
+ // Check keep context in updated policies for app
+ EXPECT_TRUE(manager->CanAppKeepContext(app_id2));
}
-TEST_F(PolicyManagerImplTest, DISABLED_GetPolicyTableStatus) {
- // TODO(AOleynik): Test is not finished, to be continued
- //manager->GetPolicyTableStatus();
+TEST_F(PolicyManagerImplTest2,
+ CanAppStealFocus_SetPoliciesForAppUpdated_ExpectAppCanStealFocus) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ manager->AddApplication(app_id2);
+ GetPTU("valid_sdl_pt_update.json");
+ // Check keep context in updated policies for app
+ EXPECT_TRUE(manager->CanAppKeepContext(app_id2));
}
+TEST_F(PolicyManagerImplTest2, GetCurrentDeviceId) {
+ // Arrange
+ EXPECT_CALL(listener, OnCurrentDeviceIdUpdateRequired(app_id2)).Times(2);
+ EXPECT_EQ(custom_str::CustomString(""), manager->GetCurrentDeviceId(app_id2));
+ EXPECT_EQ("", manager->GetCurrentDeviceId(app_id2));
+}
+TEST_F(PolicyManagerImplTest2,
+ GetVehicleInfo_SetVehicleInfo_ExpectReceivedInfoCorrect) {
+ // Arrange
+ CreateLocalPT("sdl_preloaded_pt.json");
+ GetPTU("valid_sdl_pt_update.json");
+ utils::SharedPtr<policy_table::Table> pt = (manager->GetCache())->GetPT();
+ policy_table::ModuleConfig& module_config = pt->policy_table.module_config;
+ ::policy::VehicleInfo vehicle_info = manager->GetVehicleInfo();
+
+ EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_make),
+ vehicle_info.vehicle_make);
+ EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_model),
+ vehicle_info.vehicle_model);
+ EXPECT_EQ(static_cast<std::string>(*module_config.vehicle_year),
+ vehicle_info.vehicle_year);
}
-// namespace policy
-}// namespace components
+
+} // namespace policy
+} // namespace components
} // namespace test
diff --git a/src/components/policy/test/ptu2_requestType.json b/src/components/policy/test/ptu2_requestType.json
new file mode 100644
index 0000000000..50364397fd
--- /dev/null
+++ b/src/components/policy/test/ptu2_requestType.json
@@ -0,0 +1,2615 @@
+{
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-12-02",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [
+ 1,
+ 5,
+ 25,
+ 125,
+ 625
+ ],
+ "endpoints": {
+ "0x07": {
+ "default": [
+ "http://policies.telematics.ford.com/api/policies"
+ ]
+ },
+ "0x04": {
+ "default": [
+ "http://ivsu.software.ford.com/api/getsoftwareupdates"
+ ]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "VOICECOM": 20,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "AddSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Alert": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GenericResponse": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnButtonPress": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHashChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Slider": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Speak": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "PropriataryData-2": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "ProprietaryData-3": {
+ "rpcs": {
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Base-6": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "AddSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Alert": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GenericResponse": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonPress": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnCommand": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnTBTClientState": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Slider": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Speak": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "OnKeyboardInputOnlyGroup": {
+ "rpcs": {
+ "OnKeyboardInput": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "OnTouchEventOnlyGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "DiagnosticMessageOnly": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHashChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "SendLocation": {
+ "rpcs": {
+ "SendLocation": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "BackgroundAPT": {
+ "rpcs": {
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.021",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. \n\nSi presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. \r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\r\n\r\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. \n\nLas actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. \n\nPresione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements.\r\n\r\nVeuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "By enabling mobile apps, you consent to allowing SYNC to communicate with Ford at least once per month using your mobile device’s data plan. Disabling will stop all data usage, but you will not be able to use mobile apps on SYNC. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "EMERGENCY",
+ "default_hmi": "LIMITED",
+ "groups": [
+ "Base-4"
+ ],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "DataConsent-2"
+ ],
+ "preconsented_groups": [
+ "BaseBeforeDataConsent"
+ ]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "BaseBeforeDataConsent"
+ ],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ },
+ "584421907": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "BaseBeforeDataConsent"
+ ],
+ "RequestType": [
+ "TRAFFIC_MESSAGE_CHANNEL",
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ }
+ }
+ }
+}
diff --git a/src/components/policy/test/ptu_requestType.json b/src/components/policy/test/ptu_requestType.json
new file mode 100644
index 0000000000..44bd8356fe
--- /dev/null
+++ b/src/components/policy/test/ptu_requestType.json
@@ -0,0 +1,2610 @@
+{
+ "policy_table": {
+ "module_config": {
+ "preloaded_pt": true,
+ "preloaded_date": "2015-12-02",
+ "exchange_after_x_ignition_cycles": 100,
+ "exchange_after_x_kilometers": 1800,
+ "exchange_after_x_days": 30,
+ "timeout_after_x_seconds": 60,
+ "seconds_between_retries": [
+ 1,
+ 5,
+ 25,
+ 125,
+ 625
+ ],
+ "endpoints": {
+ "0x07": {
+ "default": [
+ "http://policies.telematics.ford.com/api/policies"
+ ]
+ },
+ "0x04": {
+ "default": [
+ "http://ivsu.software.ford.com/api/getsoftwareupdates"
+ ]
+ }
+ },
+ "notifications_per_minute_by_priority": {
+ "EMERGENCY": 60,
+ "NAVIGATION": 15,
+ "VOICECOM": 20,
+ "COMMUNICATION": 6,
+ "NORMAL": 4,
+ "NONE": 0
+ }
+ },
+ "functional_groupings": {
+ "Base-4": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "AddSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Alert": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GenericResponse": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnButtonPress": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "OnCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHashChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED",
+ "BACKGROUND"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Slider": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Speak": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Location-1": {
+ "user_consent_prompt": "Location",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "gps",
+ "speed"
+ ]
+ }
+ }
+ },
+ "Notifications": {
+ "user_consent_prompt": "Notifications",
+ "rpcs": {
+ "Alert": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3": {
+ "user_consent_prompt": "DrivingCharacteristics",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ }
+ },
+ "VehicleInfo-3": {
+ "user_consent_prompt": "VehicleInfo",
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "bodyInformation",
+ "deviceStatus",
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ }
+ },
+ "PropriataryData-1": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "PropriataryData-2": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "ProprietaryData-3": {
+ "rpcs": {
+ "GetDTCs": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ReadDID": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Emergency-1": {
+ "rpcs": {
+ "GetVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ],
+ "parameters": [
+ "airbagStatus",
+ "clusterModeStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Navigation-1": {
+ "rpcs": {
+ "AlertManeuver": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ShowConstantTBT": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "UpdateTurnList": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "Base-6": {
+ "rpcs": {
+ "AddCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "AddSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Alert": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "CreateInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteCommand": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteInteractionChoiceSet": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "DeleteSubMenu": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "GenericResponse": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonEvent": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnButtonPress": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnCommand": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnDriverDistraction": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnTBTClientState": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PerformInteraction": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "ScrollableMessage": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SetMediaClockTimer": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Show": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "Slider": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ },
+ "Speak": {
+ "hmi_levels": [
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ },
+ "SyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnsubscribeButton": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "OnKeyboardInputOnlyGroup": {
+ "rpcs": {
+ "OnKeyboardInput": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "OnTouchEventOnlyGroup": {
+ "rpcs": {
+ "OnTouchEvent": {
+ "hmi_levels": [
+ "FULL"
+ ]
+ }
+ }
+ },
+ "DiagnosticMessageOnly": {
+ "rpcs": {
+ "DiagnosticMessage": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "DataConsent-2": {
+ "user_consent_prompt": "DataConsent",
+ "rpcs": null
+ },
+ "BaseBeforeDataConsent": {
+ "rpcs": {
+ "ChangeRegistration": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "DeleteFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "EncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ListFiles": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnAppInterfaceUnregistered": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnEncodedSyncPData": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHashChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnHMIStatus": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnLanguageChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnPermissionsChange": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "OnSystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "PutFile": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "RegisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "ResetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetGlobalProperties": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetAppIcon": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SetDisplayLayout": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "SystemRequest": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ },
+ "UnregisterAppInterface": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED",
+ "NONE"
+ ]
+ }
+ }
+ },
+ "SendLocation": {
+ "rpcs": {
+ "SendLocation": {
+ "hmi_levels": [
+ "BACKGROUND",
+ "FULL",
+ "LIMITED"
+ ]
+ }
+ }
+ },
+ "BackgroundAPT": {
+ "rpcs": {
+ "EndAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ },
+ "OnAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ },
+ "PerformAudioPassThru": {
+ "hmi_levels": [
+ "BACKGROUND"
+ ]
+ }
+ }
+ }
+ },
+ "consumer_friendly_messages": {
+ "version": "001.001.021",
+ "messages": {
+ "AppPermissions": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab.",
+ "line1": "Zugriffsanfrage(n)",
+ "line2": "erlauben?"
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%`s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny.",
+ "line1": "Grant requested",
+ "line2": "permission(s)?"
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. Please press yes to allow or no to deny.",
+ "line1": "Grant Requested",
+ "line2": "Permission(s)?",
+ "textBody": "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. \n\nIf you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%’s use of your data. You can change these permissions and hear detailed descriptions in the mobile apps settings menu."
+ },
+ "es-en": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. \n\n Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar.",
+ "line1": "¿Conceder permisos",
+ "line2": "solicitados?"
+ },
+ "es-mx": {
+ "tts": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar.",
+ "line1": "¿Otorgar permiso(s)",
+ "line2": "solicitado(s)?",
+ "textBody": "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. \n\nSi presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)",
+ "textBody": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser.",
+ "line1": "Accorder permission(s)",
+ "line2": "demandée(s)"
+ },
+ "it-it": {
+ "tts": "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare.",
+ "line1": "Concedi autorizzaz.",
+ "line2": "richiesta(e)?"
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren.",
+ "line1": "Aangevraagde",
+ "line2": "permissie(s) verlenen?"
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania.",
+ "line1": "Udzielić żądanych",
+ "line2": "pozwoleń?"
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar.",
+ "line1": "Conceder permissão",
+ "line2": "solicitada?"
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar.",
+ "line1": "Conceder permiss.",
+ "line2": "solicitada(s)?"
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны.",
+ "line1": "Предост. заправш.",
+ "line2": "разрешения?"
+ },
+ "sv-se": {
+ "tts": "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka.",
+ "line1": "Vill du ge",
+ "line2": "tillstånd?"
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın.",
+ "line1": "İstenen izinler",
+ "line2": "verilsin mi?"
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。",
+ "line1": "是否允许请求的",
+ "line2": "权限?"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。",
+ "line1": "允許",
+ "line2": "授權請求?"
+ }
+ }
+ },
+ "AppPermissionsHelp": {
+ "languages": {
+ "de-de": {
+ "tts": "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us": {
+ "tts": "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es": {
+ "tts": "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx": {
+ "tts": "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr": {
+ "tts": "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it": {
+ "tts": "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl": {
+ "tts": "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl": {
+ "tts": "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br": {
+ "tts": "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt": {
+ "tts": "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru": {
+ "tts": "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se": {
+ "tts": "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr": {
+ "tts": "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn": {
+ "tts": "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw": {
+ "tts": "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked": {
+ "languages": {
+ "de-de": {
+ "tts": "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us": {
+ "tts": "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx": {
+ "tts": "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr": {
+ "tts": "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it": {
+ "tts": "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl": {
+ "tts": "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl": {
+ "tts": "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br": {
+ "tts": "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt": {
+ "tts": "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru": {
+ "tts": "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se": {
+ "tts": "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr": {
+ "tts": "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn": {
+ "tts": "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw": {
+ "tts": "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren.",
+ "line1": "nicht autorisiert"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized",
+ "textBody": "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "not authorized"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not authorized and will not work with SYNC.",
+ "line1": "Not Authorized",
+ "textBody": "This version of %appName% is no longer authorized to work with AppLink. Please update to the latest version of %appName%."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no está autorizada y no funcionará con SYNC.",
+ "line1": "No autorizada"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC.",
+ "line1": "no autorizada",
+ "textBody": "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée",
+ "textBody": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC.",
+ "line1": "non autorisée"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è autorizzata e non funziona con il SYNC.",
+ "line1": "non autorizzata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC.",
+ "line1": "niet geautoriseerd"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC.",
+ "line1": "brak autoryzacji"
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não tem autorização e não funcionará com o SYNC.",
+ "line1": "não autorizado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não está autorizada e não funcionará com o SYNC.",
+ "line1": "não autorizada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не авторизирована и не будет работать с SYNC.",
+ "line1": "не авторизировано"
+ },
+ "sv-se": {
+ "tts": "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC.",
+ "line1": "är ej godkänd"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz.",
+ "line1": "için izin yok"
+ },
+ "zh-cn": {
+ "tts": "此版本的%appName% 未得到授权,无法在SYNC上使用。",
+ "line1": "未得到授权"
+ },
+ "zh-tw": {
+ "tts": "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。",
+ "line1": "無授權"
+ }
+ }
+ },
+ "AppUnsupported": {
+ "languages": {
+ "de-de": {
+ "tts": "Diese Version von %appName% wird von SYNC nicht unterstützt.",
+ "line1": "nicht unterstützt"
+ },
+ "en-au": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-gb": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported",
+ "textBody": "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "not supported"
+ },
+ "en-us": {
+ "tts": "This version of %appName% is not supported by SYNC.",
+ "line1": "Not Supported",
+ "textBody": "Your version of %appName% is not supported by SYNC."
+ },
+ "es-en": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "No compatible"
+ },
+ "es-mx": {
+ "tts": "Esta versión de %appName% no es compatible con SYNC.",
+ "line1": "no compatible",
+ "textBody": "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible",
+ "textBody": "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr": {
+ "tts": "Cette version de %appName% n’est pas prise en charge par SYNC.",
+ "line1": "incompatible"
+ },
+ "it-it": {
+ "tts": "Questa versione di %appName% non è supportata dal SYNC.",
+ "line1": "non supportata"
+ },
+ "nl-nl": {
+ "tts": "Deze versie van %appName% wordt niet ondersteund door SYNC.",
+ "line1": "niet ondersteund"
+ },
+ "pl-pl": {
+ "tts": "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC.",
+ "line1": "aplikacja nie obsług."
+ },
+ "pt-br": {
+ "tts": "Esta versão do %appName% não é suportada pelo SYNC.",
+ "line1": "não suportado"
+ },
+ "pt-pt": {
+ "tts": "Esta versão de %appName% não é suportado pelo SYNC.",
+ "line1": "não suportada"
+ },
+ "ru-ru": {
+ "tts": "Эта версия %appName% не поддерживается SYNC.",
+ "line1": "не поддерживается"
+ },
+ "sv-se": {
+ "tts": "SYNC har inte stöd för den här versionen av %appName%.",
+ "line1": "stöds ej"
+ },
+ "tr-tr": {
+ "tts": "Bu %appName% sürümü SYNC tarafından desteklenmiyor.",
+ "line1": "desteklenmiyor"
+ },
+ "zh-cn": {
+ "tts": "SYNC不支持此版本的%appName%。",
+ "line1": "不受支持"
+ },
+ "zh-tw": {
+ "tts": "SYNC 不支援此版本的%appName% 。",
+ "line1": "不支援"
+ }
+ }
+ },
+ "DataConsent": {
+ "languages": {
+ "en-gb": {
+ "textBody": "Would you like to enable Mobile Apps on SYNC? To use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. \r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "en-us": {
+ "line1": "Enable Mobile Apps",
+ "line2": "on SYNC? (Uses Data)",
+ "textBody": "Would you like to enable Mobile Apps on SYNC?\r\n\r\nTo use Mobile Apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device’s data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S.\r\n\r\nUpdates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC Settings menu. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Para usar aplicaciones móviles con SYNC, este debe comunicarse con Ford al menos una vez al mes a través del plan de datos de su dispositivo móvil. Pueden aplicar tarifas normales. SYNC enviará su VIN y el número de módulo de SYNC a Ford de Estados Unidos de América. \n\nLas actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario. \n\nPresione Sí para permitir y No para denegar."
+ },
+ "fr-ca": {
+ "textBody": "Pour utiliser AppLink, SYNC devra communiquer avec Ford au moins une fois par mois en utilisant le forfait de données de votre appareil mobile. Les tarifs réguliers peuvent s’appliquer. SYNC enverra votre NIV et le numéro de votre module SYNC à Ford États-Unis. Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements.\r\n\r\nVeuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ }
+ }
+ },
+ "DataConsentHelp": {
+ "languages": {
+ "en-us": {
+ "textBody": "By enabling mobile apps, you consent to allowing SYNC to communicate with Ford at least once per month using your mobile device’s data plan. Disabling will stop all data usage, but you will not be able to use mobile apps on SYNC. See your Owner Guide for more information."
+ },
+ "es-mx": {
+ "textBody": "Las actualizaciones tienen el tamaño aproximado de un mensaje de correo electrónico, y la frecuencia de las actualizaciones depende del uso de su vehículo y de si se encuentran nuevas aplicaciones en su dispositivo. Para obtener más información, consulte la Guía del propietario."
+ },
+ "fr-ca": {
+ "textBody": "Les mises à jour ont la taille d’un courriel et la fréquence des mises à jour dépend de l’utilisation de votre véhicule et si une nouvelle application se trouve sur votre appareil. Consultez le Guide de l’utilisateur pour obtenir d’autres renseignements."
+ }
+ }
+ },
+ "DisableApps": {
+ "languages": {
+ "de-de": {
+ "tts": "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen.",
+ "line1": "Auto-Update",
+ "line2": "und Mobile Apps deaktivieren"
+ },
+ "en-au": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-gb": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie": {
+ "tts": "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel.",
+ "line1": "Disable auto-updates",
+ "line2": "and Mobile Apps?"
+ },
+ "en-us": {
+ "tts": "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel.",
+ "line1": "Disable Auto-Updates",
+ "line2": "and Mobile Apps?",
+ "textBody": "If you disable, you will not be able to use any mobile apps with SYNC and your vehicle will stop receiving mobile app permission updates via your device`s data plan. Please press yes to disable mobile apps or no to cancel."
+ },
+ "es-en": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es": {
+ "tts": "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar.",
+ "line1": "¿Desact. actual. auto",
+ "line2": "y apl. móviles?"
+ },
+ "es-mx": {
+ "tts": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar.",
+ "line1": "¿Deshab. actualiz.",
+ "line2": "autom. y aplic. móv.?",
+ "textBody": "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?",
+ "textBody": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr": {
+ "tts": "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler.",
+ "line1": "Désactiver màj autom.",
+ "line2": "et app. mobiles?"
+ },
+ "it-it": {
+ "tts": "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare.",
+ "line1": "Disabilitare agg. aut.",
+ "line2": "e app mobili?"
+ },
+ "nl-nl": {
+ "tts": "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren.",
+ "line1": "Auto-updates en mob.",
+ "line2": "apps uitschakelen?"
+ },
+ "pl-pl": {
+ "tts": "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować.",
+ "line1": "Wył. automat. aktual.",
+ "line2": "i aplikacje mobilne?"
+ },
+ "pt-br": {
+ "tts": "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar.",
+ "line1": "Desativar atualizações",
+ "line2": "autom. e aplicativos?"
+ },
+ "pt-pt": {
+ "tts": "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar.",
+ "line1": "Desact. actual. autom.",
+ "line2": "e aplicações móveis?"
+ },
+ "ru-ru": {
+ "tts": "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены.",
+ "line1": "Откл. автообновления",
+ "line2": "и мобил. прилож.?"
+ },
+ "sv-se": {
+ "tts": "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta.",
+ "line1": "Avaktiverar autouppdat.",
+ "line2": "och mobilappar?"
+ },
+ "tr-tr": {
+ "tts": "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın.",
+ "line1": "Oto. güncelleme ve",
+ "line2": "mobil uygul. kapat?"
+ },
+ "zh-cn": {
+ "tts": "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。",
+ "line1": "是否禁用自动更新和",
+ "line2": "移动应用程序?"
+ },
+ "zh-tw": {
+ "tts": "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。",
+ "line1": "停用自動更新",
+ "line2": "和行動應用程式?"
+ }
+ }
+ },
+ "DrivingCharacteristics": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus.",
+ "label": "Fahreigenschaften"
+ },
+ "en-au": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-gb": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie": {
+ "tts": "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status.",
+ "label": "Driving characteristics"
+ },
+ "en-us": {
+ "tts": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status.",
+ "label": "Driving Characteristics",
+ "textBody": "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad.",
+ "label": "Características de conducción"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad.",
+ "label": "Características del manejo",
+ "textBody": "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite",
+ "textBody": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité.",
+ "label": "Caractéristiques de conduite"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza.",
+ "label": "Caratteristiche di guida"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus.",
+ "label": "Rijkenmerken"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa.",
+ "label": "Informacje dotyczące stylu jazdy"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança.",
+ "label": "Características de condução"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança.",
+ "label": "Características de condução"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности.",
+ "label": "Характеристики движения"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus.",
+ "label": "Köregenskaper"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu.",
+ "label": "Sürüş karakteristikleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态",
+ "label": "行驶特性"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態",
+ "label": "駕駛特性"
+ }
+ }
+ },
+ "Location": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs.",
+ "label": "GPS und Geschwindigkeit"
+ },
+ "en-au": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-gb": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "en-ie": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed"
+ },
+ "en-us": {
+ "tts": "An app can access vehicle GPS and speed.",
+ "label": "GPS and speed",
+ "textBody": "An app can access vehicle GPS and speed."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder al GPS y la velocidad del vehículo.",
+ "label": "GPS y velocidad"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo.",
+ "label": "GPS y velocidad",
+ "textBody": "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse",
+ "textBody": "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder au GPS et à la vitesse du véhicule.",
+ "label": "GPS et vitesse"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso a GPS e velocità del veicolo.",
+ "label": "GPS e velocità"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot gps en de snelheid van het voertuig.",
+ "label": "Gps en snelheid"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu.",
+ "label": "GPS i prędkość"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar o GPS e a velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder ao GPS e à velocidade do veículo.",
+ "label": "GPS e velocidade"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к GPS и скорости автомобиля.",
+ "label": "GPS и скорость"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt fordonets GPS och hastighetsmätare.",
+ "label": "GPS och hastighet"
+ },
+ "tr-tr": {
+ "tts": "Bu uygulama aracın GPS ve hız bilgilerine erişebilir.",
+ "label": "GPS ve hız"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可以访问车辆 GPS 和车速信息。",
+ "label": "GPS 和车速"
+ },
+ "zh-tw": {
+ "tts": "應用程式可存取車輛的GPS和速度。",
+ "label": "GPS和車速"
+ }
+ }
+ },
+ "Notifications": {
+ "languages": {
+ "de-de": {
+ "tts": "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden.",
+ "label": "Push-Benachrichtigungen"
+ },
+ "en-au": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-gb": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "en-ie": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications"
+ },
+ "en-us": {
+ "tts": "An app can send notifications when running in the background.",
+ "label": "Push notifications",
+ "textBody": "An app can send notifications when running in the background."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano.",
+ "label": "Notificaciones push"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano.",
+ "label": "Notificaciones tipo Push",
+ "textBody": "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications instantanées",
+ "textBody": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr": {
+ "tts": "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan.",
+ "label": "Notifications push"
+ },
+ "it-it": {
+ "tts": "Un'app può inviare notifiche se eseguita in background.",
+ "label": "Notifiche push"
+ },
+ "nl-nl": {
+ "tts": "Een app kan meldingen versturen als deze op de achtergrond actief is.",
+ "label": "Push-meldingen"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może wysyłać powiadomienia, działając w tle.",
+ "label": "Powiadomienia Push"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano.",
+ "label": "Notificações Push"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue enviar notificações quando está activa em segundo plano.",
+ "label": "Notificações push"
+ },
+ "ru-ru": {
+ "tts": "Если приложение работает в фоновом режиме, оно может отправлять оповещения.",
+ "label": "Оповещения о пересылке"
+ },
+ "sv-se": {
+ "tts": "Appen kan skicka meddelanden när den körs i bakgrunden.",
+ "label": "Push-notiser"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama arka planda çalışırken bildirim gönderebilir.",
+ "label": "Anlık bildirimleri"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序在后台运行时可推送通知。",
+ "label": "推送通知"
+ },
+ "zh-tw": {
+ "tts": "車輛行進時,應用程式可在背景中傳送通知。",
+ "label": "傳送通知"
+ }
+ }
+ },
+ "SettingDisableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Updates deakt."
+ },
+ "en-au": {
+ "line1": "Disable updates"
+ },
+ "en-gb": {
+ "line1": "Disable updates"
+ },
+ "en-ie": {
+ "line1": "Disable updates"
+ },
+ "en-us": {
+ "line1": "Disable Updates",
+ "textBody": "Disable Updates"
+ },
+ "es-en": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "es-es": {
+ "line1": "Desact. actual."
+ },
+ "es-mx": {
+ "line1": "Deshab. actual.",
+ "textBody": "Deshab. actual."
+ },
+ "fr-ca": {
+ "line1": "Désactiver MAJ",
+ "textBody": "Désactiver MAJ"
+ },
+ "fr-fr": {
+ "line1": "Désactiver màj"
+ },
+ "it-it": {
+ "line1": "Disabilita agg."
+ },
+ "nl-nl": {
+ "line1": "Upd. uitschak."
+ },
+ "pl-pl": {
+ "line1": "Wyłącz aktual."
+ },
+ "pt-br": {
+ "line1": "Desat. atualiz."
+ },
+ "pt-pt": {
+ "line1": "Desact. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Откл. обновл."
+ },
+ "sv-se": {
+ "line1": "Inaktivera uppd."
+ },
+ "tr-tr": {
+ "line1": "Güncell. Kapat"
+ },
+ "zh-cn": {
+ "line1": "禁用更新"
+ },
+ "zh-tw": {
+ "line1": "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates": {
+ "languages": {
+ "de-de": {
+ "line1": "Apps aktivieren"
+ },
+ "en-au": {
+ "line1": "Enable Apps"
+ },
+ "en-gb": {
+ "line1": "Enable Apps"
+ },
+ "en-ie": {
+ "line1": "Enable Apps"
+ },
+ "en-us": {
+ "line1": "Enable Apps"
+ },
+ "es-en": {
+ "line1": "Hab. aplic."
+ },
+ "es-es": {
+ "line1": "Activar apl."
+ },
+ "es-mx": {
+ "line1": "Hab. aplic."
+ },
+ "fr-ca": {
+ "line1": "Activer app.",
+ "textBody": "Activer app."
+ },
+ "fr-fr": {
+ "line1": "Activer app."
+ },
+ "it-it": {
+ "line1": "Abilita app"
+ },
+ "nl-nl": {
+ "line1": "Apps inschak."
+ },
+ "pl-pl": {
+ "line1": "Włącz aplikacje"
+ },
+ "pt-br": {
+ "line1": "Ativar aplic."
+ },
+ "pt-pt": {
+ "line1": "Activar actualiz."
+ },
+ "ru-ru": {
+ "line1": "Вкл. прилож."
+ },
+ "sv-se": {
+ "line1": "Aktivera appar"
+ },
+ "tr-tr": {
+ "line1": "Uygulamaları aç"
+ },
+ "zh-cn": {
+ "line1": "启用应用程序"
+ },
+ "zh-tw": {
+ "line1": "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto": {
+ "languages": {
+ "de-de": {
+ "line1": "Update anford."
+ },
+ "en-au": {
+ "line1": "Request update"
+ },
+ "en-gb": {
+ "line1": "Request update"
+ },
+ "en-ie": {
+ "line1": "Request update"
+ },
+ "en-us": {
+ "line1": "Request Update",
+ "textBody": "Select `Update now` to receive app permissions for your SYNC-enabled mobile apps. This may enable additional functionality depending on the app and your settings. If your phone has a working data connection, an update should complete in less than 1 minute."
+ },
+ "es-en": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "es-es": {
+ "line1": "Solicitar actual."
+ },
+ "es-mx": {
+ "line1": "Solicit. actualiz.",
+ "textBody": "Solicit. actualiz."
+ },
+ "fr-ca": {
+ "line1": "Demander MAJ",
+ "textBody": "Demander MAJ"
+ },
+ "fr-fr": {
+ "line1": "Demander màj"
+ },
+ "it-it": {
+ "line1": "Rich. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Upd. aanvragen"
+ },
+ "pl-pl": {
+ "line1": "Zażądaj aktual."
+ },
+ "pt-br": {
+ "line1": "Solicitar atualiz."
+ },
+ "pt-pt": {
+ "line1": "Solicit. actualiz."
+ },
+ "ru-ru": {
+ "line1": "Запрос на обн."
+ },
+ "sv-se": {
+ "line1": "Begär uppdat."
+ },
+ "tr-tr": {
+ "line1": "Güncelleme iste"
+ },
+ "zh-cn": {
+ "line1": "请求更新"
+ },
+ "zh-tw": {
+ "line1": "請求更新"
+ }
+ }
+ },
+ "StatusNeeded": {
+ "languages": {
+ "de-de": {
+ "line1": "Update benötigt"
+ },
+ "en-au": {
+ "line1": "Update needed"
+ },
+ "en-gb": {
+ "line1": "Update needed",
+ "textBody": "Update needed"
+ },
+ "en-ie": {
+ "line1": "Update needed"
+ },
+ "en-us": {
+ "line1": "Update Needed",
+ "textBody": "Update Needed"
+ },
+ "es-en": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "es-es": {
+ "line1": "Actu. necesaria"
+ },
+ "es-mx": {
+ "line1": "Actualiz. neces.",
+ "textBody": "Actualiz. neces."
+ },
+ "fr-ca": {
+ "line1": "Màj requise",
+ "textBody": "Màj requise"
+ },
+ "fr-fr": {
+ "line1": "Mise à jour requise"
+ },
+ "it-it": {
+ "line1": "Necess. aggiorn."
+ },
+ "nl-nl": {
+ "line1": "Update nodig"
+ },
+ "pl-pl": {
+ "line1": "Potrzeba aktual."
+ },
+ "pt-br": {
+ "line1": "Atualiz. necess."
+ },
+ "pt-pt": {
+ "line1": "Actual. necess."
+ },
+ "ru-ru": {
+ "line1": "Необх. обновл."
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs"
+ },
+ "tr-tr": {
+ "line1": "Güncellenmeli"
+ },
+ "zh-cn": {
+ "line1": "需要进行更新"
+ },
+ "zh-tw": {
+ "line1": "需更新"
+ }
+ }
+ },
+ "StatusPending": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktualisieren..."
+ },
+ "en-au": {
+ "line1": "Updating..."
+ },
+ "en-gb": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "en-ie": {
+ "line1": "Updating..."
+ },
+ "en-us": {
+ "line1": "Updating...",
+ "textBody": "Updating..."
+ },
+ "es-en": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "es-es": {
+ "line1": "Actualizando..."
+ },
+ "es-mx": {
+ "line1": "Actualizando...",
+ "textBody": "Actualizando..."
+ },
+ "fr-ca": {
+ "line1": "MAJ en cours...",
+ "textBody": "MAJ en cours..."
+ },
+ "fr-fr": {
+ "line1": "Màj en cours..."
+ },
+ "it-it": {
+ "line1": "Aggiornamento"
+ },
+ "nl-nl": {
+ "line1": "Updaten..."
+ },
+ "pl-pl": {
+ "line1": "Aktualizowanie"
+ },
+ "pt-br": {
+ "line1": "Atualizando..."
+ },
+ "pt-pt": {
+ "line1": "A actualizar..."
+ },
+ "ru-ru": {
+ "line1": "Обновление..."
+ },
+ "sv-se": {
+ "line1": "Uppdaterar..."
+ },
+ "tr-tr": {
+ "line1": "Güncelleniyor..."
+ },
+ "zh-cn": {
+ "line1": "正在更新......"
+ },
+ "zh-tw": {
+ "line1": "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate": {
+ "languages": {
+ "de-de": {
+ "line1": "Aktuelle Version"
+ },
+ "en-au": {
+ "line1": "Up-to-date"
+ },
+ "en-gb": {
+ "line1": "Up-to-date",
+ "textBody": "Up-to-date"
+ },
+ "en-ie": {
+ "line1": "Up-to-date"
+ },
+ "en-us": {
+ "line1": "Up-To-Date",
+ "textBody": "Up-To-Date"
+ },
+ "es-en": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "es-es": {
+ "line1": "Actualizada"
+ },
+ "es-mx": {
+ "line1": "Actualizado",
+ "textBody": "Actualizado"
+ },
+ "fr-ca": {
+ "line1": "Déjà à jour",
+ "textBody": "Déjà à jour"
+ },
+ "fr-fr": {
+ "line1": "Déjà à jour"
+ },
+ "it-it": {
+ "line1": "più recente"
+ },
+ "nl-nl": {
+ "line1": "Up-to-date"
+ },
+ "pl-pl": {
+ "line1": "Aktualne"
+ },
+ "pt-br": {
+ "line1": "Atualizado"
+ },
+ "pt-pt": {
+ "line1": "Actualizado"
+ },
+ "ru-ru": {
+ "line1": "Обновлено"
+ },
+ "sv-se": {
+ "line1": "Uppdat. krävs ej"
+ },
+ "tr-tr": {
+ "line1": "Güncel"
+ },
+ "zh-cn": {
+ "line1": "最新更新"
+ },
+ "zh-tw": {
+ "line1": "更新最新"
+ }
+ }
+ },
+ "VehicleInfo": {
+ "languages": {
+ "de-de": {
+ "tts": "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck.",
+ "label": "Fahrzeuginformationen"
+ },
+ "en-au": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-gb": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tire pressure."
+ },
+ "en-ie": {
+ "tts": "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure.",
+ "label": "Vehicle information"
+ },
+ "en-us": {
+ "tts": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure.",
+ "label": "Vehicle information",
+ "textBody": "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es": {
+ "tts": "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos.",
+ "label": "Información del vehículo"
+ },
+ "es-mx": {
+ "tts": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos.",
+ "label": "Información del vehículo",
+ "textBody": "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus.",
+ "label": "Renseignements du véhicule",
+ "textBody": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr": {
+ "tts": "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus.",
+ "label": "Renseignements du véhicule"
+ },
+ "it-it": {
+ "tts": "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici.",
+ "label": "Informazioni sul veicolo"
+ },
+ "nl-nl": {
+ "tts": "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning.",
+ "label": "Voertuiginformatie"
+ },
+ "pl-pl": {
+ "tts": "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon.",
+ "label": "Informacje o pojeździe"
+ },
+ "pt-br": {
+ "tts": "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus.",
+ "label": "Informações sobre o veículo"
+ },
+ "pt-pt": {
+ "tts": "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus.",
+ "label": "Informações do veículo"
+ },
+ "ru-ru": {
+ "tts": "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин.",
+ "label": "Информация об автомобиле"
+ },
+ "sv-se": {
+ "tts": "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck.",
+ "label": "Fordonsinformation"
+ },
+ "tr-tr": {
+ "tts": "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı.",
+ "label": "Araç bilgisi"
+ },
+ "zh-cn": {
+ "tts": "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压.",
+ "label": "车辆信息"
+ },
+ "zh-tw": {
+ "tts": "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓.",
+ "label": "車輛資訊"
+ }
+ }
+ }
+ }
+ },
+ "app_policies": {
+ "default": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "Base-4"
+ ],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ },
+ "device": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "DataConsent-2"
+ ]
+ },
+ "pre_DataConsent": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "BaseBeforeDataConsent"
+ ],
+ "RequestType": [
+ "PROPRIETARY"
+ ]
+ },
+ "584421907": {
+ "keep_context": false,
+ "steal_focus": false,
+ "priority": "NONE",
+ "default_hmi": "NONE",
+ "groups": [
+ "BaseBeforeDataConsent"
+ ],
+ "RequestType": [
+ "TRAFFIC_MESSAGE_CHANNEL",
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
+ }
+ }
+ }
+} \ No newline at end of file
diff --git a/src/components/policy/test/qdbserver.sh b/src/components/policy/test/qdbserver.sh
deleted file mode 100755
index 3f0144106d..0000000000
--- a/src/components/policy/test/qdbserver.sh
+++ /dev/null
@@ -1,6 +0,0 @@
-# This script star QDB server for SDL
-# Need superuser to start qdb
-
-LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/qnx650/target/qnx6/x86/usr/lib
-export LD_LIBRARY_PATH
-/usr/sbin/qdb -c test-qdb.ini
diff --git a/src/components/policy/test/sdl_preloaded_pt.json b/src/components/policy/test/sdl_preloaded_pt.json
index 6ef60616c7..d6f34c12fc 100644
--- a/src/components/policy/test/sdl_preloaded_pt.json
+++ b/src/components/policy/test/sdl_preloaded_pt.json
@@ -2,10 +2,11 @@
"policy_table": {
"module_config": {
"preloaded_pt": true,
+ "preloaded_date": "2015-02-12",
"exchange_after_x_ignition_cycles": 100,
"exchange_after_x_kilometers": 1800,
"exchange_after_x_days": 30,
- "timeout_after_x_seconds": 60,
+ "timeout_after_x_seconds": 70,
"seconds_between_retries": [1,
5,
25,
@@ -1916,7 +1917,12 @@
"steal_focus": false,
"priority": "NONE",
"default_hmi": "NONE",
- "groups": ["Base-4"]
+ "groups": ["Base-4"],
+ "RequestType": [
+ "QUERY_APPS",
+ "LAUNCH_APP",
+ "PROPRIETARY"
+ ]
},
"device": {
"keep_context": false,
@@ -1930,7 +1936,8 @@
"steal_focus": false,
"priority": "NONE",
"default_hmi": "NONE",
- "groups": ["BaseBeforeDataConsent"]
+ "groups": ["BaseBeforeDataConsent"],
+ "RequestType": ["HTTP"]
}
}
}
diff --git a/src/components/policy/test/sdl_pt_first_update.json b/src/components/policy/test/sdl_pt_first_update.json
new file mode 100644
index 0000000000..e6817da0d3
--- /dev/null
+++ b/src/components/policy/test/sdl_pt_first_update.json
@@ -0,0 +1,1744 @@
+{
+ "policy_table" : {
+ "app_policies" : {
+ "1766825573" : {
+ "AppHMIType" : [ "MEDIA" ],
+ "certificate" : "akdjfhaliuygrglurng",
+ "default_hmi" : "BACKGROUND",
+ "groups" : [
+ "Notifications",
+ "Location-1",
+ "PropriataryData-1",
+ "Navigation-1",
+ "Base-4",
+ "VehicleInfo-3",
+ "DrivingCharacteristics-3",
+ "Emergency-1"
+ ],
+ "keep_context" : true,
+ "memory_kb" : 1000,
+ "nicknames" : [ "SyncProxyTester" ],
+ "priority" : "EMERGENCY",
+ "steal_focus" : true,
+ "heart_beat_timeout_ms": 5000
+ },
+ "default" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false
+ },
+ "device" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "memory_kb" : 1000,
+ "watchdog_timer_ms" : 20000,
+ "keep_context" : false,
+ "priority" : "NONE",
+ "steal_focus" : false
+ },
+ "pre_DataConsent" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "pre_Base-1" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false
+ }
+ },
+ "consumer_friendly_messages" : {
+ "messages" : {
+ "AppPermissions" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Zugriffsanfrage(n)",
+ "line2" : "erlauben?",
+ "tts" : "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-gb" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-ie" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-us" : {
+ "line1" : "Grant Requested",
+ "line2" : "Permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny."
+ },
+ "es-en" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "es-es" : {
+ "line1" : "¿Conceder permisos",
+ "line2" : "solicitados?",
+ "tts" : "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar."
+ },
+ "es-mx" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "line1" : "Concedi autorizzaz.",
+ "line2" : "richiesta(e)?",
+ "tts" : "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare."
+ },
+ "nl-nl" : {
+ "line1" : "Aangevraagde",
+ "line2" : "permissie(s) verlenen?",
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "line1" : "Udzielić żądanych",
+ "line2" : "pozwoleń?",
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "line1" : "Conceder permissão",
+ "line2" : "solicitada?",
+ "tts" : "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar."
+ },
+ "pt-pt" : {
+ "line1" : "Conceder permiss.",
+ "line2" : "solicitada(s)?",
+ "tts" : "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar."
+ },
+ "ru-ru" : {
+ "line1" : "Предост. заправш.",
+ "line2" : "разрешения?",
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны."
+ },
+ "sv-se" : {
+ "line1" : "Vill du ge",
+ "line2" : "tillstånd?",
+ "tts" : "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "line1" : "İstenen izinler",
+ "line2" : "verilsin mi?",
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否允许请求的",
+ "line2" : "权限?",
+ "tts" : "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "line1" : "允許",
+ "line2" : "授權請求?",
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsHelp" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es" : {
+ "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "tts" : "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl" : {
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "tts" : "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt" : {
+ "tts" : "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru" : {
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se" : {
+ "tts" : "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "tts" : "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it" : {
+ "tts" : "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl" : {
+ "tts" : "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl" : {
+ "tts" : "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br" : {
+ "tts" : "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt" : {
+ "tts" : "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru" : {
+ "tts" : "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se" : {
+ "tts" : "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr" : {
+ "tts" : "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn" : {
+ "tts" : "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw" : {
+ "tts" : "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht autorisiert",
+ "tts" : "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren."
+ },
+ "en-au" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "es-en" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No autorizada",
+ "tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "it-it" : {
+ "line1" : "non autorizzata",
+ "tts" : "Questa versione di %appName% non è autorizzata e non funziona con il SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet geautoriseerd",
+ "tts" : "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "brak autoryzacji",
+ "tts" : "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não autorizado",
+ "tts" : "Esta versão do %appName% não tem autorização e não funcionará com o SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não autorizada",
+ "tts" : "Esta versão de %appName% não está autorizada e não funcionará com o SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не авторизировано",
+ "tts" : "Эта версия %appName% не авторизирована и не будет работать с SYNC."
+ },
+ "sv-se" : {
+ "line1" : "är ej godkänd",
+ "tts" : "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC."
+ },
+ "tr-tr" : {
+ "line1" : "için izin yok",
+ "tts" : "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz."
+ },
+ "zh-cn" : {
+ "line1" : "未得到授权",
+ "tts" : "此版本的%appName% 未得到授权,无法在SYNC上使用。"
+ },
+ "zh-tw" : {
+ "line1" : "無授權",
+ "tts" : "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。"
+ }
+ }
+ },
+ "AppUnsupported" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht unterstützt",
+ "tts" : "Diese Version von %appName% wird von SYNC nicht unterstützt."
+ },
+ "en-au" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "es-en" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "it-it" : {
+ "line1" : "non supportata",
+ "tts" : "Questa versione di %appName% non è supportata dal SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet ondersteund",
+ "tts" : "Deze versie van %appName% wordt niet ondersteund door SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "aplikacja nie obsług.",
+ "tts" : "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não suportado",
+ "tts" : "Esta versão do %appName% não é suportada pelo SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não suportada",
+ "tts" : "Esta versão de %appName% não é suportado pelo SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не поддерживается",
+ "tts" : "Эта версия %appName% не поддерживается SYNC."
+ },
+ "sv-se" : {
+ "line1" : "stöds ej",
+ "tts" : "SYNC har inte stöd för den här versionen av %appName%."
+ },
+ "tr-tr" : {
+ "line1" : "desteklenmiyor",
+ "tts" : "Bu %appName% sürümü SYNC tarafından desteklenmiyor."
+ },
+ "zh-cn" : {
+ "line1" : "不受支持",
+ "tts" : "SYNC不支持此版本的%appName%。"
+ },
+ "zh-tw" : {
+ "line1" : "不支援",
+ "tts" : "SYNC 不支援此版本的%appName% 。"
+ }
+ }
+ },
+ "DataConsent" : {
+ "languages" : {
+ "en-us" : {
+ "line1" : "Enable Mobile Apps",
+ "line2" : "on SYNC? (Uses Data)",
+ "tts" : "To use mobile apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device's data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Please press yes or no, or help for more information. "
+ }
+ }
+ },
+ "DataConsentHelp" : {
+ "languages" : {
+ "en-us" : {
+ "tts" : "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC mobile apps settings menu. See your Owner Guide for more information. "
+ }
+ }
+ },
+ "DisableApps" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Auto-Update",
+ "line2" : "und Mobile Apps deaktivieren",
+ "tts" : "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen."
+ },
+ "en-au" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-gb" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-us" : {
+ "line1" : "Disable Auto-Updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es" : {
+ "line1" : "¿Desact. actual. auto",
+ "line2" : "y apl. móviles?",
+ "tts" : "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar."
+ },
+ "es-mx" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "it-it" : {
+ "line1" : "Disabilitare agg. aut.",
+ "line2" : "e app mobili?",
+ "tts" : "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare."
+ },
+ "nl-nl" : {
+ "line1" : "Auto-updates en mob.",
+ "line2" : "apps uitschakelen?",
+ "tts" : "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren."
+ },
+ "pl-pl" : {
+ "line1" : "Wył. automat. aktual.",
+ "line2" : "i aplikacje mobilne?",
+ "tts" : "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować."
+ },
+ "pt-br" : {
+ "line1" : "Desativar atualizações",
+ "line2" : "autom. e aplicativos?",
+ "tts" : "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actual. autom.",
+ "line2" : "e aplicações móveis?",
+ "tts" : "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. автообновления",
+ "line2" : "и мобил. прилож.?",
+ "tts" : "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены."
+ },
+ "sv-se" : {
+ "line1" : "Avaktiverar autouppdat.",
+ "line2" : "och mobilappar?",
+ "tts" : "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta."
+ },
+ "tr-tr" : {
+ "line1" : "Oto. güncelleme ve",
+ "line2" : "mobil uygul. kapat?",
+ "tts" : "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否禁用自动更新和",
+ "line2" : "移动应用程序?",
+ "tts" : "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。"
+ },
+ "zh-tw" : {
+ "line1" : "停用自動更新",
+ "line2" : "和行動應用程式?",
+ "tts" : "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。"
+ }
+ }
+ },
+ "DrivingCharacteristics" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahreigenschaften",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus."
+ },
+ "en-au" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-gb" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-us" : {
+ "label" : "Driving Characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es" : {
+ "label" : "Características de conducción",
+ "tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad."
+ },
+ "es-mx" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "it-it" : {
+ "label" : "Caratteristiche di guida",
+ "tts" : "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza."
+ },
+ "nl-nl" : {
+ "label" : "Rijkenmerken",
+ "tts" : "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus."
+ },
+ "pl-pl" : {
+ "label" : "Informacje dotyczące stylu jazdy",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa."
+ },
+ "pt-br" : {
+ "label" : "Características de condução",
+ "tts" : "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança."
+ },
+ "pt-pt" : {
+ "label" : "Características de condução",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança."
+ },
+ "ru-ru" : {
+ "label" : "Характеристики движения",
+ "tts" : "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности."
+ },
+ "sv-se" : {
+ "label" : "Köregenskaper",
+ "tts" : "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus."
+ },
+ "tr-tr" : {
+ "label" : "Sürüş karakteristikleri",
+ "tts" : "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu."
+ },
+ "zh-cn" : {
+ "label" : "行驶特性",
+ "tts" : "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态"
+ },
+ "zh-tw" : {
+ "label" : "駕駛特性",
+ "tts" : "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態"
+ }
+ }
+ },
+ "Location" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "GPS und Geschwindigkeit",
+ "tts" : "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs."
+ },
+ "en-au" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-gb" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-ie" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-us" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "es-en" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo."
+ },
+ "es-mx" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "it-it" : {
+ "label" : "GPS e velocità",
+ "tts" : "Un'app può avere accesso a GPS e velocità del veicolo."
+ },
+ "nl-nl" : {
+ "label" : "Gps en snelheid",
+ "tts" : "Een app heeft toegang tot gps en de snelheid van het voertuig."
+ },
+ "pl-pl" : {
+ "label" : "GPS i prędkość",
+ "tts" : "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu."
+ },
+ "pt-br" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Um aplicativo pode acessar o GPS e a velocidade do veículo."
+ },
+ "pt-pt" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Uma aplicação consegue aceder ao GPS e à velocidade do veículo."
+ },
+ "ru-ru" : {
+ "label" : "GPS и скорость",
+ "tts" : "Приложение имеет доступ к GPS и скорости автомобиля."
+ },
+ "sv-se" : {
+ "label" : "GPS och hastighet",
+ "tts" : "Appen kan komma åt fordonets GPS och hastighetsmätare."
+ },
+ "tr-tr" : {
+ "label" : "GPS ve hız",
+ "tts" : "Bu uygulama aracın GPS ve hız bilgilerine erişebilir."
+ },
+ "zh-cn" : {
+ "label" : "GPS 和车速",
+ "tts" : "移动应用程序可以访问车辆 GPS 和车速信息。"
+ },
+ "zh-tw" : {
+ "label" : "GPS和車速",
+ "tts" : "應用程式可存取車輛的GPS和速度。"
+ }
+ }
+ },
+ "Notifications" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Push-Benachrichtigungen",
+ "tts" : "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden."
+ },
+ "en-au" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-gb" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-ie" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-us" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "es-en" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es" : {
+ "label" : "Notificaciones push",
+ "tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano."
+ },
+ "es-mx" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca" : {
+ "label" : "Notifications instantanées",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr" : {
+ "label" : "Notifications push",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "it-it" : {
+ "label" : "Notifiche push",
+ "tts" : "Un'app può inviare notifiche se eseguita in background."
+ },
+ "nl-nl" : {
+ "label" : "Push-meldingen",
+ "tts" : "Een app kan meldingen versturen als deze op de achtergrond actief is."
+ },
+ "pl-pl" : {
+ "label" : "Powiadomienia Push",
+ "tts" : "Aplikacja może wysyłać powiadomienia, działając w tle."
+ },
+ "pt-br" : {
+ "label" : "Notificações Push",
+ "tts" : "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano."
+ },
+ "pt-pt" : {
+ "label" : "Notificações push",
+ "tts" : "Uma aplicação consegue enviar notificações quando está activa em segundo plano."
+ },
+ "ru-ru" : {
+ "label" : "Оповещения о пересылке",
+ "tts" : "Если приложение работает в фоновом режиме, оно может отправлять оповещения."
+ },
+ "sv-se" : {
+ "label" : "Push-notiser",
+ "tts" : "Appen kan skicka meddelanden när den körs i bakgrunden."
+ },
+ "tr-tr" : {
+ "label" : "Anlık bildirimleri",
+ "tts" : "Bir uygulama arka planda çalışırken bildirim gönderebilir."
+ },
+ "zh-cn" : {
+ "label" : "推送通知",
+ "tts" : "移动应用程序在后台运行时可推送通知。"
+ },
+ "zh-tw" : {
+ "label" : "傳送通知",
+ "tts" : "車輛行進時,應用程式可在背景中傳送通知。"
+ }
+ }
+ },
+ "SettingDisableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Updates deakt."
+ },
+ "en-au" : {
+ "line1" : "Disable updates"
+ },
+ "en-gb" : {
+ "line1" : "Disable updates"
+ },
+ "en-ie" : {
+ "line1" : "Disable updates"
+ },
+ "en-us" : {
+ "line1" : "Disable Updates"
+ },
+ "es-en" : {
+ "line1" : "Deshab. actual."
+ },
+ "es-es" : {
+ "line1" : "Desact. actual."
+ },
+ "es-mx" : {
+ "line1" : "Deshab. actual."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj"
+ },
+ "it-it" : {
+ "line1" : "Disabilita agg."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. uitschak."
+ },
+ "pl-pl" : {
+ "line1" : "Wyłącz aktual."
+ },
+ "pt-br" : {
+ "line1" : "Desat. atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Inaktivera uppd."
+ },
+ "tr-tr" : {
+ "line1" : "Güncell. Kapat"
+ },
+ "zh-cn" : {
+ "line1" : "禁用更新"
+ },
+ "zh-tw" : {
+ "line1" : "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Apps aktivieren"
+ },
+ "en-au" : {
+ "line1" : "Enable Apps"
+ },
+ "en-gb" : {
+ "line1" : "Enable Apps"
+ },
+ "en-ie" : {
+ "line1" : "Enable Apps"
+ },
+ "en-us" : {
+ "line1" : "Enable Apps"
+ },
+ "es-en" : {
+ "line1" : "Hab. aplic."
+ },
+ "es-es" : {
+ "line1" : "Activar apl."
+ },
+ "es-mx" : {
+ "line1" : "Hab. aplic."
+ },
+ "fr-ca" : {
+ "line1" : "Activer app."
+ },
+ "fr-fr" : {
+ "line1" : "Activer app."
+ },
+ "it-it" : {
+ "line1" : "Abilita app"
+ },
+ "nl-nl" : {
+ "line1" : "Apps inschak."
+ },
+ "pl-pl" : {
+ "line1" : "Włącz aplikacje"
+ },
+ "pt-br" : {
+ "line1" : "Ativar aplic."
+ },
+ "pt-pt" : {
+ "line1" : "Activar actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Вкл. прилож."
+ },
+ "sv-se" : {
+ "line1" : "Aktivera appar"
+ },
+ "tr-tr" : {
+ "line1" : "Uygulamaları aç"
+ },
+ "zh-cn" : {
+ "line1" : "启用应用程序"
+ },
+ "zh-tw" : {
+ "line1" : "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update anford."
+ },
+ "en-au" : {
+ "line1" : "Request update"
+ },
+ "en-gb" : {
+ "line1" : "Request update"
+ },
+ "en-ie" : {
+ "line1" : "Request update"
+ },
+ "en-us" : {
+ "line1" : "Request Update"
+ },
+ "es-en" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "es-es" : {
+ "line1" : "Solicitar actual."
+ },
+ "es-mx" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "fr-ca" : {
+ "line1" : "Demander MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Demander màj"
+ },
+ "it-it" : {
+ "line1" : "Rich. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. aanvragen"
+ },
+ "pl-pl" : {
+ "line1" : "Zażądaj aktual."
+ },
+ "pt-br" : {
+ "line1" : "Solicitar atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Запрос на обн."
+ },
+ "sv-se" : {
+ "line1" : "Begär uppdat."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleme iste"
+ },
+ "zh-cn" : {
+ "line1" : "请求更新"
+ },
+ "zh-tw" : {
+ "line1" : "請求更新"
+ }
+ }
+ },
+ "StatusNeeded" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update benötigt"
+ },
+ "en-au" : {
+ "line1" : "Update needed"
+ },
+ "en-gb" : {
+ "line1" : "Update needed"
+ },
+ "en-ie" : {
+ "line1" : "Update needed"
+ },
+ "en-us" : {
+ "line1" : "Update Needed"
+ },
+ "es-en" : {
+ "line1" : "Actualiz. neces."
+ },
+ "es-es" : {
+ "line1" : "Actu. necesaria"
+ },
+ "es-mx" : {
+ "line1" : "Actualiz. neces."
+ },
+ "fr-ca" : {
+ "line1" : "Màj requise"
+ },
+ "fr-fr" : {
+ "line1" : "Mise à jour requise"
+ },
+ "it-it" : {
+ "line1" : "Necess. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Update nodig"
+ },
+ "pl-pl" : {
+ "line1" : "Potrzeba aktual."
+ },
+ "pt-br" : {
+ "line1" : "Atualiz. necess."
+ },
+ "pt-pt" : {
+ "line1" : "Actual. necess."
+ },
+ "ru-ru" : {
+ "line1" : "Необх. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs"
+ },
+ "tr-tr" : {
+ "line1" : "Güncellenmeli"
+ },
+ "zh-cn" : {
+ "line1" : "需要进行更新"
+ },
+ "zh-tw" : {
+ "line1" : "需更新"
+ }
+ }
+ },
+ "StatusPending" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktualisieren..."
+ },
+ "en-au" : {
+ "line1" : "Updating..."
+ },
+ "en-gb" : {
+ "line1" : "Updating..."
+ },
+ "en-ie" : {
+ "line1" : "Updating..."
+ },
+ "en-us" : {
+ "line1" : "Updating..."
+ },
+ "es-en" : {
+ "line1" : "Actualizando..."
+ },
+ "es-es" : {
+ "line1" : "Actualizando..."
+ },
+ "es-mx" : {
+ "line1" : "Actualizando..."
+ },
+ "fr-ca" : {
+ "line1" : "MAJ en cours..."
+ },
+ "fr-fr" : {
+ "line1" : "Màj en cours..."
+ },
+ "it-it" : {
+ "line1" : "Aggiornamento"
+ },
+ "nl-nl" : {
+ "line1" : "Updaten..."
+ },
+ "pl-pl" : {
+ "line1" : "Aktualizowanie"
+ },
+ "pt-br" : {
+ "line1" : "Atualizando..."
+ },
+ "pt-pt" : {
+ "line1" : "A actualizar..."
+ },
+ "ru-ru" : {
+ "line1" : "Обновление..."
+ },
+ "sv-se" : {
+ "line1" : "Uppdaterar..."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleniyor..."
+ },
+ "zh-cn" : {
+ "line1" : "正在更新......"
+ },
+ "zh-tw" : {
+ "line1" : "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktuelle Version"
+ },
+ "en-au" : {
+ "line1" : "Up-to-date"
+ },
+ "en-gb" : {
+ "line1" : "Up-to-date"
+ },
+ "en-ie" : {
+ "line1" : "Up-to-date"
+ },
+ "en-us" : {
+ "line1" : "Up-To-Date"
+ },
+ "es-en" : {
+ "line1" : "Actualizado"
+ },
+ "es-es" : {
+ "line1" : "Actualizada"
+ },
+ "es-mx" : {
+ "line1" : "Actualizado"
+ },
+ "fr-ca" : {
+ "line1" : "Déjà à jour"
+ },
+ "fr-fr" : {
+ "line1" : "Déjà à jour"
+ },
+ "it-it" : {
+ "line1" : "più recente"
+ },
+ "nl-nl" : {
+ "line1" : "Up-to-date"
+ },
+ "pl-pl" : {
+ "line1" : "Aktualne"
+ },
+ "pt-br" : {
+ "line1" : "Atualizado"
+ },
+ "pt-pt" : {
+ "line1" : "Actualizado"
+ },
+ "ru-ru" : {
+ "line1" : "Обновлено"
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs ej"
+ },
+ "tr-tr" : {
+ "line1" : "Güncel"
+ },
+ "zh-cn" : {
+ "line1" : "最新更新"
+ },
+ "zh-tw" : {
+ "line1" : "更新最新"
+ }
+ }
+ },
+ "VehicleInfo" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahrzeuginformationen",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck."
+ },
+ "en-au" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-gb" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-ie" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-us" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es" : {
+ "label" : "Información del vehículo",
+ "tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos."
+ },
+ "es-mx" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus."
+ },
+ "it-it" : {
+ "label" : "Informazioni sul veicolo",
+ "tts" : "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici."
+ },
+ "nl-nl" : {
+ "label" : "Voertuiginformatie",
+ "tts" : "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning."
+ },
+ "pl-pl" : {
+ "label" : "Informacje o pojeździe",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon."
+ },
+ "pt-br" : {
+ "label" : "Informações sobre o veículo",
+ "tts" : "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus."
+ },
+ "pt-pt" : {
+ "label" : "Informações do veículo",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus."
+ },
+ "ru-ru" : {
+ "label" : "Информация об автомобиле",
+ "tts" : "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин."
+ },
+ "sv-se" : {
+ "label" : "Fordonsinformation",
+ "tts" : "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck."
+ },
+ "tr-tr" : {
+ "label" : "Araç bilgisi",
+ "tts" : "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı."
+ },
+ "zh-cn" : {
+ "label" : "车辆信息",
+ "tts" : "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压."
+ },
+ "zh-tw" : {
+ "label" : "車輛資訊",
+ "tts" : "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓."
+ }
+ }
+ }
+ },
+ "version" : "001.001.015"
+ },
+ "functional_groupings" : {
+ "Base-4" : {
+ "rpcs" : {
+ "AddCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "AddSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Alert" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "CreateInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "EncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "EndAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnButtonEvent" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnButtonPress" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnCommand" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnDriverDistraction" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnEncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnHMIStatus" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnTBTClientState" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "PerformAudioPassThru" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PerformInteraction" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ScrollableMessage" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetMediaClockTimer" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "Show" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Slider" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "Speak" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "SubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnsubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ },
+ "user_consent_prompt" : "DrivingCharacteristics"
+ },
+ "Emergency-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Location-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ }
+ },
+ "user_consent_prompt" : "Location"
+ },
+ "Navigation-1" : {
+ "rpcs" : {
+ "AlertManeuver" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ShowConstantTBT" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UpdateTurnList" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "Notifications" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "BACKGROUND" ]
+ }
+ },
+ "user_consent_prompt" : "Notifications"
+ },
+ "Notifications-2" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "FULL" ]
+ }
+ },
+ "user_consent_prompt" : "Old_Notifications"
+ },
+ "Notifications-3" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "LIMITED" ]
+ }
+ },
+ "user_consent_prompt" : "Old_Notifications"
+ },
+ "Notifications-4" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "NONE" ]
+ }
+ },
+ "user_consent_prompt" : "New_Notifications"
+ },
+ "PropriataryData-1" : {
+ "rpcs" : {
+ "DiagnosticMessage" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GetDTCs" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ReadDID" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "VehicleInfo-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ },
+ "user_consent_prompt" : "VehicleInfo"
+ },
+ "pre_Base-1" : {
+ "rpcs" : {
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ }
+ }
+ }
+ },
+ "module_config" : {
+ "device_certificates" : {
+ "HUU40DAS7F970UEI17A73JH32L41K32JH4L1K234H3K4" : "aldhfkahfgkafrblgjr"
+ },
+ "endpoints" : {
+ "0x07" : {
+ "default" : [ "http://policies.telematics.ford.com/api/policies" ]
+ }
+ },
+ "exchange_after_x_days" : 30,
+ "exchange_after_x_ignition_cycles" : 100,
+ "exchange_after_x_kilometers" : 1800,
+ "notifications_per_minute_by_priority" : {
+ "COMMUNICATION" : 6,
+ "EMERGENCY" : 60,
+ "NAVIGATION" : 15,
+ "NONE" : 0,
+ "NORMAL" : 4,
+ "VOICECOMM" : 10
+ },
+ "seconds_between_retries" : [ 1, 5, 25, 125, 625 ],
+ "timeout_after_x_seconds" : 60,
+ "vehicle_make" : "Stark Industries",
+ "vehicle_model" : "E-Tron",
+ "vehicle_year" : "1992"
+ }
+ }
+}
diff --git a/src/components/policy/test/sdl_pt_second_update.json b/src/components/policy/test/sdl_pt_second_update.json
new file mode 100644
index 0000000000..d5f5f480f3
--- /dev/null
+++ b/src/components/policy/test/sdl_pt_second_update.json
@@ -0,0 +1,1744 @@
+{
+ "policy_table" : {
+ "app_policies" : {
+ "1766825573" : {
+ "AppHMIType" : [ "MEDIA" ],
+ "certificate" : "akdjfhaliuygrglurng",
+ "default_hmi" : "BACKGROUND",
+ "groups" : [
+ "Notifications",
+ "Location-1",
+ "PropriataryData-1",
+ "Navigation-1",
+ "Base-4",
+ "VehicleInfo-3",
+ "DrivingCharacteristics-3",
+ "Emergency-1"
+ ],
+ "keep_context" : true,
+ "memory_kb" : 1000,
+ "nicknames" : [ "SyncProxyTester" ],
+ "priority" : "EMERGENCY",
+ "steal_focus" : true,
+ "heart_beat_timeout_ms": 5000
+ },
+ "default" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false
+ },
+ "device" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "memory_kb" : 1000,
+ "watchdog_timer_ms" : 20000,
+ "keep_context" : false,
+ "priority" : "NONE",
+ "steal_focus" : false
+ },
+ "pre_DataConsent" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "pre_Base-1" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false
+ }
+ },
+ "consumer_friendly_messages" : {
+ "messages" : {
+ "AppPermissions" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Zugriffsanfrage(n)",
+ "line2" : "erlauben?",
+ "tts" : "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-gb" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-ie" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-us" : {
+ "line1" : "Grant Requested",
+ "line2" : "Permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny."
+ },
+ "es-en" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "es-es" : {
+ "line1" : "¿Conceder permisos",
+ "line2" : "solicitados?",
+ "tts" : "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar."
+ },
+ "es-mx" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "line1" : "Concedi autorizzaz.",
+ "line2" : "richiesta(e)?",
+ "tts" : "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare."
+ },
+ "nl-nl" : {
+ "line1" : "Aangevraagde",
+ "line2" : "permissie(s) verlenen?",
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "line1" : "Udzielić żądanych",
+ "line2" : "pozwoleń?",
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "line1" : "Conceder permissão",
+ "line2" : "solicitada?",
+ "tts" : "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar."
+ },
+ "pt-pt" : {
+ "line1" : "Conceder permiss.",
+ "line2" : "solicitada(s)?",
+ "tts" : "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar."
+ },
+ "ru-ru" : {
+ "line1" : "Предост. заправш.",
+ "line2" : "разрешения?",
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны."
+ },
+ "sv-se" : {
+ "line1" : "Vill du ge",
+ "line2" : "tillstånd?",
+ "tts" : "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "line1" : "İstenen izinler",
+ "line2" : "verilsin mi?",
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否允许请求的",
+ "line2" : "权限?",
+ "tts" : "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "line1" : "允許",
+ "line2" : "授權請求?",
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsHelp" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es" : {
+ "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "tts" : "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl" : {
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "tts" : "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt" : {
+ "tts" : "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru" : {
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se" : {
+ "tts" : "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "tts" : "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it" : {
+ "tts" : "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl" : {
+ "tts" : "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl" : {
+ "tts" : "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br" : {
+ "tts" : "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt" : {
+ "tts" : "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru" : {
+ "tts" : "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se" : {
+ "tts" : "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr" : {
+ "tts" : "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn" : {
+ "tts" : "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw" : {
+ "tts" : "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht autorisiert",
+ "tts" : "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren."
+ },
+ "en-au" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "es-en" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No autorizada",
+ "tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "it-it" : {
+ "line1" : "non autorizzata",
+ "tts" : "Questa versione di %appName% non è autorizzata e non funziona con il SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet geautoriseerd",
+ "tts" : "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "brak autoryzacji",
+ "tts" : "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não autorizado",
+ "tts" : "Esta versão do %appName% não tem autorização e não funcionará com o SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não autorizada",
+ "tts" : "Esta versão de %appName% não está autorizada e não funcionará com o SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не авторизировано",
+ "tts" : "Эта версия %appName% не авторизирована и не будет работать с SYNC."
+ },
+ "sv-se" : {
+ "line1" : "är ej godkänd",
+ "tts" : "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC."
+ },
+ "tr-tr" : {
+ "line1" : "için izin yok",
+ "tts" : "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz."
+ },
+ "zh-cn" : {
+ "line1" : "未得到授权",
+ "tts" : "此版本的%appName% 未得到授权,无法在SYNC上使用。"
+ },
+ "zh-tw" : {
+ "line1" : "無授權",
+ "tts" : "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。"
+ }
+ }
+ },
+ "AppUnsupported" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht unterstützt",
+ "tts" : "Diese Version von %appName% wird von SYNC nicht unterstützt."
+ },
+ "en-au" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "es-en" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "it-it" : {
+ "line1" : "non supportata",
+ "tts" : "Questa versione di %appName% non è supportata dal SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet ondersteund",
+ "tts" : "Deze versie van %appName% wordt niet ondersteund door SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "aplikacja nie obsług.",
+ "tts" : "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não suportado",
+ "tts" : "Esta versão do %appName% não é suportada pelo SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não suportada",
+ "tts" : "Esta versão de %appName% não é suportado pelo SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не поддерживается",
+ "tts" : "Эта версия %appName% не поддерживается SYNC."
+ },
+ "sv-se" : {
+ "line1" : "stöds ej",
+ "tts" : "SYNC har inte stöd för den här versionen av %appName%."
+ },
+ "tr-tr" : {
+ "line1" : "desteklenmiyor",
+ "tts" : "Bu %appName% sürümü SYNC tarafından desteklenmiyor."
+ },
+ "zh-cn" : {
+ "line1" : "不受支持",
+ "tts" : "SYNC不支持此版本的%appName%。"
+ },
+ "zh-tw" : {
+ "line1" : "不支援",
+ "tts" : "SYNC 不支援此版本的%appName% 。"
+ }
+ }
+ },
+ "DataConsent" : {
+ "languages" : {
+ "en-us" : {
+ "line1" : "Enable Mobile Apps",
+ "line2" : "on SYNC? (Uses Data)",
+ "tts" : "To use mobile apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device's data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Please press yes or no, or help for more information. "
+ }
+ }
+ },
+ "DataConsentHelp" : {
+ "languages" : {
+ "en-us" : {
+ "tts" : "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC mobile apps settings menu. See your Owner Guide for more information. "
+ }
+ }
+ },
+ "DisableApps" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Auto-Update",
+ "line2" : "und Mobile Apps deaktivieren",
+ "tts" : "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen."
+ },
+ "en-au" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-gb" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-us" : {
+ "line1" : "Disable Auto-Updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es" : {
+ "line1" : "¿Desact. actual. auto",
+ "line2" : "y apl. móviles?",
+ "tts" : "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar."
+ },
+ "es-mx" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "it-it" : {
+ "line1" : "Disabilitare agg. aut.",
+ "line2" : "e app mobili?",
+ "tts" : "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare."
+ },
+ "nl-nl" : {
+ "line1" : "Auto-updates en mob.",
+ "line2" : "apps uitschakelen?",
+ "tts" : "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren."
+ },
+ "pl-pl" : {
+ "line1" : "Wył. automat. aktual.",
+ "line2" : "i aplikacje mobilne?",
+ "tts" : "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować."
+ },
+ "pt-br" : {
+ "line1" : "Desativar atualizações",
+ "line2" : "autom. e aplicativos?",
+ "tts" : "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actual. autom.",
+ "line2" : "e aplicações móveis?",
+ "tts" : "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. автообновления",
+ "line2" : "и мобил. прилож.?",
+ "tts" : "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены."
+ },
+ "sv-se" : {
+ "line1" : "Avaktiverar autouppdat.",
+ "line2" : "och mobilappar?",
+ "tts" : "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta."
+ },
+ "tr-tr" : {
+ "line1" : "Oto. güncelleme ve",
+ "line2" : "mobil uygul. kapat?",
+ "tts" : "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否禁用自动更新和",
+ "line2" : "移动应用程序?",
+ "tts" : "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。"
+ },
+ "zh-tw" : {
+ "line1" : "停用自動更新",
+ "line2" : "和行動應用程式?",
+ "tts" : "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。"
+ }
+ }
+ },
+ "DrivingCharacteristics" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahreigenschaften",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus."
+ },
+ "en-au" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-gb" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-us" : {
+ "label" : "Driving Characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es" : {
+ "label" : "Características de conducción",
+ "tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad."
+ },
+ "es-mx" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "it-it" : {
+ "label" : "Caratteristiche di guida",
+ "tts" : "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza."
+ },
+ "nl-nl" : {
+ "label" : "Rijkenmerken",
+ "tts" : "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus."
+ },
+ "pl-pl" : {
+ "label" : "Informacje dotyczące stylu jazdy",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa."
+ },
+ "pt-br" : {
+ "label" : "Características de condução",
+ "tts" : "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança."
+ },
+ "pt-pt" : {
+ "label" : "Características de condução",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança."
+ },
+ "ru-ru" : {
+ "label" : "Характеристики движения",
+ "tts" : "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности."
+ },
+ "sv-se" : {
+ "label" : "Köregenskaper",
+ "tts" : "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus."
+ },
+ "tr-tr" : {
+ "label" : "Sürüş karakteristikleri",
+ "tts" : "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu."
+ },
+ "zh-cn" : {
+ "label" : "行驶特性",
+ "tts" : "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态"
+ },
+ "zh-tw" : {
+ "label" : "駕駛特性",
+ "tts" : "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態"
+ }
+ }
+ },
+ "Location" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "GPS und Geschwindigkeit",
+ "tts" : "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs."
+ },
+ "en-au" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-gb" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-ie" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-us" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "es-en" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo."
+ },
+ "es-mx" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "it-it" : {
+ "label" : "GPS e velocità",
+ "tts" : "Un'app può avere accesso a GPS e velocità del veicolo."
+ },
+ "nl-nl" : {
+ "label" : "Gps en snelheid",
+ "tts" : "Een app heeft toegang tot gps en de snelheid van het voertuig."
+ },
+ "pl-pl" : {
+ "label" : "GPS i prędkość",
+ "tts" : "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu."
+ },
+ "pt-br" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Um aplicativo pode acessar o GPS e a velocidade do veículo."
+ },
+ "pt-pt" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Uma aplicação consegue aceder ao GPS e à velocidade do veículo."
+ },
+ "ru-ru" : {
+ "label" : "GPS и скорость",
+ "tts" : "Приложение имеет доступ к GPS и скорости автомобиля."
+ },
+ "sv-se" : {
+ "label" : "GPS och hastighet",
+ "tts" : "Appen kan komma åt fordonets GPS och hastighetsmätare."
+ },
+ "tr-tr" : {
+ "label" : "GPS ve hız",
+ "tts" : "Bu uygulama aracın GPS ve hız bilgilerine erişebilir."
+ },
+ "zh-cn" : {
+ "label" : "GPS 和车速",
+ "tts" : "移动应用程序可以访问车辆 GPS 和车速信息。"
+ },
+ "zh-tw" : {
+ "label" : "GPS和車速",
+ "tts" : "應用程式可存取車輛的GPS和速度。"
+ }
+ }
+ },
+ "Notifications" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Push-Benachrichtigungen",
+ "tts" : "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden."
+ },
+ "en-au" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-gb" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-ie" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-us" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "es-en" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es" : {
+ "label" : "Notificaciones push",
+ "tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano."
+ },
+ "es-mx" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca" : {
+ "label" : "Notifications instantanées",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr" : {
+ "label" : "Notifications push",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "it-it" : {
+ "label" : "Notifiche push",
+ "tts" : "Un'app può inviare notifiche se eseguita in background."
+ },
+ "nl-nl" : {
+ "label" : "Push-meldingen",
+ "tts" : "Een app kan meldingen versturen als deze op de achtergrond actief is."
+ },
+ "pl-pl" : {
+ "label" : "Powiadomienia Push",
+ "tts" : "Aplikacja może wysyłać powiadomienia, działając w tle."
+ },
+ "pt-br" : {
+ "label" : "Notificações Push",
+ "tts" : "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano."
+ },
+ "pt-pt" : {
+ "label" : "Notificações push",
+ "tts" : "Uma aplicação consegue enviar notificações quando está activa em segundo plano."
+ },
+ "ru-ru" : {
+ "label" : "Оповещения о пересылке",
+ "tts" : "Если приложение работает в фоновом режиме, оно может отправлять оповещения."
+ },
+ "sv-se" : {
+ "label" : "Push-notiser",
+ "tts" : "Appen kan skicka meddelanden när den körs i bakgrunden."
+ },
+ "tr-tr" : {
+ "label" : "Anlık bildirimleri",
+ "tts" : "Bir uygulama arka planda çalışırken bildirim gönderebilir."
+ },
+ "zh-cn" : {
+ "label" : "推送通知",
+ "tts" : "移动应用程序在后台运行时可推送通知。"
+ },
+ "zh-tw" : {
+ "label" : "傳送通知",
+ "tts" : "車輛行進時,應用程式可在背景中傳送通知。"
+ }
+ }
+ },
+ "SettingDisableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Updates deakt."
+ },
+ "en-au" : {
+ "line1" : "Disable updates"
+ },
+ "en-gb" : {
+ "line1" : "Disable updates"
+ },
+ "en-ie" : {
+ "line1" : "Disable updates"
+ },
+ "en-us" : {
+ "line1" : "Disable Updates"
+ },
+ "es-en" : {
+ "line1" : "Deshab. actual."
+ },
+ "es-es" : {
+ "line1" : "Desact. actual."
+ },
+ "es-mx" : {
+ "line1" : "Deshab. actual."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj"
+ },
+ "it-it" : {
+ "line1" : "Disabilita agg."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. uitschak."
+ },
+ "pl-pl" : {
+ "line1" : "Wyłącz aktual."
+ },
+ "pt-br" : {
+ "line1" : "Desat. atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Inaktivera uppd."
+ },
+ "tr-tr" : {
+ "line1" : "Güncell. Kapat"
+ },
+ "zh-cn" : {
+ "line1" : "禁用更新"
+ },
+ "zh-tw" : {
+ "line1" : "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Apps aktivieren"
+ },
+ "en-au" : {
+ "line1" : "Enable Apps"
+ },
+ "en-gb" : {
+ "line1" : "Enable Apps"
+ },
+ "en-ie" : {
+ "line1" : "Enable Apps"
+ },
+ "en-us" : {
+ "line1" : "Enable Apps"
+ },
+ "es-en" : {
+ "line1" : "Hab. aplic."
+ },
+ "es-es" : {
+ "line1" : "Activar apl."
+ },
+ "es-mx" : {
+ "line1" : "Hab. aplic."
+ },
+ "fr-ca" : {
+ "line1" : "Activer app."
+ },
+ "fr-fr" : {
+ "line1" : "Activer app."
+ },
+ "it-it" : {
+ "line1" : "Abilita app"
+ },
+ "nl-nl" : {
+ "line1" : "Apps inschak."
+ },
+ "pl-pl" : {
+ "line1" : "Włącz aplikacje"
+ },
+ "pt-br" : {
+ "line1" : "Ativar aplic."
+ },
+ "pt-pt" : {
+ "line1" : "Activar actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Вкл. прилож."
+ },
+ "sv-se" : {
+ "line1" : "Aktivera appar"
+ },
+ "tr-tr" : {
+ "line1" : "Uygulamaları aç"
+ },
+ "zh-cn" : {
+ "line1" : "启用应用程序"
+ },
+ "zh-tw" : {
+ "line1" : "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update anford."
+ },
+ "en-au" : {
+ "line1" : "Request update"
+ },
+ "en-gb" : {
+ "line1" : "Request update"
+ },
+ "en-ie" : {
+ "line1" : "Request update"
+ },
+ "en-us" : {
+ "line1" : "Request Update"
+ },
+ "es-en" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "es-es" : {
+ "line1" : "Solicitar actual."
+ },
+ "es-mx" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "fr-ca" : {
+ "line1" : "Demander MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Demander màj"
+ },
+ "it-it" : {
+ "line1" : "Rich. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. aanvragen"
+ },
+ "pl-pl" : {
+ "line1" : "Zażądaj aktual."
+ },
+ "pt-br" : {
+ "line1" : "Solicitar atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Запрос на обн."
+ },
+ "sv-se" : {
+ "line1" : "Begär uppdat."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleme iste"
+ },
+ "zh-cn" : {
+ "line1" : "请求更新"
+ },
+ "zh-tw" : {
+ "line1" : "請求更新"
+ }
+ }
+ },
+ "StatusNeeded" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update benötigt"
+ },
+ "en-au" : {
+ "line1" : "Update needed"
+ },
+ "en-gb" : {
+ "line1" : "Update needed"
+ },
+ "en-ie" : {
+ "line1" : "Update needed"
+ },
+ "en-us" : {
+ "line1" : "Update Needed"
+ },
+ "es-en" : {
+ "line1" : "Actualiz. neces."
+ },
+ "es-es" : {
+ "line1" : "Actu. necesaria"
+ },
+ "es-mx" : {
+ "line1" : "Actualiz. neces."
+ },
+ "fr-ca" : {
+ "line1" : "Màj requise"
+ },
+ "fr-fr" : {
+ "line1" : "Mise à jour requise"
+ },
+ "it-it" : {
+ "line1" : "Necess. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Update nodig"
+ },
+ "pl-pl" : {
+ "line1" : "Potrzeba aktual."
+ },
+ "pt-br" : {
+ "line1" : "Atualiz. necess."
+ },
+ "pt-pt" : {
+ "line1" : "Actual. necess."
+ },
+ "ru-ru" : {
+ "line1" : "Необх. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs"
+ },
+ "tr-tr" : {
+ "line1" : "Güncellenmeli"
+ },
+ "zh-cn" : {
+ "line1" : "需要进行更新"
+ },
+ "zh-tw" : {
+ "line1" : "需更新"
+ }
+ }
+ },
+ "StatusPending" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktualisieren..."
+ },
+ "en-au" : {
+ "line1" : "Updating..."
+ },
+ "en-gb" : {
+ "line1" : "Updating..."
+ },
+ "en-ie" : {
+ "line1" : "Updating..."
+ },
+ "en-us" : {
+ "line1" : "Updating..."
+ },
+ "es-en" : {
+ "line1" : "Actualizando..."
+ },
+ "es-es" : {
+ "line1" : "Actualizando..."
+ },
+ "es-mx" : {
+ "line1" : "Actualizando..."
+ },
+ "fr-ca" : {
+ "line1" : "MAJ en cours..."
+ },
+ "fr-fr" : {
+ "line1" : "Màj en cours..."
+ },
+ "it-it" : {
+ "line1" : "Aggiornamento"
+ },
+ "nl-nl" : {
+ "line1" : "Updaten..."
+ },
+ "pl-pl" : {
+ "line1" : "Aktualizowanie"
+ },
+ "pt-br" : {
+ "line1" : "Atualizando..."
+ },
+ "pt-pt" : {
+ "line1" : "A actualizar..."
+ },
+ "ru-ru" : {
+ "line1" : "Обновление..."
+ },
+ "sv-se" : {
+ "line1" : "Uppdaterar..."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleniyor..."
+ },
+ "zh-cn" : {
+ "line1" : "正在更新......"
+ },
+ "zh-tw" : {
+ "line1" : "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktuelle Version"
+ },
+ "en-au" : {
+ "line1" : "Up-to-date"
+ },
+ "en-gb" : {
+ "line1" : "Up-to-date"
+ },
+ "en-ie" : {
+ "line1" : "Up-to-date"
+ },
+ "en-us" : {
+ "line1" : "Up-To-Date"
+ },
+ "es-en" : {
+ "line1" : "Actualizado"
+ },
+ "es-es" : {
+ "line1" : "Actualizada"
+ },
+ "es-mx" : {
+ "line1" : "Actualizado"
+ },
+ "fr-ca" : {
+ "line1" : "Déjà à jour"
+ },
+ "fr-fr" : {
+ "line1" : "Déjà à jour"
+ },
+ "it-it" : {
+ "line1" : "più recente"
+ },
+ "nl-nl" : {
+ "line1" : "Up-to-date"
+ },
+ "pl-pl" : {
+ "line1" : "Aktualne"
+ },
+ "pt-br" : {
+ "line1" : "Atualizado"
+ },
+ "pt-pt" : {
+ "line1" : "Actualizado"
+ },
+ "ru-ru" : {
+ "line1" : "Обновлено"
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs ej"
+ },
+ "tr-tr" : {
+ "line1" : "Güncel"
+ },
+ "zh-cn" : {
+ "line1" : "最新更新"
+ },
+ "zh-tw" : {
+ "line1" : "更新最新"
+ }
+ }
+ },
+ "VehicleInfo" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahrzeuginformationen",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck."
+ },
+ "en-au" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-gb" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-ie" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-us" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es" : {
+ "label" : "Información del vehículo",
+ "tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos."
+ },
+ "es-mx" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus."
+ },
+ "it-it" : {
+ "label" : "Informazioni sul veicolo",
+ "tts" : "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici."
+ },
+ "nl-nl" : {
+ "label" : "Voertuiginformatie",
+ "tts" : "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning."
+ },
+ "pl-pl" : {
+ "label" : "Informacje o pojeździe",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon."
+ },
+ "pt-br" : {
+ "label" : "Informações sobre o veículo",
+ "tts" : "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus."
+ },
+ "pt-pt" : {
+ "label" : "Informações do veículo",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus."
+ },
+ "ru-ru" : {
+ "label" : "Информация об автомобиле",
+ "tts" : "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин."
+ },
+ "sv-se" : {
+ "label" : "Fordonsinformation",
+ "tts" : "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck."
+ },
+ "tr-tr" : {
+ "label" : "Araç bilgisi",
+ "tts" : "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı."
+ },
+ "zh-cn" : {
+ "label" : "车辆信息",
+ "tts" : "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压."
+ },
+ "zh-tw" : {
+ "label" : "車輛資訊",
+ "tts" : "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓."
+ }
+ }
+ }
+ },
+ "version" : "001.001.015"
+ },
+ "functional_groupings" : {
+ "Base-4" : {
+ "rpcs" : {
+ "AddCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "AddSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Alert" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "CreateInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "EncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "EndAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnButtonEvent" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnButtonPress" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnCommand" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnDriverDistraction" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnEncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnHMIStatus" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnTBTClientState" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "PerformAudioPassThru" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PerformInteraction" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ScrollableMessage" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetMediaClockTimer" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "Show" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Slider" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "Speak" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "SubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnsubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ },
+ "user_consent_prompt" : "DrivingCharacteristics"
+ },
+ "Emergency-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Location-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ }
+ },
+ "user_consent_prompt" : "Location"
+ },
+ "Navigation-1" : {
+ "rpcs" : {
+ "AlertManeuver" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ShowConstantTBT" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UpdateTurnList" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "Notifications" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "BACKGROUND" ]
+ }
+ },
+ "user_consent_prompt" : "Notifications"
+ },
+ "Notifications-2" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "FULL" ]
+ }
+ },
+ "user_consent_prompt" : "Old_Notifications"
+ },
+ "Notifications-3" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "LIMITED" ]
+ }
+ },
+ "user_consent_prompt" : "New_Notifications"
+ },
+ "Notifications-4" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "NONE" ]
+ }
+ },
+ "user_consent_prompt" : "New_Notifications"
+ },
+ "PropriataryData-1" : {
+ "rpcs" : {
+ "DiagnosticMessage" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GetDTCs" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ReadDID" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "VehicleInfo-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ },
+ "user_consent_prompt" : "VehicleInfo"
+ },
+ "pre_Base-1" : {
+ "rpcs" : {
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ }
+ }
+ }
+ },
+ "module_config" : {
+ "device_certificates" : {
+ "HUU40DAS7F970UEI17A73JH32L41K32JH4L1K234H3K4" : "aldhfkahfgkafrblgjr"
+ },
+ "endpoints" : {
+ "0x07" : {
+ "default" : [ "http://policies.telematics.ford.com/api/policies" ]
+ }
+ },
+ "exchange_after_x_days" : 30,
+ "exchange_after_x_ignition_cycles" : 100,
+ "exchange_after_x_kilometers" : 1800,
+ "notifications_per_minute_by_priority" : {
+ "COMMUNICATION" : 6,
+ "EMERGENCY" : 60,
+ "NAVIGATION" : 15,
+ "NONE" : 0,
+ "NORMAL" : 4,
+ "VOICECOMM" : 10
+ },
+ "seconds_between_retries" : [ 1, 5, 25, 125, 625 ],
+ "timeout_after_x_seconds" : 60,
+ "vehicle_make" : "Stark Industries",
+ "vehicle_model" : "E-Tron",
+ "vehicle_year" : "1992"
+ }
+ }
+}
diff --git a/src/components/policy/test/sdl_pt_update.json b/src/components/policy/test/sdl_pt_update.json
new file mode 100644
index 0000000000..a332f92382
--- /dev/null
+++ b/src/components/policy/test/sdl_pt_update.json
@@ -0,0 +1,1722 @@
+{
+ "policy_table" : {
+ "app_policies" : {
+ "1766825573" : {
+ "AppHMIType" : [ "MEDIA" ],
+ "certificate" : "akdjfhaliuygrglurng",
+ "default_hmi" : "BACKGROUND",
+ "groups" : [
+ "Notifications",
+ "Location-1",
+ "PropriataryData-1",
+ "Navigation-1",
+ "Base-4",
+ "VehicleInfo-3",
+ "DrivingCharacteristics-3",
+ "Emergency-1"
+ ],
+ "keep_context" : true,
+ "memory_kb" : 1000,
+ "nicknames" : [ "SyncProxyTester" ],
+ "priority" : "EMERGENCY",
+ "steal_focus" : true,
+ "watchdog_timer_ms" : 20000
+ },
+ "default" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false,
+ "watchdog_timer_ms" : 20000
+ },
+ "device" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "Base-4" ],
+ "memory_kb" : 1000,
+ "watchdog_timer_ms" : 20000,
+ "keep_context" : false,
+ "priority" : "NONE",
+ "steal_focus" : false
+ },
+ "pre_DataConsent" : {
+ "default_hmi" : "NONE",
+ "groups" : [ "pre_Base-1" ],
+ "keep_context" : false,
+ "memory_kb" : 1000,
+ "priority" : "NONE",
+ "steal_focus" : false,
+ "watchdog_timer_ms" : 20000
+ }
+ },
+ "consumer_friendly_messages" : {
+ "messages" : {
+ "AppPermissions" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Zugriffsanfrage(n)",
+ "line2" : "erlauben?",
+ "tts" : "%appName% benötigt die folgenden Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Wenn Sie Ja drücken, erklären Sie sich damit einverstanden, dass %vehicleMake% nicht für Schäden oder Verletzungen der Privatsphäre haftet, die im Zusammenhang mit der Nutzung Ihrer Benutzerdaten durch %appName% entstehen. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-gb" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-ie" : {
+ "line1" : "Grant requested",
+ "line2" : "permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press Yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press Yes to allow or No to deny."
+ },
+ "en-us" : {
+ "line1" : "Grant Requested",
+ "line2" : "Permission(s)?",
+ "tts" : "%appName% is requesting the use of the following vehicle information and permissions: %functionalGroupLabels%. If you press yes, you agree that %vehicleMake% will not be liable for any damages or loss of privacy related to %appName%'s use of your data. Please press yes to allow or no to deny."
+ },
+ "es-en" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "es-es" : {
+ "line1" : "¿Conceder permisos",
+ "line2" : "solicitados?",
+ "tts" : "%appName% está solicitando el uso de los siguientes permisos e información del vehículo: %functionalGroupLabels%. Si pulsa sí, acepta que %vehicleMake% no será responsable de los daños o la pérdida de privacidad relacionados con el uso de sus datos por parte de %appName%. Pulse sí para permitir o no para denegar."
+ },
+ "es-mx" : {
+ "line1" : "¿Otorgar permiso(s)",
+ "line2" : "solicitado(s)?",
+ "tts" : "%appName% solicita el uso de la siguiente información y permisos del vehículo: %functionalGroupLabels%. Si presiona Sí, acepta que %vehicleMake% no se hará responsable por los daños o pérdidas de privacidad relacionados con el uso que %appName% haga de sus datos. Presione Sí para permitir y No para denegar."
+ },
+ "fr-ca" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "line1" : "Accorder permission(s)",
+ "line2" : "demandée(s)",
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Si vous appuyez sur Oui, vous acceptez que %vehicleMake% ne sera pas responsable des dommages ou des pertes de confidentialité reliées à l’utilisation de vos données par %appName%. Veuillez appuyer sur Oui pour autoriser ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "line1" : "Concedi autorizzaz.",
+ "line2" : "richiesta(e)?",
+ "tts" : "%appName% richiede l'uso delle seguenti informazioni e autorizzazioni sul veicolo: %functionalGroupLabels%. Se si preme Sì, si acconsente che %vehicleMake% non sarà responsabile per danni o perdita di privacy in relazione all'impiego dei dati da parte di %appName%. Premere Sì per consentire e No per negare."
+ },
+ "nl-nl" : {
+ "line1" : "Aangevraagde",
+ "line2" : "permissie(s) verlenen?",
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. Als u op Ja drukt, gaat u ermee akkoord dat %vehicleMake% in geen geval aansprakelijk gesteld kan worden voor schade of verlies van privacy als gevolg van het feit dat %appName% gebruik maakt van uw gegevens. Druk op Ja om dit toe te staan of Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "line1" : "Udzielić żądanych",
+ "line2" : "pozwoleń?",
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz pozwoleń: %functionalGroupLabels%. Naciśnięcie TAK oznacza zgodę na fakt, iż %vehicleMake% nie będzie ponosić odpowiedzialności za szkody ani utratę prywatności w związku z wykorzystaniem przez %appName% danych, należących do użytkownika. Naciśnij TAK w celu udzielenia zgody lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "line1" : "Conceder permissão",
+ "line2" : "solicitada?",
+ "tts" : "%appName% está solicitando o uso das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se pressionar sim, você concorda que a %vehicleMake% não será responsável por danos ou perdas de privacidade relacionados ao uso dos seus dados por %appName%. Pressione sim para permitir ou não para negar."
+ },
+ "pt-pt" : {
+ "line1" : "Conceder permiss.",
+ "line2" : "solicitada(s)?",
+ "tts" : "%appName% está a solicitar a utilização das seguintes informações e permissões do veículo: %functionalGroupLabels%. Se premir “Sim”, concorda que %vehicleMake% não será responsável por quaisquer danos ou perda de privacidade relacionada com a utilização dos seus dados por parte de %appName%. Prima “Sim” para permitir ou “Não” para recusar."
+ },
+ "ru-ru" : {
+ "line1" : "Предост. заправш.",
+ "line2" : "разрешения?",
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Нажатием \"\"да\"\", Вы соглашаетесь, что %vehicleMake% не будет нести ответственность за какие-либо убытки или потерю прайвеси, связанные с использованием Ваших данных компанией %appName%. Нажмите \"\"Да\"\", если Вы согласны, или \"\"Нет\"\" - если не согласны."
+ },
+ "sv-se" : {
+ "line1" : "Vill du ge",
+ "line2" : "tillstånd?",
+ "tts" : "%appName% begär att få tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Om du trycker Ja godkänner du att %vehicleMake% ska hållas skadeslös för alla skador som kan uppstå eller eventuella integritetsintrång som uppstår när %appName% använder dina data. Tryck Ja för att godkänna eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "line1" : "İstenen izinler",
+ "line2" : "verilsin mi?",
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri kullanma isteğinde bulunuyor: %functionalGroupLabels%. Evet'e basarsanız, %appName%'in verilerinizi kullanması sonucunda oluşabilecek hasarlardan veya gizlilik kaybından %vehicleMake%'in sorumlu olmayacağını kabul etmiş olacaksınız. Lütfen kabul etmek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否允许请求的",
+ "line2" : "权限?",
+ "tts" : "%appName% 正在请求使用下列车辆信息和权限: %functionalGroupLabels%。如果您按“是”,则表示您同意。 %vehicleMake% 将不会对因 %appName% 使用您的数据而引起的任何损毁或隐私损失负责。 请按“是”允许或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "line1" : "允許",
+ "line2" : "授權請求?",
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。按「是」,表示您同意,如因 %appName% 使用您的資料導致任何損害或損失,%vehicleMake% 將不負賠償責任。同意請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsHelp" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "%appName% fordert folgende Fahrzeuginformationen und Zugriffsberechtigungen: %functionalGroupLabels%. Im Einstellungsmenü der mobilen Apps können Sie diese Berechtigungen ändern und sich detaillierte Beschreibungen anhören. Mit Ja stimmen Sie zu; mit Nein lehnen Sie ab."
+ },
+ "en-au" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-gb" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-ie" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press Yes to grant permissions or No to deny."
+ },
+ "en-us" : {
+ "tts" : "%appName% is requesting the following vehicle information and permissions: %functionalGroupLabels%. You can change these permissions and hear detailed descriptions in the mobile apps settings menu. Please press yes to grant permissions or no to deny."
+ },
+ "es-en" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "es-es" : {
+ "tts" : "%appName% está solicitando los siguientes permisos e información del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y escuchar descripciones detalladas en el menú de configuración de la aplicación móvil. Pulse sí para conceder el permiso o no para denegarlo."
+ },
+ "es-mx" : {
+ "tts" : "%appName% solicita la siguiente información y permisos del vehículo: %functionalGroupLabels%. Puede cambiar estos permisos y consultar descripciones detalladas en el menú de configuración de las aplicaciones móviles. Presione Sí para otorgar permisos y No para denegar."
+ },
+ "fr-ca" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "fr-fr" : {
+ "tts" : "%appName% demande d’utiliser les informations du véhicule et les permissions suivantes : %functionalGroupLabels%. Vous pouvez modifier ces permissions et entendre les descriptions détaillées dans le menu des réglages des applications mobiles. Veuillez appuyer sur Oui pour accorder les permissions ou sur Non pour refuser."
+ },
+ "it-it" : {
+ "tts" : "%appName% richiede le seguenti informazioni e autorizzazioni riguardo il veicolo: %functionalGroupLabels%. È possibile modificare tali autorizzazioni e ascoltare descrizioni dettagliate nel menu impostazioni delle app mobili. Premere Sì per concedere le autorizzazioni e No per negarle."
+ },
+ "nl-nl" : {
+ "tts" : "%appName% vraagt gebruikmaking van de volgende voertuiginformatie en toestemmingen aan: %functionalGroupLabels%. U kunt deze toestemmingen wijzigen en gedetailleerde beschrijvingen beluisteren in het instellingenmenu voor mobiele apps. Druk op Ja om permissies te verlenen of op Nee om te weigeren."
+ },
+ "pl-pl" : {
+ "tts" : "%appName% wymaga następujących informacji o pojeździe oraz zezwoleń: %functionalGroupLabels%. W menu ustawień aplikacji mobilnych można zmienić owe zezwolenia i usłyszeć ich szczegółowy opis. Naciśnij TAK, aby wyrazić zgodę lub NIE w celu odrzucenia żądania."
+ },
+ "pt-br" : {
+ "tts" : "%appName% está solicitando as seguintes informações e permissões do veículo: %functionalGroupLabels%. Você pode alterar estas permissões e ouvir descrições detalhadas no menu de configurações de aplicativos móveis. Pressione sim para conceder as permissões ou não para negar."
+ },
+ "pt-pt" : {
+ "tts" : "%appName% está a solicitar as seguintes informações e permissões do veículo: %functionalGroupLabels%. Pode alterar estas permissões e ouvir descrições detalhadas no menu de definições das aplicações móveis. Prima \"\"Sim\"\" para permitir ou \"\"Não\"\" para recusar."
+ },
+ "ru-ru" : {
+ "tts" : "%appName% запрашивает следующую информацию об автомобиле и разрешения: %functionalGroupLabels%. Вы можете изменить эти разрешения и прослушать подробные их описания в меню настроек мобильного приложения. Нажмите \"\"да\"\", чтобы предоставить разрешения, или \"\"нет\"\", чтобы не предоставлять."
+ },
+ "sv-se" : {
+ "tts" : "%appName% begär tillgång till följande fordonsinformation och tillstånd: %functionalGroupLabels%. Du kan ändra tillstånden och höra detaljerade beskrivningar i menyn för mobilappsinställningar. Tryck Ja för att ge tillstånd eller Nej för att neka."
+ },
+ "tr-tr" : {
+ "tts" : "%appName%, şu araç bilgilerini ve izinleri istiyor: %functionalGroupLabels%. Bu izinleri değiştirebilir ve mobil uygulamalar ayarlar menüsünden ayrıntılı açıklamaları dinleyebilirsiniz. Lütfen izin vermek için Evet'e veya reddetmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "tts" : "%appName% 正在请求下列车辆信息和权限: %functionalGroupLabels%。您可在移动应用程序设置菜单中更改这些权限,并听取详细说明。请按“是”允许权限或按“否”拒绝。"
+ },
+ "zh-tw" : {
+ "tts" : "%appName% 正請求使用 %functionalGroupLabels% 的車輛資訊和許可。您可在行動應用程式設定清單中更改這些許可,並聆聽詳細說明。給予許可請按「是」,拒絕請按「否」。"
+ }
+ }
+ },
+ "AppPermissionsRevoked" : {
+ "languages" : {
+ "de-de" : {
+ "tts" : "Die Autorisierungsdaten der App wurden geändert. %appName% hat keinen Zugriff auf %functionalGroupLabels% mehr. Installieren Sie die neueste Version der App auf Ihrem Gerät.."
+ },
+ "en-au" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-gb" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-ie" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "en-us" : {
+ "tts" : "App authorizations have changed. %appName% can no longer access %functionalGroupLabels%. Please ensure you have the most recent app version installed on your mobile device."
+ },
+ "es-en" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "es-es" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de que tiene la versión más reciente de la aplicación instalada en su dispositivo móvil."
+ },
+ "es-mx" : {
+ "tts" : "Las autorizaciones de la aplicación han cambiado. %appName% ya no puede acceder a %functionalGroupLabels%. Asegúrese de haber instalado la versión más reciente de la aplicación en su dispositivo móvil."
+ },
+ "fr-ca" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "fr-fr" : {
+ "tts" : "Les autorisations pour app ont changé. %appName% ne peut plus accéder à %functionalGroupLabels%. Veuillez vous assurer que la plus récente version de l’application est installée sur votre appareil mobile."
+ },
+ "it-it" : {
+ "tts" : "Le autorizzazioni dell'app sono cambiate. %appName% non è più in grado di accedere a %functionalGroupLabels%. Assicurarsi di avere la versione più recente dell'app installata sul dispositivo mobile."
+ },
+ "nl-nl" : {
+ "tts" : "De app-autorisaties zijn gewijzigd. %appName% heeft geen toegang meer tot %functionalGroupLabels%. Zorg ervoor dat u de meest recente app-versie op uw mobiele apparaat geïnstalleerd hebt."
+ },
+ "pl-pl" : {
+ "tts" : "Dane dostępu aplikacji zostały zmienione. %appName% nie ma już dostępu do %functionalGroupLabels%. Sprawdź, czy na telefonie komórkowym zainstalowano najnowszą wersję aplikacji."
+ },
+ "pt-br" : {
+ "tts" : "As autorizações dos aplicativos foram alteradas. %appName% não pode mais acessar %functionalGroupLabels%. Certifique-se de que a versão mais recente do aplicativo está instalada no seu dispositivo móvel."
+ },
+ "pt-pt" : {
+ "tts" : "As autorizações das aplicações mudaram. %appName% já não consegue aceder a %functionalGroupLabels%. Certifique-se de que tem a última versão da aplicação no seu dispositivo móvel."
+ },
+ "ru-ru" : {
+ "tts" : "Авторизации приложения изменены. %appName% больше не имеет доступа к %functionalGroupLabels%. Убедитесь, что на вашем мобильном устройстве установлена самая новая версия приложения."
+ },
+ "sv-se" : {
+ "tts" : "Appens behörigheter har ändrats. %appName% har inte längre åtkomst till %functionalGroupLabels%. Kontrollera att du har installerat den senaste versionen av appen på mobilenheten."
+ },
+ "tr-tr" : {
+ "tts" : "Uygulama yetkileri değişti. %appName% artık %functionalGroupLabels%'e erişemeyecek. Lütfen mobil aygıtınızda en son uygulama sürümünün yüklü olduğundan emin olun."
+ },
+ "zh-cn" : {
+ "tts" : "应用程序授权已变更。 %appName% 将不能再访问 %functionalGroupLabels%。 请确认您的移动设备上安装的应用程序是最新版本。"
+ },
+ "zh-tw" : {
+ "tts" : "應用程式授權已改變。%appName% 已無法進入 %functionalGroupLabels%。請確認您的行動裝置上安裝了最新版應用程式。"
+ }
+ }
+ },
+ "AppUnauthorized" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht autorisiert",
+ "tts" : "Diese Version von %appName% ist nicht autorisiert und wird nicht mit SYNC funktionieren."
+ },
+ "en-au" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Authorized",
+ "tts" : "This version of %appName% is not authorized and will not work with SYNC."
+ },
+ "es-en" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No autorizada",
+ "tts" : "Esta versión de %appName% no está autorizada y no funcionará con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no autorizada",
+ "tts" : "Esta versión de %appName% no tiene autorización y no funcionará con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "non autorisée",
+ "tts" : "Cette version de %appName% n’est pas autorisée et ne fonctionnera pas avec SYNC."
+ },
+ "it-it" : {
+ "line1" : "non autorizzata",
+ "tts" : "Questa versione di %appName% non è autorizzata e non funziona con il SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet geautoriseerd",
+ "tts" : "Deze versie van %appName% is niet geautoriseerd en werkt niet met SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "brak autoryzacji",
+ "tts" : "Niniejsza wersja %appName% nie posiada autoryzacji i nie będzie działać z SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não autorizado",
+ "tts" : "Esta versão do %appName% não tem autorização e não funcionará com o SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não autorizada",
+ "tts" : "Esta versão de %appName% não está autorizada e não funcionará com o SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не авторизировано",
+ "tts" : "Эта версия %appName% не авторизирована и не будет работать с SYNC."
+ },
+ "sv-se" : {
+ "line1" : "är ej godkänd",
+ "tts" : "Den här versionen av %appName% är inte godkänd och fungerar inte med SYNC."
+ },
+ "tr-tr" : {
+ "line1" : "için izin yok",
+ "tts" : "Bu %appName% sürümüne izin verilmediğinden SYNC ile çalışamaz."
+ },
+ "zh-cn" : {
+ "line1" : "未得到授权",
+ "tts" : "此版本的%appName% 未得到授权,无法在SYNC上使用。"
+ },
+ "zh-tw" : {
+ "line1" : "無授權",
+ "tts" : "%appName% 的版本未獲得授權,將無法透過 SYNC 使用。"
+ }
+ }
+ },
+ "AppUnsupported" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "nicht unterstützt",
+ "tts" : "Diese Version von %appName% wird von SYNC nicht unterstützt."
+ },
+ "en-au" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-gb" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-ie" : {
+ "line1" : "not supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "en-us" : {
+ "line1" : "Not Supported",
+ "tts" : "This version of %appName% is not supported by SYNC."
+ },
+ "es-en" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-es" : {
+ "line1" : "No compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "es-mx" : {
+ "line1" : "no compatible",
+ "tts" : "Esta versión de %appName% no es compatible con SYNC."
+ },
+ "fr-ca" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "fr-fr" : {
+ "line1" : "incompatible",
+ "tts" : "Cette version de %appName% n’est pas prise en charge par SYNC."
+ },
+ "it-it" : {
+ "line1" : "non supportata",
+ "tts" : "Questa versione di %appName% non è supportata dal SYNC."
+ },
+ "nl-nl" : {
+ "line1" : "niet ondersteund",
+ "tts" : "Deze versie van %appName% wordt niet ondersteund door SYNC."
+ },
+ "pl-pl" : {
+ "line1" : "aplikacja nie obsług.",
+ "tts" : "Niniejsza wersja %appName% nie jest obsługiwana przez system SYNC."
+ },
+ "pt-br" : {
+ "line1" : "não suportado",
+ "tts" : "Esta versão do %appName% não é suportada pelo SYNC."
+ },
+ "pt-pt" : {
+ "line1" : "não suportada",
+ "tts" : "Esta versão de %appName% não é suportado pelo SYNC."
+ },
+ "ru-ru" : {
+ "line1" : "не поддерживается",
+ "tts" : "Эта версия %appName% не поддерживается SYNC."
+ },
+ "sv-se" : {
+ "line1" : "stöds ej",
+ "tts" : "SYNC har inte stöd för den här versionen av %appName%."
+ },
+ "tr-tr" : {
+ "line1" : "desteklenmiyor",
+ "tts" : "Bu %appName% sürümü SYNC tarafından desteklenmiyor."
+ },
+ "zh-cn" : {
+ "line1" : "不受支持",
+ "tts" : "SYNC不支持此版本的%appName%。"
+ },
+ "zh-tw" : {
+ "line1" : "不支援",
+ "tts" : "SYNC 不支援此版本的%appName% 。"
+ }
+ }
+ },
+ "DataConsent" : {
+ "languages" : {
+ "en-us" : {
+ "line1" : "Enable Mobile Apps",
+ "line2" : "on SYNC? (Uses Data)",
+ "tts" : "To use mobile apps with SYNC, SYNC will communicate with Ford at least once per month using your mobile device's data plan. Standard rates may apply. SYNC will send your VIN and SYNC module number to Ford U.S. Please press yes or no, or help for more information. "
+ }
+ }
+ },
+ "DataConsentHelp" : {
+ "languages" : {
+ "en-us" : {
+ "tts" : "Updates are about the size of an email, and the occurrence of updates depends on your vehicle usage and when a new app is found on your device. To turn on or off, visit the SYNC mobile apps settings menu. See your Owner Guide for more information. "
+ }
+ }
+ },
+ "DisableApps" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Auto-Update",
+ "line2" : "und Mobile Apps deaktivieren",
+ "tts" : "Ausschalten der automatischen Updates führt zum Ausschalten von SYNC mobile Apps. Sie können Ihre mobilen Apps dann nicht mehr mit SYNC nutzen. Bitte drücken Sie Ja zur Bestätigung oder Nein, um abzubrechen."
+ },
+ "en-au" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-gb" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-ie" : {
+ "line1" : "Disable auto-updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable SYNC mobile apps. You will not be able to use any mobile apps with SYNC. Please press Yes to confirm or No to cancel."
+ },
+ "en-us" : {
+ "line1" : "Disable Auto-Updates",
+ "line2" : "and Mobile Apps?",
+ "tts" : "Disabling automatic updates will also disable sync mobile apps. You will not be able to use any mobile apps with SYNC. Please press yes to confirm or no to cancel."
+ },
+ "es-en" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "es-es" : {
+ "line1" : "¿Desact. actual. auto",
+ "line2" : "y apl. móviles?",
+ "tts" : "Si desactiva las actualizaciones automáticas, también se desactivará la sincronización de las aplicaciones móviles. No podrá utilizar ninguna aplicación móvil con SYNC. Pulse sí para confirmar o no para cancelar."
+ },
+ "es-mx" : {
+ "line1" : "¿Deshab. actualiz.",
+ "line2" : "autom. y aplic. móv.?",
+ "tts" : "Si se desactivan las actualizaciones automáticas, también se desactivarán las aplicaciones móviles de SYNC. No podrá usar ninguna aplicación móvil con SYNC. Presione Sí para confirmar o No para cancelar."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj autom.",
+ "line2" : "et app. mobiles?",
+ "tts" : "La désactivation des mises à jour automatiques désactivera aussi les applications mobiles SYNC. Vous ne pourrez pas utiliser d’application mobile avec SYNC. Veuillez appuyer sur Oui pour confirmer ou sur Non pour annuler."
+ },
+ "it-it" : {
+ "line1" : "Disabilitare agg. aut.",
+ "line2" : "e app mobili?",
+ "tts" : "Disabilitando gli aggiornamenti automatici si disattiva anche la sincronizzazione delle app mobili. Non sarà possibile usare app mobili con il SYNC. Premere Sì per confermare e No per cancellare."
+ },
+ "nl-nl" : {
+ "line1" : "Auto-updates en mob.",
+ "line2" : "apps uitschakelen?",
+ "tts" : "Door automatische updates uit te schakelen, schakelt u ook SYNC-mobiele apps uit. U kunt dan geen mobiele apps meer gebruiken met SYNC. Druk op Ja om te bevestigen of op Nee om te annuleren."
+ },
+ "pl-pl" : {
+ "line1" : "Wył. automat. aktual.",
+ "line2" : "i aplikacje mobilne?",
+ "tts" : "Wyłączenie automatycznych aktualizacji spowoduje także wyłączenie aplikacji mobilnych SYNC. Korzystanie z mobilnych aplikacji za pomocą SYNC będzie niemożliwe. Naciśnij TAK, by potwierdzić lub NIE, by anulować."
+ },
+ "pt-br" : {
+ "line1" : "Desativar atualizações",
+ "line2" : "autom. e aplicativos?",
+ "tts" : "Se as atualizações automáticas forem desativadas, os aplicativos também serão desativados. Você não poderá usar nenhum aplicativo com o SYNC. Pressione sim para confirmar ou não para cancelar."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actual. autom.",
+ "line2" : "e aplicações móveis?",
+ "tts" : "A desactivação das actualizações automáticas desactiva igualmente as aplicações móveis do SYNC. Não poderá utilizar quaisquer aplicações móveis com o SYNC. Prima \"\"Sim\"\" para confirmar ou \"\"Não\"\" para cancelar."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. автообновления",
+ "line2" : "и мобил. прилож.?",
+ "tts" : "При отключении автоматических обновлений также будут отключены мобильные приложения sync. Вы не сможете использовать какие-либо мобильные приложения с SYNC. Нажмите \"\"Да\"\" для подтверждения или \"\"Нет\"\" для отмены."
+ },
+ "sv-se" : {
+ "line1" : "Avaktiverar autouppdat.",
+ "line2" : "och mobilappar?",
+ "tts" : "Om du avaktiverar automatisk uppdatering avaktiverar du även synkning av mobilappar. Du kommer inte längre att kunna använda dina mobilappar med SYNC. Tryck Ja för att bekräfta eller Nej för att avbryta."
+ },
+ "tr-tr" : {
+ "line1" : "Oto. güncelleme ve",
+ "line2" : "mobil uygul. kapat?",
+ "tts" : "Otomatik güncellemeleri devre dışı bırakırsanız sync mobil uygulamalar da devre dışı kalır. SYNC ile mobil uygulama kullanmanız mümkün olmaz. Lütfen onaylamak için Evet'e veya iptal etmek için Hayır'a basın."
+ },
+ "zh-cn" : {
+ "line1" : "是否禁用自动更新和",
+ "line2" : "移动应用程序?",
+ "tts" : "禁用自动更新同时也会禁用SYNC移动应用程序。您将无法在 SYNC 中使用任何移动应用程序。请按“是”确认或按“否”取消。"
+ },
+ "zh-tw" : {
+ "line1" : "停用自動更新",
+ "line2" : "和行動應用程式?",
+ "tts" : "停用自動更新也將停用 sync 行動應用程式。您將無法透過 SYNC 使用任何行動應用程式。確認請按「是」,取消請按「否」。"
+ }
+ }
+ },
+ "DrivingCharacteristics" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahreigenschaften",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahreigenschaften: Kraftstoffverbrauch, MyKey, Sicherheitsgurtstatus."
+ },
+ "en-au" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-gb" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-ie" : {
+ "label" : "Driving characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel consumption, MyKey, Seat belt status."
+ },
+ "en-us" : {
+ "label" : "Driving Characteristics",
+ "tts" : "An app can access the following driving characteristics: Fuel Consumption, MyKey, Seat Belt Status."
+ },
+ "es-en" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "es-es" : {
+ "label" : "Características de conducción",
+ "tts" : "Una aplicación puede acceder a las siguientes características de conducción: Consumo de combustible, MyKey, Estado cinturones de seguridad."
+ },
+ "es-mx" : {
+ "label" : "Características del manejo",
+ "tts" : "Las aplicaciones pueden acceder a las siguientes características del manejo: Consumo de combustible, MyKey, Estado del cinturón de seguridad."
+ },
+ "fr-ca" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "fr-fr" : {
+ "label" : "Caractéristiques de conduite",
+ "tts" : "Une application peut accéder aux caractéristiques de conduite suivantes: Consommation de carburant, MyKey, État des ceintures de sécurité."
+ },
+ "it-it" : {
+ "label" : "Caratteristiche di guida",
+ "tts" : "Un'app può avere accesso alle seguenti caratteristiche di guida: Consumo carburante, MyKey, Stato cinture di sicurezza."
+ },
+ "nl-nl" : {
+ "label" : "Rijkenmerken",
+ "tts" : "Een app heeft toegang tot de volgende rijkenmerken: Brandstofverbruik, MyKey, Veiligheidsgordelstatus."
+ },
+ "pl-pl" : {
+ "label" : "Informacje dotyczące stylu jazdy",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji dotyczących jazdy: Zużycie paliwa, MyKey, Stan pasów bezpieczeństwa."
+ },
+ "pt-br" : {
+ "label" : "Características de condução",
+ "tts" : "Um aplicativo pode acessar as seguintes características de condução: Consumo de combustível, MyKey, Estado do cinto de segurança."
+ },
+ "pt-pt" : {
+ "label" : "Características de condução",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações de condução: Consumo de combustível, MyKey, Estado dos cintos de segurança."
+ },
+ "ru-ru" : {
+ "label" : "Характеристики движения",
+ "tts" : "Приложение имеет доступ к следующим характеристикам движения: Расход топлива, MyKey, Состояние ремней безопасности."
+ },
+ "sv-se" : {
+ "label" : "Köregenskaper",
+ "tts" : "Appen kan komma åt följande köregenskaper: Bränsleförbrukning, MyKey, Bältesstatus."
+ },
+ "tr-tr" : {
+ "label" : "Sürüş karakteristikleri",
+ "tts" : "Bir uygulama şu sürüş karakteristiklerine erişebilir: Yakıt tüketimi, MyKey, Emniyet kemeri durumu."
+ },
+ "zh-cn" : {
+ "label" : "行驶特性",
+ "tts" : "移动应用程序可访问下列行驶特性: 油耗, MyKey, 安全带状态"
+ },
+ "zh-tw" : {
+ "label" : "駕駛特性",
+ "tts" : "應用程式可存取以下駕駛特性: 油耗, MyKey, 安全帶狀態"
+ }
+ }
+ },
+ "Location" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "GPS und Geschwindigkeit",
+ "tts" : "Eine App hat Zugriff auf die GPS-Daten und die Geschwindigkeit des Fahrzeugs."
+ },
+ "en-au" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-gb" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-ie" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "en-us" : {
+ "label" : "GPS and speed",
+ "tts" : "An app can access vehicle GPS and speed."
+ },
+ "es-en" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "es-es" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Una aplicación puede acceder al GPS y la velocidad del vehículo."
+ },
+ "es-mx" : {
+ "label" : "GPS y velocidad",
+ "tts" : "Las aplicaciones pueden acceder al GPS y a la velocidad del vehículo."
+ },
+ "fr-ca" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "fr-fr" : {
+ "label" : "GPS et vitesse",
+ "tts" : "Une application peut accéder au GPS et à la vitesse du véhicule."
+ },
+ "it-it" : {
+ "label" : "GPS e velocità",
+ "tts" : "Un'app può avere accesso a GPS e velocità del veicolo."
+ },
+ "nl-nl" : {
+ "label" : "Gps en snelheid",
+ "tts" : "Een app heeft toegang tot gps en de snelheid van het voertuig."
+ },
+ "pl-pl" : {
+ "label" : "GPS i prędkość",
+ "tts" : "Aplikacja może uzyskać dostęp do modułu GPS i prędkości pojazdu."
+ },
+ "pt-br" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Um aplicativo pode acessar o GPS e a velocidade do veículo."
+ },
+ "pt-pt" : {
+ "label" : "GPS e velocidade",
+ "tts" : "Uma aplicação consegue aceder ao GPS e à velocidade do veículo."
+ },
+ "ru-ru" : {
+ "label" : "GPS и скорость",
+ "tts" : "Приложение имеет доступ к GPS и скорости автомобиля."
+ },
+ "sv-se" : {
+ "label" : "GPS och hastighet",
+ "tts" : "Appen kan komma åt fordonets GPS och hastighetsmätare."
+ },
+ "tr-tr" : {
+ "label" : "GPS ve hız",
+ "tts" : "Bu uygulama aracın GPS ve hız bilgilerine erişebilir."
+ },
+ "zh-cn" : {
+ "label" : "GPS 和车速",
+ "tts" : "移动应用程序可以访问车辆 GPS 和车速信息。"
+ },
+ "zh-tw" : {
+ "label" : "GPS和車速",
+ "tts" : "應用程式可存取車輛的GPS和速度。"
+ }
+ }
+ },
+ "Notifications" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Push-Benachrichtigungen",
+ "tts" : "Läuft die App im Hintergrund, kann Sie Benachrichtigungen senden."
+ },
+ "en-au" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-gb" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-ie" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "en-us" : {
+ "label" : "Push notifications",
+ "tts" : "An app can send notifications when running in the background."
+ },
+ "es-en" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "es-es" : {
+ "label" : "Notificaciones push",
+ "tts" : "Una aplicación puede enviar notificaciones cuando se está ejecutando en segundo plano."
+ },
+ "es-mx" : {
+ "label" : "Notificaciones tipo Push",
+ "tts" : "Las aplicaciones pueden enviar notificaciones cuando se ejecutan en segundo plano."
+ },
+ "fr-ca" : {
+ "label" : "Notifications instantanées",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "fr-fr" : {
+ "label" : "Notifications push",
+ "tts" : "Une application peut envoyer des avis lorsqu’elle fonctionne en arrière-plan."
+ },
+ "it-it" : {
+ "label" : "Notifiche push",
+ "tts" : "Un'app può inviare notifiche se eseguita in background."
+ },
+ "nl-nl" : {
+ "label" : "Push-meldingen",
+ "tts" : "Een app kan meldingen versturen als deze op de achtergrond actief is."
+ },
+ "pl-pl" : {
+ "label" : "Powiadomienia Push",
+ "tts" : "Aplikacja może wysyłać powiadomienia, działając w tle."
+ },
+ "pt-br" : {
+ "label" : "Notificações Push",
+ "tts" : "Um aplicativo pode enviar notificações quando estiver sendo executado em segundo plano."
+ },
+ "pt-pt" : {
+ "label" : "Notificações push",
+ "tts" : "Uma aplicação consegue enviar notificações quando está activa em segundo plano."
+ },
+ "ru-ru" : {
+ "label" : "Оповещения о пересылке",
+ "tts" : "Если приложение работает в фоновом режиме, оно может отправлять оповещения."
+ },
+ "sv-se" : {
+ "label" : "Push-notiser",
+ "tts" : "Appen kan skicka meddelanden när den körs i bakgrunden."
+ },
+ "tr-tr" : {
+ "label" : "Anlık bildirimleri",
+ "tts" : "Bir uygulama arka planda çalışırken bildirim gönderebilir."
+ },
+ "zh-cn" : {
+ "label" : "推送通知",
+ "tts" : "移动应用程序在后台运行时可推送通知。"
+ },
+ "zh-tw" : {
+ "label" : "傳送通知",
+ "tts" : "車輛行進時,應用程式可在背景中傳送通知。"
+ }
+ }
+ },
+ "SettingDisableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Updates deakt."
+ },
+ "en-au" : {
+ "line1" : "Disable updates"
+ },
+ "en-gb" : {
+ "line1" : "Disable updates"
+ },
+ "en-ie" : {
+ "line1" : "Disable updates"
+ },
+ "en-us" : {
+ "line1" : "Disable Updates"
+ },
+ "es-en" : {
+ "line1" : "Deshab. actual."
+ },
+ "es-es" : {
+ "line1" : "Desact. actual."
+ },
+ "es-mx" : {
+ "line1" : "Deshab. actual."
+ },
+ "fr-ca" : {
+ "line1" : "Désactiver MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Désactiver màj"
+ },
+ "it-it" : {
+ "line1" : "Disabilita agg."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. uitschak."
+ },
+ "pl-pl" : {
+ "line1" : "Wyłącz aktual."
+ },
+ "pt-br" : {
+ "line1" : "Desat. atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Desact. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Откл. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Inaktivera uppd."
+ },
+ "tr-tr" : {
+ "line1" : "Güncell. Kapat"
+ },
+ "zh-cn" : {
+ "line1" : "禁用更新"
+ },
+ "zh-tw" : {
+ "line1" : "停用更新"
+ }
+ }
+ },
+ "SettingEnableUpdates" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Apps aktivieren"
+ },
+ "en-au" : {
+ "line1" : "Enable Apps"
+ },
+ "en-gb" : {
+ "line1" : "Enable Apps"
+ },
+ "en-ie" : {
+ "line1" : "Enable Apps"
+ },
+ "en-us" : {
+ "line1" : "Enable Apps"
+ },
+ "es-en" : {
+ "line1" : "Hab. aplic."
+ },
+ "es-es" : {
+ "line1" : "Activar apl."
+ },
+ "es-mx" : {
+ "line1" : "Hab. aplic."
+ },
+ "fr-ca" : {
+ "line1" : "Activer app."
+ },
+ "fr-fr" : {
+ "line1" : "Activer app."
+ },
+ "it-it" : {
+ "line1" : "Abilita app"
+ },
+ "nl-nl" : {
+ "line1" : "Apps inschak."
+ },
+ "pl-pl" : {
+ "line1" : "Włącz aplikacje"
+ },
+ "pt-br" : {
+ "line1" : "Ativar aplic."
+ },
+ "pt-pt" : {
+ "line1" : "Activar actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Вкл. прилож."
+ },
+ "sv-se" : {
+ "line1" : "Aktivera appar"
+ },
+ "tr-tr" : {
+ "line1" : "Uygulamaları aç"
+ },
+ "zh-cn" : {
+ "line1" : "启用应用程序"
+ },
+ "zh-tw" : {
+ "line1" : "啟用應用程式"
+ }
+ }
+ },
+ "SettingUpdateAuto" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update anford."
+ },
+ "en-au" : {
+ "line1" : "Request update"
+ },
+ "en-gb" : {
+ "line1" : "Request update"
+ },
+ "en-ie" : {
+ "line1" : "Request update"
+ },
+ "en-us" : {
+ "line1" : "Request Update"
+ },
+ "es-en" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "es-es" : {
+ "line1" : "Solicitar actual."
+ },
+ "es-mx" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "fr-ca" : {
+ "line1" : "Demander MAJ"
+ },
+ "fr-fr" : {
+ "line1" : "Demander màj"
+ },
+ "it-it" : {
+ "line1" : "Rich. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Upd. aanvragen"
+ },
+ "pl-pl" : {
+ "line1" : "Zażądaj aktual."
+ },
+ "pt-br" : {
+ "line1" : "Solicitar atualiz."
+ },
+ "pt-pt" : {
+ "line1" : "Solicit. actualiz."
+ },
+ "ru-ru" : {
+ "line1" : "Запрос на обн."
+ },
+ "sv-se" : {
+ "line1" : "Begär uppdat."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleme iste"
+ },
+ "zh-cn" : {
+ "line1" : "请求更新"
+ },
+ "zh-tw" : {
+ "line1" : "請求更新"
+ }
+ }
+ },
+ "StatusNeeded" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Update benötigt"
+ },
+ "en-au" : {
+ "line1" : "Update needed"
+ },
+ "en-gb" : {
+ "line1" : "Update needed"
+ },
+ "en-ie" : {
+ "line1" : "Update needed"
+ },
+ "en-us" : {
+ "line1" : "Update Needed"
+ },
+ "es-en" : {
+ "line1" : "Actualiz. neces."
+ },
+ "es-es" : {
+ "line1" : "Actu. necesaria"
+ },
+ "es-mx" : {
+ "line1" : "Actualiz. neces."
+ },
+ "fr-ca" : {
+ "line1" : "Màj requise"
+ },
+ "fr-fr" : {
+ "line1" : "Mise à jour requise"
+ },
+ "it-it" : {
+ "line1" : "Necess. aggiorn."
+ },
+ "nl-nl" : {
+ "line1" : "Update nodig"
+ },
+ "pl-pl" : {
+ "line1" : "Potrzeba aktual."
+ },
+ "pt-br" : {
+ "line1" : "Atualiz. necess."
+ },
+ "pt-pt" : {
+ "line1" : "Actual. necess."
+ },
+ "ru-ru" : {
+ "line1" : "Необх. обновл."
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs"
+ },
+ "tr-tr" : {
+ "line1" : "Güncellenmeli"
+ },
+ "zh-cn" : {
+ "line1" : "需要进行更新"
+ },
+ "zh-tw" : {
+ "line1" : "需更新"
+ }
+ }
+ },
+ "StatusPending" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktualisieren..."
+ },
+ "en-au" : {
+ "line1" : "Updating..."
+ },
+ "en-gb" : {
+ "line1" : "Updating..."
+ },
+ "en-ie" : {
+ "line1" : "Updating..."
+ },
+ "en-us" : {
+ "line1" : "Updating..."
+ },
+ "es-en" : {
+ "line1" : "Actualizando..."
+ },
+ "es-es" : {
+ "line1" : "Actualizando..."
+ },
+ "es-mx" : {
+ "line1" : "Actualizando..."
+ },
+ "fr-ca" : {
+ "line1" : "MAJ en cours..."
+ },
+ "fr-fr" : {
+ "line1" : "Màj en cours..."
+ },
+ "it-it" : {
+ "line1" : "Aggiornamento"
+ },
+ "nl-nl" : {
+ "line1" : "Updaten..."
+ },
+ "pl-pl" : {
+ "line1" : "Aktualizowanie"
+ },
+ "pt-br" : {
+ "line1" : "Atualizando..."
+ },
+ "pt-pt" : {
+ "line1" : "A actualizar..."
+ },
+ "ru-ru" : {
+ "line1" : "Обновление..."
+ },
+ "sv-se" : {
+ "line1" : "Uppdaterar..."
+ },
+ "tr-tr" : {
+ "line1" : "Güncelleniyor..."
+ },
+ "zh-cn" : {
+ "line1" : "正在更新......"
+ },
+ "zh-tw" : {
+ "line1" : "更新中..."
+ }
+ }
+ },
+ "StatusUpToDate" : {
+ "languages" : {
+ "de-de" : {
+ "line1" : "Aktuelle Version"
+ },
+ "en-au" : {
+ "line1" : "Up-to-date"
+ },
+ "en-gb" : {
+ "line1" : "Up-to-date"
+ },
+ "en-ie" : {
+ "line1" : "Up-to-date"
+ },
+ "en-us" : {
+ "line1" : "Up-To-Date"
+ },
+ "es-en" : {
+ "line1" : "Actualizado"
+ },
+ "es-es" : {
+ "line1" : "Actualizada"
+ },
+ "es-mx" : {
+ "line1" : "Actualizado"
+ },
+ "fr-ca" : {
+ "line1" : "Déjà à jour"
+ },
+ "fr-fr" : {
+ "line1" : "Déjà à jour"
+ },
+ "it-it" : {
+ "line1" : "più recente"
+ },
+ "nl-nl" : {
+ "line1" : "Up-to-date"
+ },
+ "pl-pl" : {
+ "line1" : "Aktualne"
+ },
+ "pt-br" : {
+ "line1" : "Atualizado"
+ },
+ "pt-pt" : {
+ "line1" : "Actualizado"
+ },
+ "ru-ru" : {
+ "line1" : "Обновлено"
+ },
+ "sv-se" : {
+ "line1" : "Uppdat. krävs ej"
+ },
+ "tr-tr" : {
+ "line1" : "Güncel"
+ },
+ "zh-cn" : {
+ "line1" : "最新更新"
+ },
+ "zh-tw" : {
+ "line1" : "更新最新"
+ }
+ }
+ },
+ "VehicleInfo" : {
+ "languages" : {
+ "de-de" : {
+ "label" : "Fahrzeuginformationen",
+ "tts" : "Eine App hat Zugriff auf die folgenden Fahrzeuginformationen: Kraftstoff-Füllstand, Kraftstoffverbrauch, Motordrehzahl, Kilometerzähler, FIN, Außentemperatur, Gangstellung, Reifenluftdruck."
+ },
+ "en-au" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-gb" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-ie" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel level, Fuel economy, Engine RPMs, Odometer, VIN, Outside air temperature, Gear position, Tyre pressure."
+ },
+ "en-us" : {
+ "label" : "Vehicle information",
+ "tts" : "An app can access the following vehicle information: Fuel Level, Fuel Economy, Engine RPMs, Odometer, VIN, External Temperature, Gear Position, Tire Pressure."
+ },
+ "es-en" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "es-es" : {
+ "label" : "Información del vehículo",
+ "tts" : "Una aplicación puede acceder a la siguiente información del vehículo: Nivel de combustible, Ahorro de combustible, RPM del motor, Cuentakilómetros, VIN, Temperatura aire exterior, Marcha engranada, Presión de neumáticos."
+ },
+ "es-mx" : {
+ "label" : "Información del vehículo",
+ "tts" : "Las aplicaciones pueden acceder a la siguiente información del vehículo: Nivel de combustible, Economía de combustible, RPM del motor, Cuentakilómetros, Número de identificación del vehículo, Temperatura externa, Posición del cambio, Presión de los neumáticos."
+ },
+ "fr-ca" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Au régime du moteur, Odomètre, NIV, Température extérieure, Position d’embrayage, Pression des pneus."
+ },
+ "fr-fr" : {
+ "label" : "Renseignements du véhicule",
+ "tts" : "Une application peut accéder aux informations suivantes du véhicule: Niveau de carburant, Économie de carburant, Vitesse de moteur, Compteur kilométrique, NIV, Température extérieure, Position de vitesse, Pression des pneus."
+ },
+ "it-it" : {
+ "label" : "Informazioni sul veicolo",
+ "tts" : "Un'app può avere accesso alle seguenti informazioni del veicolo: Livello carburante, Consumi carburante, Numero giri motore, Contachilometri, VIN, Temperatura esterna, Posizione marcia, Pressione pneumatici."
+ },
+ "nl-nl" : {
+ "label" : "Voertuiginformatie",
+ "tts" : "Een app heeft toegang tot de volgende voertuiginformatie: Brandstofpeil, Brandstofverbruik, Motortoerental, Kilometerteller, VIN, Buitentemperatuur, Versnellingsstand, Bandenspanning."
+ },
+ "pl-pl" : {
+ "label" : "Informacje o pojeździe",
+ "tts" : "Aplikacja może uzyskać dostęp do następujących informacji o pojeździe: Poziom paliwa, Zużycie paliwa, Obroty silnika, Licznik przebiegu, Numer VIN, Temperatura zewnętrzna, Aktualny bieg, Ciśnienie opon."
+ },
+ "pt-br" : {
+ "label" : "Informações sobre o veículo",
+ "tts" : "Um aplicativo pode acessar as seguintes informações sobre o veículo: Nível de combustível, Economia de combustível, RPM do motor, Hodômetro, VIN, Temperatura externa, Posição das marchas, Pressão dos pneus."
+ },
+ "pt-pt" : {
+ "label" : "Informações do veículo",
+ "tts" : "Uma aplicação consegue aceder às seguintes informações do veículo: Nível de combustível, Poupança de combustível, RPM do motor, Conta-quilómetros, VIN, Temperatura exterior, Posição da mudança de velocidade, Pressão dos pneus."
+ },
+ "ru-ru" : {
+ "label" : "Информация об автомобиле",
+ "tts" : "Приложение имеет доступ к следующим данным автомобиля: Уровень топлива, Економия топлива, Число оборотов двигателя, Одометр, Номер VIN, Температура за бортом, Положение передачи, Давление шин."
+ },
+ "sv-se" : {
+ "label" : "Fordonsinformation",
+ "tts" : "Appen kan komma åt följande fordonsinformation: Bränslenivå, Bränsleekonomi, Motorns varvtal, Vägmätare, VIN, Utetemperatur, Växelläge, Däcktryck."
+ },
+ "tr-tr" : {
+ "label" : "Araç bilgisi",
+ "tts" : "Bir uygulama şu araç bilgilerine erişebilir: Yakıt seviyesi, Yakıt ekonomisi, Motor devirleri, Kilometre sayacı, VIN, Dış sıcaklık, Vites konumu, Lastik basıncı."
+ },
+ "zh-cn" : {
+ "label" : "车辆信息",
+ "tts" : "移动应用程序可访问下列车辆信息 : 燃油量, 燃油经济性, 发动机转速(RPM), 里程表, VIN, 车外温度, 档位, 胎压."
+ },
+ "zh-tw" : {
+ "label" : "車輛資訊",
+ "tts" : "一個應用程式可存取以下車輛資訊 : 燃油存量, 燃油經濟性, 引擎轉速, 里程表, 車輛識別號碼, 車外溫度, 檔位, 胎壓."
+ }
+ }
+ }
+ },
+ "version" : "001.001.015"
+ },
+ "functional_groupings" : {
+ "Base-4" : {
+ "rpcs" : {
+ "AddCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "AddSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Alert" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "CreateInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteCommand" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteInteractionChoiceSet" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "DeleteSubMenu" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "EncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "EndAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAudioPassThru" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnButtonEvent" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnButtonPress" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnCommand" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "OnDriverDistraction" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "OnEncodedSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnHMIStatus" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnSyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnTBTClientState" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "PerformAudioPassThru" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PerformInteraction" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ScrollableMessage" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetMediaClockTimer" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "Show" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "Slider" : {
+ "hmi_levels" : [ "FULL" ]
+ },
+ "Speak" : {
+ "hmi_levels" : [ "FULL", "LIMITED" ]
+ },
+ "SubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SyncPData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "UnsubscribeButton" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "DrivingCharacteristics-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "accPedalPosition",
+ "beltStatus",
+ "driverBraking",
+ "myKey",
+ "prndl",
+ "rpm",
+ "steeringWheelAngle"
+ ]
+ }
+ },
+ "user_consent_prompt" : "DrivingCharacteristics"
+ },
+ "Emergency-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "airbagStatus",
+ "bodyInformation",
+ "clusterModeStatus",
+ "deviceStatus",
+ "eCallInfo",
+ "emergencyEvent"
+ ]
+ }
+ }
+ },
+ "Location-1" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [ "gps", "speed" ]
+ }
+ },
+ "user_consent_prompt" : "Location"
+ },
+ "Navigation-1" : {
+ "rpcs" : {
+ "AlertManeuver" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ShowConstantTBT" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UpdateTurnList" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "Notifications" : {
+ "rpcs" : {
+ "Alert" : {
+ "hmi_levels" : [ "BACKGROUND" ]
+ }
+ },
+ "user_consent_prompt" : "Notifications"
+ },
+ "PropriataryData-1" : {
+ "rpcs" : {
+ "DiagnosticMessage" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "GetDTCs" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ReadDID" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ }
+ }
+ },
+ "VehicleInfo-3" : {
+ "rpcs" : {
+ "GetVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "OnVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "vin",
+ "wiperStatus"
+ ]
+ },
+ "SubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ },
+ "UnsubscribeVehicleData" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ],
+ "parameters" : [
+ "engineTorque",
+ "externalTemperature",
+ "fuelLevel",
+ "fuelLevel_State",
+ "headLampStatus",
+ "instantFuelConsumption",
+ "odometer",
+ "tirePressure",
+ "wiperStatus"
+ ]
+ }
+ },
+ "user_consent_prompt" : "VehicleInfo"
+ },
+ "pre_Base-1" : {
+ "rpcs" : {
+ "ChangeRegistration" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "DeleteFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "GenericResponse" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "ListFiles" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnAppInterfaceUnregistered" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnLanguageChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "OnPermissionsChange" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "PutFile" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "RegisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "ResetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "SetAppIcon" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetDisplayLayout" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ },
+ "SetGlobalProperties" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED" ]
+ },
+ "UnregisterAppInterface" : {
+ "hmi_levels" : [ "BACKGROUND", "FULL", "LIMITED", "NONE" ]
+ }
+ }
+ }
+ },
+ "module_config" : {
+ "device_certificates" : {
+ "HUU40DAS7F970UEI17A73JH32L41K32JH4L1K234H3K4" : "aldhfkahfgkafrblgjr"
+ },
+ "endpoints" : {
+ "0x07" : {
+ "default" : [ "http://policies.telematics.ford.com/api/policies" ]
+ }
+ },
+ "exchange_after_x_days" : 30,
+ "exchange_after_x_ignition_cycles" : 100,
+ "exchange_after_x_kilometers" : 1800,
+ "notifications_per_minute_by_priority" : {
+ "COMMUNICATION" : 6,
+ "EMERGENCY" : 60,
+ "NAVIGATION" : 15,
+ "NONE" : 0,
+ "NORMAL" : 4,
+ "VOICECOMM" : 10
+ },
+ "seconds_between_retries" : [ 1, 5, 25, 125, 625 ],
+ "timeout_after_x_seconds" : 60,
+ "vehicle_make" : "Stark Industries",
+ "vehicle_model" : "E-Tron",
+ "vehicle_year" : "1992"
+ }
+ }
+}
diff --git a/src/components/policy/test/smartDeviceLink2.ini b/src/components/policy/test/smartDeviceLink2.ini
new file mode 100644
index 0000000000..6aec231dbb
--- /dev/null
+++ b/src/components/policy/test/smartDeviceLink2.ini
@@ -0,0 +1,12 @@
+ [MAIN]
+; Contains output files, e.g. .wav
+AppStorageFolder = storage1
+
+[Policy]
+EnablePolicy = true
+PreloadedPT = sdl_preloaded_pt.json
+;PathToSnapshot = sdl_snapshot.json
+; Number of attempts to open policy DB
+;AttemptsToOpenPolicyDB = 5
+; Timeout between attempts during opening DB in milliseconds
+;OpenAttemptTimeoutMs = 500
diff --git a/src/components/policy/test/smartDeviceLink3.ini b/src/components/policy/test/smartDeviceLink3.ini
new file mode 100644
index 0000000000..d96694313a
--- /dev/null
+++ b/src/components/policy/test/smartDeviceLink3.ini
@@ -0,0 +1,12 @@
+ [MAIN]
+; Contains output files, e.g. .wav
+AppStorageFolder = storage123
+
+[Policy]
+EnablePolicy = true
+PreloadedPT = sdl_preloaded_pt.json
+;PathToSnapshot = sdl_snapshot.json
+; Number of attempts to open policy DB
+AttemptsToOpenPolicyDB = 8
+; Timeout between attempts during opening DB in milliseconds
+OpenAttemptTimeoutMs = 700 \ No newline at end of file
diff --git a/src/components/policy/test/sql_pt_ext_representation_test.cc b/src/components/policy/test/sql_pt_ext_representation_test.cc
deleted file mode 100644
index fddbc00142..0000000000
--- a/src/components/policy/test/sql_pt_ext_representation_test.cc
+++ /dev/null
@@ -1,378 +0,0 @@
-/* Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <vector>
-#include "gtest/gtest.h"
-#include <algorithm>
-#include "driver_dbms.h"
-#include "policy/sql_pt_ext_representation.h"
-
-using policy::SQLPTExtRepresentation;
-
-namespace test {
-namespace components {
-namespace policy {
-
-class SQLPTExtRepresentationTest : public ::testing::Test {
- protected:
- static DBMS* dbms;
- static SQLPTExtRepresentation* reps;
- static const std::string kDatabaseName;
-
- static void SetUpTestCase() {
- reps = new SQLPTExtRepresentation;
- dbms = new DBMS(kDatabaseName);
- EXPECT_EQ(::policy::SUCCESS, reps->Init());
- EXPECT_TRUE(dbms->Open());
- }
-
- static void TearDownTestCase() {
- EXPECT_TRUE(reps->Drop());
- EXPECT_TRUE(reps->Close());
- delete reps;
- dbms->Close();
- }
-};
-
-DBMS* SQLPTExtRepresentationTest::dbms = 0;
-SQLPTExtRepresentation* SQLPTExtRepresentationTest::reps = 0;
-#ifdef __QNX__
-const std::string SQLPTExtRepresentationTest::kDatabaseName = "policy";
-#else // __QNX__
-const std::string SQLPTExtRepresentationTest::kDatabaseName = "policy.sqlite";
-#endif // __QNX__
-
-::testing::AssertionResult IsValid(const policy_table::Table& table) {
- if (table.is_valid()) {
- return ::testing::AssertionSuccess();
- } else {
- ::rpc::ValidationReport report(" - table");
- table.ReportErrors(&report);
- return ::testing::AssertionFailure() << ::rpc::PrettyFormat(report);
- }
-}
-
-TEST_F(SQLPTExtRepresentationTest, GenerateSnapshot_SetPolicyTable_SnapshotIsPresent) {
-
- //arrange
- Json::Value table(Json::objectValue);
- table["policy_table"] = Json::Value(Json::objectValue);
-
- Json::Value& policy_table = table["policy_table"];
- policy_table["module_config"] = Json::Value(Json::objectValue);
- policy_table["functional_groupings"] = Json::Value(Json::objectValue);
- policy_table["consumer_friendly_messages"] = Json::Value(Json::objectValue);
- policy_table["app_policies"] = Json::Value(Json::objectValue);
-
- Json::Value& module_config = policy_table["module_config"];
- module_config["preloaded_pt"] = Json::Value(true);
- module_config["exchange_after_x_ignition_cycles"] = Json::Value(10);
- module_config["exchange_after_x_kilometers"] = Json::Value(100);
- module_config["exchange_after_x_days"] = Json::Value(5);
- module_config["timeout_after_x_seconds"] = Json::Value(500);
- module_config["seconds_between_retries"] = Json::Value(Json::arrayValue);
- module_config["seconds_between_retries"][0] = Json::Value(10);
- module_config["seconds_between_retries"][1] = Json::Value(20);
- module_config["seconds_between_retries"][2] = Json::Value(30);
- module_config["endpoints"] = Json::Value(Json::objectValue);
- module_config["endpoints"]["0x00"] = Json::Value(Json::objectValue);
- module_config["endpoints"]["0x00"]["default"] = Json::Value(Json::arrayValue);
- module_config["endpoints"]["0x00"]["default"][0] = Json::Value(
- "http://ford.com/cloud/default");
- module_config["notifications_per_minute_by_priority"] = Json::Value(
- Json::objectValue);
- module_config["notifications_per_minute_by_priority"]["emergency"] =
- Json::Value(1);
- module_config["notifications_per_minute_by_priority"]["navigation"] =
- Json::Value(2);
- module_config["notifications_per_minute_by_priority"]["VOICECOMM"] =
- Json::Value(3);
- module_config["notifications_per_minute_by_priority"]["communication"] =
- Json::Value(4);
- module_config["notifications_per_minute_by_priority"]["normal"] = Json::Value(
- 5);
- module_config["notifications_per_minute_by_priority"]["none"] = Json::Value(
- 6);
- module_config["vehicle_make"] = Json::Value("MakeT");
- module_config["vehicle_model"] = Json::Value("ModelT");
- module_config["vehicle_year"] = Json::Value("2014");
-
- Json::Value& functional_groupings = policy_table["functional_groupings"];
- functional_groupings["default"] = Json::Value(Json::objectValue);
- Json::Value& default_group = functional_groupings["default"];
- default_group["rpcs"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"] = Json::Value(Json::objectValue);
- default_group["rpcs"]["Update"]["hmi_levels"] = Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["hmi_levels"][0] = Json::Value("FULL");
- default_group["rpcs"]["Update"]["parameters"] = Json::Value(Json::arrayValue);
- default_group["rpcs"]["Update"]["parameters"][0] = Json::Value("speed");
-
- Json::Value& consumer_friendly_messages =
- policy_table["consumer_friendly_messages"];
- consumer_friendly_messages["version"] = Json::Value("1.2");
- consumer_friendly_messages["messages"] = Json::Value(Json::objectValue);
- consumer_friendly_messages["messages"]["MSG1"] = Json::Value(
- Json::objectValue);
- Json::Value& msg1 = consumer_friendly_messages["messages"]["MSG1"];
- msg1["languages"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"] = Json::Value(Json::objectValue);
- msg1["languages"]["en-us"]["tts"] = Json::Value("TTS message");
- msg1["languages"]["en-us"]["label"] = Json::Value("LABEL message");
- msg1["languages"]["en-us"]["line1"] = Json::Value("LINE1 message");
- msg1["languages"]["en-us"]["line2"] = Json::Value("LINE2 message");
- msg1["languages"]["en-us"]["textBody"] = Json::Value("TEXTBODY message");
-
- Json::Value& app_policies = policy_table["app_policies"];
- app_policies["default"] = Json::Value(Json::objectValue);
- app_policies["default"]["memory_kb"] = Json::Value(50);
- app_policies["default"]["heart_beat_timeout_ms"] = Json::Value(10);
- app_policies["default"]["groups"] = Json::Value(Json::arrayValue);
- app_policies["default"]["groups"][0] = Json::Value("default");
- app_policies["default"]["priority"] = Json::Value("EMERGENCY");
- app_policies["default"]["default_hmi"] = Json::Value("FULL");
- app_policies["default"]["keep_context"] = Json::Value(true);
- app_policies["default"]["steal_focus"] = Json::Value(true);
- app_policies["default"]["certificate"] = Json::Value("sign");
-
- policy_table::Table update(&table);
- update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
-
- //assert
- ASSERT_TRUE(IsValid(update));
- ASSERT_TRUE(reps->Save(update));
-
- //act
- utils::SharedPtr<policy_table::Table> snapshot = reps->GenerateSnapshot();
- snapshot->SetPolicyTableType(rpc::policy_table_interface_base::PT_SNAPSHOT);
-
- policy_table["module_meta"] = Json::Value(Json::objectValue);
- policy_table["usage_and_error_counts"] = Json::Value(Json::objectValue);
- policy_table["device_data"] = Json::Value(Json::objectValue);
-
- Json::Value& module_meta = policy_table["module_meta"];
- module_meta["ccpu_version"] = Json::Value("");
- module_meta["language"] = Json::Value("");
- module_meta["wers_country_code"] = Json::Value("");
- module_meta["pt_exchanged_at_odometer_x"] = Json::Value(0);
- module_meta["pt_exchanged_x_days_after_epoch"] = Json::Value(0);
- module_meta["ignition_cycles_since_last_exchange"] = Json::Value(0);
- module_meta["vin"] = Json::Value("");
-
- Json::Value& usage_and_error_counts = policy_table["usage_and_error_counts"];
- usage_and_error_counts["count_of_iap_buffer_full"] = Json::Value(0);
- usage_and_error_counts["count_sync_out_of_memory"] = Json::Value(0);
- usage_and_error_counts["count_of_sync_reboots"] = Json::Value(0);
-
- policy_table::Table expected(&table);
-
- //assert
- EXPECT_EQ(expected.ToJsonValue().toStyledString(),
- snapshot->ToJsonValue().toStyledString());
-}
-
-TEST_F(SQLPTExtRepresentationTest, CanAppKeepContext_InsertKeepContext_ExpectValuesThatSetInKeepContextParams) {
-
- //arrange
- const char* query_delete = "DELETE FROM `application`; ";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- const char* query_insert = "INSERT INTO `application` (`id`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `keep_context`) VALUES ('12345', 5, 10, 1)";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_insert));
- EXPECT_FALSE(reps->CanAppKeepContext("0"));
- EXPECT_TRUE(reps->CanAppKeepContext("12345"));
-}
-
-TEST_F(SQLPTExtRepresentationTest, CanAppStealFocus_SetStealFocus_ExpectValuesThatSetInStealFocusParam) {
-
- //arrange
- const char* query_delete = "DELETE FROM `application`; ";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- const char* query_insert = "INSERT INTO `application` (`id`, `memory_kb`,"
- " `heart_beat_timeout_ms`, `steal_focus`) VALUES ('12345', 5, 10, 1)";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_insert));
- EXPECT_TRUE(reps->CanAppStealFocus("12345"));
- EXPECT_FALSE(reps->CanAppStealFocus("0"));
-}
-
-TEST_F(SQLPTExtRepresentationTest, IncrementGlobalCounter_IncrementThreeTimes_ExpectCountEqual3) {
-
- //arrange
- const char* query_update = "UPDATE `usage_and_error_count` SET"
- " `count_of_sync_reboots` = 0";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_update));
-
- //act
- reps->Increment("count_of_sync_reboots");
- reps->Increment("count_of_sync_reboots");
- reps->Increment("count_of_sync_reboots");
-
- const char* query_select =
- "SELECT `count_of_sync_reboots` FROM `usage_and_error_count`";
- //assert
- EXPECT_EQ(3, dbms->FetchOneInt(query_select));
-}
-
-TEST_F(SQLPTExtRepresentationTest, IncrementAppCounter_IncrementCountOfUserSelections3Times_ExpectCountEqual3) {
-
- //arrange
- const char* query_delete =
- "DELETE FROM `app_level` WHERE `application_id` = '12345'";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- reps->Increment("12345", "count_of_user_selections");
- reps->Increment("12345", "count_of_user_selections");
- reps->Increment("12345", "count_of_user_selections");
-
- const char* query_select =
- "SELECT `count_of_user_selections` FROM `app_level`"
- " WHERE `application_id` = '12345'";
-
- //assert
- EXPECT_EQ(3, dbms->FetchOneInt(query_select));
-}
-
-TEST_F(SQLPTExtRepresentationTest, AppInfo_SetLanguageRuInGUIAndEnInVUI_ExpectRuInGUIAndEnInVUI) {
-
- //arrange
- const char* query_delete =
- "DELETE FROM `app_level` WHERE `application_id` = '12345'";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- reps->Set("12345", "app_registration_language_gui", "ru-ru");
- reps->Set("12345", "app_registration_language_vui", "en-en");
-
- const char* query_select_gui = "SELECT `app_registration_language_gui`"
- " FROM `app_level` WHERE `application_id` = '12345'";
-
- const char* query_select_vui = "SELECT `app_registration_language_vui`"
- " FROM `app_level` WHERE `application_id` = '12345'";
-
- //assert
- EXPECT_EQ("ru-ru", dbms->FetchOneString(query_select_gui));
- EXPECT_EQ("en-en", dbms->FetchOneString(query_select_vui));
-}
-
-TEST_F(SQLPTExtRepresentationTest, AddAppStopwatch_Set10And60MinutesForStopwatch_Expect70Minutes) {
-
- //arrange
- const char* query_delete =
- "DELETE FROM `app_level` WHERE `application_id` = '12345'";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- reps->Add("12345", "minutes_in_hmi_full", 10);
- reps->Add("12345", "minutes_in_hmi_full", 60);
-
- const char* query_select = "SELECT `minutes_in_hmi_full` FROM `app_level`"
- " WHERE `application_id` = '12345'";
-
- //assert
- EXPECT_EQ(70, dbms->FetchOneInt(query_select));
-}
-
-TEST_F(SQLPTExtRepresentationTest, SetUnpairedDevice_SetUnpairedDeviceId12345_ExpectUnpairedDeviceIdEquals12345) {
-
- //arrange
- const char* query_delete = "DELETE FROM `device`";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- const char* query_insert = "INSERT INTO `device` (`id`) VALUES('12345')";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_insert));
- ASSERT_TRUE(reps->SetUnpairedDevice("12345", true));
-
- //act
- const char* query_select = "SELECT `id` FROM `device` WHERE `unpaired` = 1";
-
- //assert
- EXPECT_EQ("12345", dbms->FetchOneString(query_select));
-}
-
-TEST_F(SQLPTExtRepresentationTest, UnpairedDevicesList_SetUnpairedDevicesWithId12345AndId54321_Expect2UnpairedDevices) {
-
- //arrange
- const char* query_delete = "DELETE FROM `device`";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_delete));
-
- //act
- const char* query_insert = "INSERT INTO `device` (`id`, `unpaired`)"
- " VALUES('12345', 1)";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_insert));
-
- //act
- query_insert = "INSERT INTO `device` (`id`, `unpaired`) VALUES('54321', 1)";
-
- //assert
- ASSERT_TRUE(dbms->Exec(query_insert));
-
- //act
- std::vector < std::string > output;
-
- //assert
- ASSERT_TRUE(reps->UnpairedDevicesList(&output));
- ASSERT_EQ(2u, output.size());
- EXPECT_NE(output.end(), std::find(output.begin(), output.end(), "12345"));
- EXPECT_NE(output.end(), std::find(output.begin(), output.end(), "54321"));
-}
-
-} // namespace policy
-} // namespace components
-} // namespace test
diff --git a/src/components/policy/test/sql_pt_representation_test.cc b/src/components/policy/test/sql_pt_representation_test.cc
index 088975ecde..0b7c8c7e98 100644
--- a/src/components/policy/test/sql_pt_representation_test.cc
+++ b/src/components/policy/test/sql_pt_representation_test.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2014, Ford Motor Company
+/* Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,22 +30,40 @@
*/
#include <vector>
+#include <string>
+#include <algorithm>
+#include <fstream>
+#include <stdio.h>
+#include <sys/stat.h>
+
#include "gtest/gtest.h"
-#include "driver_dbms.h"
+#include "policy/test/include/driver_dbms.h"
#include "policy/sql_pt_representation.h"
+#include "utils/sqlite_wrapper/sql_database.h"
+#include "utils/sqlite_wrapper/sql_error.h"
#include "policy/policy_types.h"
#include "json/writer.h"
#include "json/reader.h"
-
+#include "config_profile/profile.h"
+#include "utils/file_system.h"
+#include "utils/system.h"
+#include "./types.h"
+#include "./enums.h"
+#include "rpc_base/rpc_base.h"
+
+namespace policy_table = rpc::policy_table_interface_base;
using policy::SQLPTRepresentation;
using policy::CheckPermissionResult;
+using policy::UserFriendlyMessage;
using policy::EndpointUrls;
+using policy::VehicleInfo;
namespace test {
namespace components {
namespace policy {
-class SQLPTRepresentationTest : public ::testing::Test {
+class SQLPTRepresentationTest : public SQLPTRepresentation,
+ public ::testing::Test {
protected:
static DBMS* dbms;
static SQLPTRepresentation* reps;
@@ -58,14 +76,105 @@ class SQLPTRepresentationTest : public ::testing::Test {
EXPECT_TRUE(dbms->Open());
}
+ void TearDown() { EXPECT_TRUE(reps->Clear()); }
+
static void TearDownTestCase() {
EXPECT_TRUE(reps->Drop());
EXPECT_TRUE(reps->Close());
+ reps->RemoveDB();
delete reps;
dbms->Close();
}
-void PolicyTableUpdatePrepare(Json::Value& table) {
+ virtual utils::dbms::SQLDatabase* db() const { return reps->db(); }
+
+ void GatherModuleMeta(policy_table::ModuleMeta* meta) const {
+ ::SQLPTRepresentation::GatherModuleMeta(meta);
+ }
+
+ void GatherModuleConfig(policy_table::ModuleConfig* config) const {
+ ::SQLPTRepresentation::GatherModuleConfig(config);
+ }
+
+ bool GatherUsageAndErrorCounts(
+ policy_table::UsageAndErrorCounts* counts) const {
+ return ::SQLPTRepresentation::GatherUsageAndErrorCounts(counts);
+ }
+
+ bool GatherApplicationPoliciesSection(
+ policy_table::ApplicationPoliciesSection* policies) const {
+ return ::SQLPTRepresentation::GatherApplicationPoliciesSection(policies);
+ }
+ virtual void GatherDeviceData(policy_table::DeviceData* data) const {
+ ::SQLPTRepresentation::GatherDeviceData(data);
+ }
+
+ virtual bool GatherConsumerFriendlyMessages(
+ policy_table::ConsumerFriendlyMessages* messages) const {
+ return ::SQLPTRepresentation::GatherConsumerFriendlyMessages(messages);
+ }
+
+ bool GatherAppGroup(const std::string& app_id,
+ policy_table::Strings* app_groups) const {
+ return ::SQLPTRepresentation::GatherAppGroup(app_id, app_groups);
+ }
+
+ bool GatherAppType(const std::string& app_id,
+ policy_table::AppHMITypes* app_types) const {
+ return ::SQLPTRepresentation::GatherAppType(app_id, app_types);
+ }
+
+ bool GatherRequestType(const std::string& app_id,
+ policy_table::RequestTypes* request_types) const {
+ return ::SQLPTRepresentation::GatherRequestType(app_id, request_types);
+ }
+
+ bool GatherNickName(const std::string& app_id,
+ policy_table::Strings* nicknames) const {
+ return ::SQLPTRepresentation::GatherNickName(app_id, nicknames);
+ }
+
+ void CheckAppPoliciesSection(
+ policy_table::ApplicationPoliciesSection& policies, uint16_t apps_size,
+ policy_table::Priority prio, const std::string& section,
+ uint16_t memory_kb, uint32_t heart_beat_timeout_ms,
+ policy_table::Strings& groups) const {
+ if (section != "device") {
+ policy_table::ApplicationPolicies& apps = policies.apps;
+ EXPECT_EQ(apps_size, apps.size());
+ policy_table::ApplicationPolicies::iterator apps_iter =
+ apps.find(section);
+ ASSERT_TRUE(apps.end() != apps_iter);
+ policy_table::Strings& temp_groups = apps_iter->second.groups;
+ StringsCompare(groups, temp_groups);
+ EXPECT_EQ(0u, (*(apps_iter->second.nicknames)).size());
+ EXPECT_EQ(prio, apps_iter->second.priority);
+ EXPECT_EQ(0u, (*(apps_iter->second.AppHMIType)).size());
+ EXPECT_EQ(memory_kb, (*(apps_iter->second.memory_kb)));
+ EXPECT_EQ(heart_beat_timeout_ms,
+ (*(apps_iter->second.heart_beat_timeout_ms)));
+ } else {
+ policy_table::DevicePolicy& device = policies.device;
+ EXPECT_EQ(prio, device.priority);
+ }
+ }
+
+ void StringsCompare(policy_table::Strings& groups1,
+ policy_table::Strings& groups2) const {
+ EXPECT_EQ(groups1.size(), groups2.size());
+ std::sort(groups1.begin(), groups1.end());
+ std::sort(groups2.begin(), groups2.end());
+ EXPECT_TRUE(groups1 == groups2);
+ }
+
+ void CheckAppGroups(const std::string& app_id,
+ policy_table::Strings& groups) {
+ policy_table::Strings app_groups;
+ GatherAppGroup(app_id, &app_groups);
+ StringsCompare(groups, app_groups);
+ }
+
+ void PolicyTableUpdatePrepare(Json::Value& table) {
table["policy_table"] = Json::Value(Json::objectValue);
Json::Value& policy_table = table["policy_table"];
policy_table["module_config"] = Json::Value(Json::objectValue);
@@ -75,7 +184,7 @@ void PolicyTableUpdatePrepare(Json::Value& table) {
Json::Value& module_config = policy_table["module_config"];
module_config["preloaded_pt"] = Json::Value(false);
- module_config["preloaded_date"] = Json::Value("25-04-2015");
+ module_config["preloaded_date"] = Json::Value("");
module_config["exchange_after_x_ignition_cycles"] = Json::Value(10);
module_config["exchange_after_x_kilometers"] = Json::Value(100);
module_config["exchange_after_x_days"] = Json::Value(5);
@@ -106,10 +215,10 @@ void PolicyTableUpdatePrepare(Json::Value& table) {
Json::Value(5);
module_config["notifications_per_minute_by_priority"]["none"] =
Json::Value(6);
- module_config["vehicle_make"] = Json::Value("MakeT");
- module_config["vehicle_model"] = Json::Value("ModelT");
- module_config["vehicle_year"] = Json::Value("2014");
- module_config["certificate"] = Json::Value("my_cert");
+ module_config["vehicle_make"] = Json::Value("");
+ module_config["vehicle_model"] = Json::Value("");
+ module_config["vehicle_year"] = Json::Value("");
+ module_config["certificate"] = Json::Value("");
Json::Value& functional_groupings = policy_table["functional_groupings"];
functional_groupings["default"] = Json::Value(Json::objectValue);
@@ -180,6 +289,7 @@ void PolicyTableUpdatePrepare(Json::Value& table) {
app_policies["device"]["keep_context"] = Json::Value(true);
app_policies["device"]["steal_focus"] = Json::Value(true);
}
+
::testing::AssertionResult IsValid(const policy_table::Table& table) {
if (table.is_valid()) {
return ::testing::AssertionSuccess();
@@ -193,15 +303,103 @@ void PolicyTableUpdatePrepare(Json::Value& table) {
DBMS* SQLPTRepresentationTest::dbms = 0;
SQLPTRepresentation* SQLPTRepresentationTest::reps = 0;
-#ifdef __QNX__
-const std::string SQLPTRepresentationTest::kDatabaseName = "policy";
-#else // __QNX__
const std::string SQLPTRepresentationTest::kDatabaseName = "policy.sqlite";
-#endif // __QNX__
-TEST_F(SQLPTRepresentationTest, CheckPermissionsAllowed_SetValuesInAppGroupRpcFunctionalGroup_GetEqualParamsInCheckPermissionResult) {
- //arrange
- const char* query = "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`,"
+class SQLPTRepresentationTest2 : public ::testing::Test {
+ protected:
+ SQLPTRepresentation* reps;
+
+ virtual void SetUp() {
+ const char kDirectory[] = "storage123";
+ file_system::CreateDirectory(kDirectory);
+ chmod(kDirectory, 00000);
+ profile::Profile::instance()->config_file_name("smartDeviceLink3.ini");
+ reps = new SQLPTRepresentation;
+ }
+
+ virtual void TearDown() {
+ profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
+ delete reps;
+ }
+};
+
+TEST_F(SQLPTRepresentationTest2,
+ OpenAttemptTimeOut_ExpectCorrectNumber) {
+ EXPECT_EQ(::policy::FAIL, reps->Init());
+ // Check Actual attempts number made to try to open DB
+ // Check timeout value correctly read from config file.
+ EXPECT_EQ(profile::Profile::instance()->open_attempt_timeout_ms(), 700);
+}
+
+TEST_F(SQLPTRepresentationTest,
+ RefreshDB_DropExistedPTThenRefreshDB_ExpectTablesWithInitialData) {
+ // Check
+ const char* query_select =
+ "SELECT COUNT(*) FROM sqlite_master WHERE `type` = 'table'";
+ // In normally created PT there are more than 0 tables
+ ASSERT_GT(dbms->FetchOneInt(query_select), 0);
+ ASSERT_TRUE(reps->Drop());
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select));
+ ASSERT_TRUE(reps->RefreshDB());
+ // Check PT structure destroyed and tables number is 0
+ ASSERT_EQ(25, dbms->FetchOneInt(query_select));
+ const char* query_select_count_of_iap_buffer_full =
+ "SELECT `count_of_iap_buffer_full` FROM `usage_and_error_count`";
+ const char* query_select_count_sync_out_of_memory =
+ "SELECT `count_sync_out_of_memory` FROM `usage_and_error_count`";
+ const char* query_select_count_of_sync_reboots =
+ "SELECT `count_of_sync_reboots` FROM `usage_and_error_count`";
+ const char* query_select_pt_exchanged_at_odometer_x =
+ "SELECT `pt_exchanged_at_odometer_x` FROM `module_meta`";
+ const char* query_select_pt_exchanged_x_days_after_epoch =
+ "SELECT `pt_exchanged_x_days_after_epoch` FROM `module_meta`";
+ const char* query_select_flag_update_required =
+ "SELECT `flag_update_required` FROM `module_meta`";
+ const char* query_select_ignition_cycles_since_last_exchange =
+ "SELECT `ignition_cycles_since_last_exchange` FROM `module_meta`";
+ const char* query_select_preloaded_pt =
+ "SELECT `preloaded_pt` FROM `module_config`";
+ const char* query_select_is_first_run =
+ "SELECT `is_first_run` FROM `module_config`";
+ const char* query_select_exchange_after_x_ignition_cycles =
+ "SELECT `exchange_after_x_ignition_cycles` FROM `module_config`";
+ const char* query_select_exchange_after_x_kilometers =
+ "SELECT `exchange_after_x_kilometers` FROM `module_config`";
+ const char* query_select_exchange_after_x_days =
+ "SELECT `exchange_after_x_days` FROM `module_config`";
+ const char* query_select_timeout_after_x_seconds =
+ "SELECT `timeout_after_x_seconds` FROM `module_config`";
+ const char* query_select_priorities = "SELECT COUNT(`value`) FROM `priority`";
+ const char* query_select_hmi_levels =
+ "SELECT COUNT(`value`) FROM `hmi_level`";
+ const char* query_select_version = "SELECT `number` FROM `version`";
+
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_count_of_iap_buffer_full));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_count_sync_out_of_memory));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_count_of_sync_reboots));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_pt_exchanged_at_odometer_x));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_pt_exchanged_x_days_after_epoch));
+ ASSERT_EQ(
+ 0, dbms->FetchOneInt(query_select_ignition_cycles_since_last_exchange));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_flag_update_required));
+ ASSERT_EQ(1, dbms->FetchOneInt(query_select_preloaded_pt));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_is_first_run));
+ ASSERT_EQ(0,
+ dbms->FetchOneInt(query_select_exchange_after_x_ignition_cycles));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_exchange_after_x_kilometers));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_exchange_after_x_days));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_timeout_after_x_seconds));
+ ASSERT_EQ(6, dbms->FetchOneInt(query_select_priorities));
+ ASSERT_EQ(4, dbms->FetchOneInt(query_select_hmi_levels));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_version));
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ CheckPermissionsAllowed_SetValuesInAppGroupRpcFunctionalGroup_GetEqualParamsInCheckPermissionResult) {
+ // Arrange
+ const char* query =
+ "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`,"
" `heart_beat_timeout_ms`) VALUES ('12345', 5, 10); "
"INSERT OR REPLACE INTO functional_group (`id`, `name`)"
" VALUES (1, 'Base-4'); "
@@ -212,23 +410,26 @@ TEST_F(SQLPTRepresentationTest, CheckPermissionsAllowed_SetValuesInAppGroupRpcFu
"INSERT OR REPLACE INTO `rpc` (`name`, `parameter`, `hmi_level_value`,"
" `functional_group_id`) VALUES ('Update', 'speed', 'FULL', 1);";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query));
- //Act
+ // Act
CheckPermissionResult ret;
reps->CheckPermissions("12345", "FULL", "Update", ret);
- //assert
+ // Assert
EXPECT_TRUE(ret.hmi_level_permitted == ::policy::kRpcAllowed);
ASSERT_EQ(2u, ret.list_of_allowed_params.size());
EXPECT_EQ("gps", ret.list_of_allowed_params[0]);
EXPECT_EQ("speed", ret.list_of_allowed_params[1]);
}
-TEST_F(SQLPTRepresentationTest, CheckPermissionsAllowedWithoutParameters_SetLimitedPermissions_ExpectEmptyListOfAllowedParams) {
- //arrange
- const char* query = "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`,"
+TEST_F(
+ SQLPTRepresentationTest,
+ CheckPermissionsAllowedWithoutParameters_SetLimitedPermissions_ExpectEmptyListOfAllowedParams) {
+ // Arrange
+ const char* query =
+ "INSERT OR REPLACE INTO `application` (`id`, `memory_kb`,"
" `heart_beat_timeout_ms`) VALUES ('12345', 5, 10); "
"INSERT OR REPLACE INTO functional_group (`id`, `name`)"
" VALUES (1, 'Base-4'); "
@@ -238,323 +439,945 @@ TEST_F(SQLPTRepresentationTest, CheckPermissionsAllowedWithoutParameters_SetLimi
"INSERT OR REPLACE INTO `rpc` (`name`, `hmi_level_value`,"
" `functional_group_id`) VALUES ('Update', 'LIMITED', 1);";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query));
- //act
+ // Act
CheckPermissionResult ret;
reps->CheckPermissions("12345", "LIMITED", "Update", ret);
- //assert
+ // Assert
EXPECT_TRUE(ret.hmi_level_permitted == ::policy::kRpcAllowed);
EXPECT_TRUE(ret.list_of_allowed_params.empty());
}
-TEST_F(SQLPTRepresentationTest, CheckPermissionsDisallowedWithoutParameters_DeletedAppGroupAndSetFULLLevel_ExpectHmiLevelIsDissalowed) {
-
- //arrange
+TEST_F(
+ SQLPTRepresentationTest,
+ CheckPermissionsDisallowedWithoutParameters_DeletedAppGroupAndSetFULLLevel_ExpectHmiLevelIsDissalowed) {
+ // Arrange
const char* query = "DELETE FROM `app_group`";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query));
- //act
+ // Act
CheckPermissionResult ret;
reps->CheckPermissions("12345", "FULL", "Update", ret);
- //assert
+ // Assert
EXPECT_EQ(::policy::kRpcDisallowed, ret.hmi_level_permitted);
EXPECT_TRUE(ret.list_of_allowed_params.empty());
}
-TEST_F(SQLPTRepresentationTest, PTPReloaded_UpdateModuleConfig_ReturnIsPTPreloadedTRUE) {
-
- //arrange
+TEST_F(SQLPTRepresentationTest,
+ PTPReloaded_UpdateModuleConfig_ReturnIsPTPreloadedTRUE) {
+ // Arrange
const char* query = "UPDATE `module_config` SET `preloaded_pt` = 1";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query));
EXPECT_TRUE(reps->IsPTPreloaded());
}
-TEST_F(SQLPTRepresentationTest, GetUpdateUrls_DeleteAndInsertEndpoints_ExpectUpdateUrls) {
-
- //arrange
+TEST_F(SQLPTRepresentationTest,
+ GetUpdateUrls_DeleteAndInsertEndpoints_ExpectUpdateUrls) {
+ // Arrange
const char* query_delete = "DELETE FROM `endpoint`; ";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_delete));
- //act
+ // Act
EndpointUrls ret = reps->GetUpdateUrls(7);
- //assert
+ // Assert
EXPECT_TRUE(ret.empty());
- //act
+ // Act
const char* query_insert =
"INSERT INTO `endpoint` (`application_id`, `url`, `service`) "
- " VALUES ('12345', 'http://ford.com/cloud/1', 7);"
- "INSERT INTO `endpoint` (`application_id`, `url`, `service`) "
- " VALUES ('12345', 'http://ford.com/cloud/2', 7);";
+ " VALUES ('12345', 'http://ford.com/cloud/1', 7);"
+ "INSERT INTO `endpoint` (`application_id`, `url`, `service`) "
+ " VALUES ('12345', 'http://ford.com/cloud/2', 7);";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_insert));
- //act
+ // Act
ret = reps->GetUpdateUrls(7);
- //assert
+ // Assert
ASSERT_EQ(2u, ret.size());
EXPECT_EQ("http://ford.com/cloud/1", ret[0].url[0]);
EXPECT_EQ("http://ford.com/cloud/2", ret[1].url[0]);
- //act
+ // Act
ret = reps->GetUpdateUrls(0);
- //assert
+ // Assert
EXPECT_TRUE(ret.empty());
}
-TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchange_WithParametersOfQueryEqualZero) {
-
- //arrange
- const char* query_zeros = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ IgnitionCyclesBeforeExchange_WithParametersOfQueryEqualZero) {
+ // Arrange
+ const char* query_zeros =
+ "UPDATE `module_meta` SET "
" `ignition_cycles_since_last_exchange` = 0; "
" UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 0";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_zeros));
EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange());
- //act
+ // Act
reps->IncrementIgnitionCycles();
- //assert
+ // Assert
EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange());
-
}
-TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchange_WithParametersOfQueryAreLessLimit) {
-
- //arrange
- const char* query_less_limit = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ IgnitionCyclesBeforeExchange_WithParametersOfQueryAreLessLimit) {
+ // Arrange
+ const char* query_less_limit =
+ "UPDATE `module_meta` SET "
" `ignition_cycles_since_last_exchange` = 5; "
" UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 10";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_less_limit));
EXPECT_EQ(5, reps->IgnitionCyclesBeforeExchange());
- //act
+ // Act
reps->IncrementIgnitionCycles();
- //assert
+ // Assert
EXPECT_EQ(4, reps->IgnitionCyclesBeforeExchange());
-
}
-TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchange_WithLimitCountOfParametersOfQuery) {
-
- //arrange
- const char* query_limit = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ IgnitionCyclesBeforeExchange_WithLimitCountOfParametersOfQuery) {
+ // Arrange
+ const char* query_limit =
+ "UPDATE `module_meta` SET "
" `ignition_cycles_since_last_exchange` = 9; "
" UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 10";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_limit));
EXPECT_EQ(1, reps->IgnitionCyclesBeforeExchange());
-
- //act
+ // Act
reps->IncrementIgnitionCycles();
-
- //assert
+ // Assert
EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange());
-
}
-TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchange_WithMoreLimitCountOfParametersOfQuery) {
-
- //arrange
- const char* query_more_limit = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ IgnitionCyclesBeforeExchange_WithMoreLimitCountOfParametersOfQuery) {
+ // Arrange
+ const char* query_more_limit =
+ "UPDATE `module_meta` SET "
" `ignition_cycles_since_last_exchange` = 12; "
" UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 10";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_more_limit));
+ // Chceck
EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange());
-
}
-TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchange_WithNegativeLimitOfParametersOfQuery) {
-
- //arrange
- const char* query_negative_limit = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ IgnitionCyclesBeforeExchange_WithNegativeLimitOfParametersOfQuery) {
+ // Arrange
+ const char* query_negative_limit =
+ "UPDATE `module_meta` SET "
" `ignition_cycles_since_last_exchange` = 3; "
" UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = -1";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_negative_limit));
+ // Check
EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange());
}
-TEST_F(SQLPTRepresentationTest, IgnitionCyclesBeforeExchange_WithNegativeLimitOfCurrentParameterOfQuery) {
-
- //arrange
- const char* query_negative_current = "UPDATE `module_meta` SET "
+TEST_F(
+ SQLPTRepresentationTest,
+ IgnitionCyclesBeforeExchange_WithNegativeLimitOfCurrentParameterOfQuery) {
+ // Arrange
+ const char* query_negative_current =
+ "UPDATE `module_meta` SET "
" `ignition_cycles_since_last_exchange` = -1; "
" UPDATE `module_config` SET `exchange_after_x_ignition_cycles` = 2";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_negative_current));
+ // Check
EXPECT_EQ(0, reps->IgnitionCyclesBeforeExchange());
}
-TEST_F(SQLPTRepresentationTest, KilometersBeforeExchange_WithParametersOfQueryEqualZero) {
-
- //arrange
- const char* query_zeros = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ KilometersBeforeExchange_WithParametersOfQueryEqualZero) {
+ // Arrange
+ const char* query_zeros =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_at_odometer_x` = 0; "
" UPDATE `module_config` SET `exchange_after_x_kilometers` = 0";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_zeros));
+ // Checks
EXPECT_EQ(0, reps->KilometersBeforeExchange(0));
EXPECT_EQ(0, reps->KilometersBeforeExchange(-10));
EXPECT_EQ(0, reps->KilometersBeforeExchange(10));
}
-TEST_F(SQLPTRepresentationTest, KilometersBeforeExchange_QueryWithNegativeLimit) {
-
- //arrange
- const char* query_negative_limit = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ KilometersBeforeExchange_QueryWithNegativeLimit) {
+ // Arrange
+ const char* query_negative_limit =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_at_odometer_x` = 10; "
" UPDATE `module_config` SET `exchange_after_x_kilometers` = -10";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_negative_limit));
+ // Checks
EXPECT_EQ(0, reps->KilometersBeforeExchange(0));
EXPECT_EQ(0, reps->KilometersBeforeExchange(10));
}
-TEST_F(SQLPTRepresentationTest, KilometersBeforeExchange_QueryWithNegativeCurrentLimit) {
-
- //arrange
- const char* query_negative_last = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ KilometersBeforeExchange_QueryWithNegativeCurrentLimit) {
+ // Arrange
+ const char* query_negative_last =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_at_odometer_x` = -10; "
" UPDATE `module_config` SET `exchange_after_x_kilometers` = 20";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_negative_last));
+ // Checks
EXPECT_EQ(0, reps->KilometersBeforeExchange(0));
EXPECT_EQ(0, reps->KilometersBeforeExchange(10));
}
-TEST_F(SQLPTRepresentationTest, KilometersBeforeExchange_QueryWithLimitParameters) {
-
- //arrange
- const char* query_limit = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ KilometersBeforeExchange_QueryWithLimitParameters) {
+ // Arrange
+ const char* query_limit =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_at_odometer_x` = 10; "
" UPDATE `module_config` SET `exchange_after_x_kilometers` = 100";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_limit));
+ // Checks
EXPECT_EQ(0, reps->KilometersBeforeExchange(120));
EXPECT_EQ(60, reps->KilometersBeforeExchange(50));
EXPECT_EQ(0, reps->KilometersBeforeExchange(5));
}
-TEST_F(SQLPTRepresentationTest, DaysBeforeExchange_WithParametersOfQueryEqualZero) {
-
- //arrange
- const char* query_zeros = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ DaysBeforeExchange_WithParametersOfQueryEqualZero) {
+ // Arrange
+ const char* query_zeros =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_x_days_after_epoch` = 0; "
" UPDATE `module_config` SET `exchange_after_x_days` = 0";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_zeros));
+ // Checks
EXPECT_EQ(0, reps->DaysBeforeExchange(0));
EXPECT_EQ(0, reps->DaysBeforeExchange(-10));
EXPECT_EQ(0, reps->DaysBeforeExchange(10));
}
TEST_F(SQLPTRepresentationTest, DaysBeforeExchange_QueryWithNegativeLimit) {
-
- //arrange
- const char* query_negative_limit = "UPDATE `module_meta` SET "
+ // Arrange
+ const char* query_negative_limit =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_x_days_after_epoch` = 10; "
" UPDATE `module_config` SET `exchange_after_x_days` = -10";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_negative_limit));
+ // Checks
EXPECT_EQ(0, reps->DaysBeforeExchange(0));
EXPECT_EQ(0, reps->DaysBeforeExchange(10));
}
-TEST_F(SQLPTRepresentationTest, DaysBeforeExchange_QueryWithNegativeCurrentLimit) {
-
- //arrange
- const char* query_negative_last = "UPDATE `module_meta` SET "
+TEST_F(SQLPTRepresentationTest,
+ DaysBeforeExchange_QueryWithNegativeCurrentLimit) {
+ // Arrange
+ const char* query_negative_last =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_x_days_after_epoch` = -10; "
" UPDATE `module_config` SET `exchange_after_x_days` = 20";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_negative_last));
+ // Checks
EXPECT_EQ(0, reps->DaysBeforeExchange(0));
EXPECT_EQ(0, reps->DaysBeforeExchange(10));
}
TEST_F(SQLPTRepresentationTest, DaysBeforeExchange_QueryWithLimitParameters) {
-
- //arrange
- const char* query_limit = "UPDATE `module_meta` SET "
+ // Arrange
+ const char* query_limit =
+ "UPDATE `module_meta` SET "
" `pt_exchanged_x_days_after_epoch` = 10; "
" UPDATE `module_config` SET `exchange_after_x_days` = 100";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_limit));
+ // Checks
EXPECT_EQ(0, reps->DaysBeforeExchange(120));
EXPECT_EQ(60, reps->DaysBeforeExchange(50));
EXPECT_EQ(0, reps->DaysBeforeExchange(5));
}
-TEST_F(SQLPTRepresentationTest, SecondsBetweenRetries_DeletedAndInsertedSecondsBetweenRetry_ExpectCountOfSecondsEqualInserted) {
-
- //arrange
+TEST_F(
+ SQLPTRepresentationTest,
+ SecondsBetweenRetries_DeletedAndInsertedSecondsBetweenRetry_ExpectCountOfSecondsEqualInserted) {
+ // Arrange
std::vector<int> seconds;
const char* query_delete = "DELETE FROM `seconds_between_retry`; ";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_delete));
ASSERT_TRUE(reps->SecondsBetweenRetries(&seconds));
EXPECT_EQ(0u, seconds.size());
- //arrange
+ // Arrange
const char* query_insert =
"INSERT INTO `seconds_between_retry` (`index`, `value`) "
- " VALUES (0, 10); "
- "INSERT INTO `seconds_between_retry` (`index`, `value`) "
- " VALUES (1, 20); ";
+ " VALUES (0, 10); "
+ "INSERT INTO `seconds_between_retry` (`index`, `value`) "
+ " VALUES (1, 20); ";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query_insert));
ASSERT_TRUE(reps->SecondsBetweenRetries(&seconds));
+ // Checks
ASSERT_EQ(2u, seconds.size());
EXPECT_EQ(10, seconds[0]);
EXPECT_EQ(20, seconds[1]);
}
TEST_F(SQLPTRepresentationTest, TimeoutResponse_Set60Seconds_GetEqualTimeout) {
-
- //arrange
+ // Arrange
const char* query =
"UPDATE `module_config` SET `timeout_after_x_seconds` = 60";
- //assert
+ // Assert
ASSERT_TRUE(dbms->Exec(query));
+ // Check
EXPECT_EQ(60, reps->TimeoutResponse());
}
TEST_F(SQLPTRepresentationTest,
+ IsPTPreloaded_SetPTPreloadedThenCheck_ExpectCorrectValue) {
+ // Arrange
+ const char* query_insert = "UPDATE `module_config` SET `preloaded_pt` = 1";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ // Check
+ ASSERT_TRUE(reps->IsPTPreloaded());
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ SetCountersPassedForSuccessfulUpdate_SetCounters_ExpectValueChangedInPT) {
+ // Arrange
+ const char* query_select_odometer =
+ "SELECT `pt_exchanged_at_odometer_x` FROM`module_meta`";
+ const char* query_select_days_after_epoch =
+ "SELECT `pt_exchanged_x_days_after_epoch` FROM`module_meta`";
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_odometer));
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select_days_after_epoch));
+ // Act
+ ASSERT_TRUE(reps->SetCountersPassedForSuccessfulUpdate(100, 10000));
+ ASSERT_EQ(100, dbms->FetchOneInt(query_select_odometer));
+ ASSERT_EQ(10000, dbms->FetchOneInt(query_select_days_after_epoch));
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ IncrementIgnitionCycles_SetIgnitionCyclesValueThenIncrement_ExpectValueIncrementedInPT) {
+ // Arrange
+ const char* query_insert =
+ "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 54";
+ const char* query_select =
+ "SELECT `ignition_cycles_since_last_exchange`FROM `module_meta`";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ // Act
+ reps->IncrementIgnitionCycles();
+ // Check
+ ASSERT_EQ(55, dbms->FetchOneInt(query_select));
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ ResetIgnitionCycles_SetIgnitionCyclesValueThenReset_ExpectZeroValueInPT) {
+ // Arrange
+ const char* query_insert =
+ "UPDATE `module_meta` SET `ignition_cycles_since_last_exchange` = 55";
+ const char* query_select =
+ "SELECT `ignition_cycles_since_last_exchange` FROM `module_meta`";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ // Act
+ reps->ResetIgnitionCycles();
+ // Check
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ GetUserFriendlyMsg_SetMsg_ExpectReceivedMsgSetInParams) {
+ // Arrange
+
+ const char* query_insert =
+ "INSERT INTO `message` (`language_code`, `message_type_name`) VALUES "
+ "('en-en', 'AppPermissions')";
+
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ query_insert =
+ "INSERT INTO `message_type` (`name`) VALUES ('AppPermissions')";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ std::vector<std::string> msg_code;
+ msg_code.push_back("AppPermissions");
+ // Act
+ std::vector<UserFriendlyMessage> result =
+ reps->GetUserFriendlyMsg(msg_code, std::string("en-en"));
+ // Checks
+ ASSERT_EQ(1u, result.size());
+ EXPECT_EQ(result[0].message_code, "AppPermissions");
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ GetNotificationNumber_SetNotificationsPriorities_ExpectReceivedValuesCorrect) {
+ // Arrange
+ const char* query_insert =
+ "INSERT INTO `notifications_by_priority` (`priority_value`, `value`) "
+ "VALUES ('NAVIGATION', 15) , "
+ "('COMMUNICATION', 6), ('EMERGENCY', 60), ('NONE', 0), ('NORMAL', 4), "
+ "('VOICECOMMUNICATION', 20)";
+
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ EXPECT_EQ(6, reps->GetNotificationsNumber("COMMUNICATION"));
+ EXPECT_EQ(60, reps->GetNotificationsNumber("EMERGENCY"));
+ EXPECT_EQ(15, reps->GetNotificationsNumber("NAVIGATION"));
+ EXPECT_EQ(0, reps->GetNotificationsNumber("NONE"));
+ EXPECT_EQ(4, reps->GetNotificationsNumber("NORMAL"));
+ EXPECT_EQ(20, reps->GetNotificationsNumber("VOICECOMMUNICATION"));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ GetPriority_SetAppsPrioritiesThenGet_ExpectReceivedValuesCorrect) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, "
+ "0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'pre_DataConsent', 0, 0, 'NONE', "
+ "'NONE', 0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'device', 0, 0, 'NONE', "
+ "'COMMUNICATION', 0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', "
+ "0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ std::string priority;
+ // Checks
+ EXPECT_TRUE(reps->GetPriority("default", &priority));
+ EXPECT_EQ("NONE", priority);
+ EXPECT_TRUE(reps->GetPriority("pre_DataConsent", &priority));
+ EXPECT_EQ("NONE", priority);
+ EXPECT_TRUE(reps->GetPriority("device", &priority));
+ EXPECT_EQ("COMMUNICATION", priority);
+ EXPECT_TRUE(reps->GetPriority("12345", &priority));
+ EXPECT_EQ("EMERGENCY", priority);
+}
+
+TEST(SQLPTRepresentationTest3, Init_InitNewDataBase_ExpectResultSuccess) {
+ // Arrange
+ SQLPTRepresentation* reps;
+ reps = new SQLPTRepresentation;
+ // Checks
+ EXPECT_EQ(::policy::SUCCESS, reps->Init());
+ EXPECT_EQ(::policy::EXISTS, reps->Init());
+ reps->RemoveDB();
+ delete reps;
+}
+
+TEST(SQLPTRepresentationTest3,
+ Init_TryInitNotExistingDataBase_ExpectResultFail) {
+ // Arrange
+ SQLPTRepresentation reps;
+ (reps.db())->set_path("/home/");
+ // Check
+ EXPECT_EQ(::policy::FAIL, reps.Init());
+}
+
+TEST(SQLPTRepresentationTest3,
+ Close_InitNewDataBaseThenClose_ExpectResultSuccess) {
+ // Arrange
+ SQLPTRepresentation reps;
+ EXPECT_EQ(::policy::SUCCESS, reps.Init());
+ EXPECT_TRUE(reps.Close());
+ utils::dbms::SQLError error(utils::dbms::Error::OK);
+ // Checks
+ EXPECT_EQ(error.number(), (reps.db()->LastError().number()));
+ reps.RemoveDB();
+}
+
+TEST_F(SQLPTRepresentationTest,
+ Clear_InitNewDataBaseThenClear_ExpectResultSuccess) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, "
+ "0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'pre_DataConsent', 0, 0, 'NONE', "
+ "'NONE', 0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'device', 0, 0, 'NONE', "
+ "'COMMUNICATION', 0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', "
+ "0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ const char* query_insert =
+ "INSERT INTO `notifications_by_priority` (`priority_value`, `value`) "
+ "VALUES ('NAVIGATION', 15) , "
+ "('COMMUNICATION', 6), ('EMERGENCY', 60), ('NONE', 0), ('NORMAL', 4), "
+ "('VOICECOMMUNICATION', 20)";
+
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ EXPECT_TRUE(reps->Clear());
+ utils::dbms::SQLError error(utils::dbms::Error::OK);
+ EXPECT_EQ(error.number(), (reps->db()->LastError().number()));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ GetInitialAppData_SetData_ExpectCorrectValuesReceived) {
+ // Arrange
+ const char* query_insert =
+ "INSERT INTO `nickname` (`application_id`, `name`)"
+ "VALUES ('1111', 'first_app') , "
+ "('2222', 'second_app'), ('3333', 'third_app')";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+
+ query_insert =
+ "INSERT INTO `app_type` (`application_id`, `name`)"
+ "VALUES ('1111', 'NAVIGATION') , "
+ "('1111', 'MEDIA'), ('3333', 'COMMUNICATION')";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ ::policy::StringArray nicknames;
+ ::policy::StringArray app_types;
+ ASSERT_TRUE(reps->GetInitialAppData("1111", &nicknames, &app_types));
+ EXPECT_EQ(1u, nicknames.size());
+ EXPECT_TRUE(nicknames.end() !=
+ std::find(nicknames.begin(), nicknames.end(), "first_app"));
+ EXPECT_EQ(2u, app_types.size());
+ EXPECT_TRUE(app_types.end() !=
+ std::find(app_types.begin(), app_types.end(), "NAVIGATION"));
+ EXPECT_TRUE(app_types.end() !=
+ std::find(app_types.begin(), app_types.end(), "MEDIA"));
+ nicknames.clear();
+ app_types.clear();
+ ASSERT_TRUE(reps->GetInitialAppData("2222", &nicknames, &app_types));
+ EXPECT_EQ(1u, nicknames.size());
+ EXPECT_TRUE(nicknames.end() !=
+ std::find(nicknames.begin(), nicknames.end(), "second_app"));
+ EXPECT_EQ(0u, app_types.size());
+ nicknames.clear();
+ app_types.clear();
+ ASSERT_TRUE(reps->GetInitialAppData("3333", &nicknames, &app_types));
+ EXPECT_EQ(1u, nicknames.size());
+ EXPECT_TRUE(nicknames.end() !=
+ std::find(nicknames.begin(), nicknames.end(), "third_app"));
+ EXPECT_EQ(1u, app_types.size());
+ EXPECT_TRUE(app_types.end() !=
+ std::find(app_types.begin(), app_types.end(), "COMMUNICATION"));
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ GetFunctionalGroupings_SetFunctionalGroupings_ExpectCorrectValuesReceived) {
+ // Arrange
+ const char* query_insert =
+ "INSERT INTO `functional_group` (`id`, `user_consent_prompt`, `name`) "
+ "VALUES (73072936, null, 'SendLocation'), (1533011474, null, "
+ "'OnKeyboardInputOnlyGroup')";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+
+ query_insert =
+ "INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) "
+ "VALUES ('SendLocation', 'BACKGROUND', 73072936), ('SendLocation', "
+ "'FULL', 73072936), ('SendLocation', 'LIMITED', 73072936)";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+
+ query_insert =
+ "INSERT INTO `rpc` (`name`, `hmi_level_value`, `functional_group_id`) "
+ "VALUES ('OnKeyboardInput', 'FULL', 1533011474)";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+
+ policy_table::FunctionalGroupings func_groups;
+ ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
+ EXPECT_EQ(2u, func_groups.size());
+ policy_table::FunctionalGroupings::iterator func_groups_it =
+ func_groups.find("SendLocation");
+ EXPECT_TRUE(func_groups.end() != func_groups_it);
+ policy_table::Rpcs& rpcs = func_groups_it->second;
+ EXPECT_EQ("", static_cast<std::string>(*rpcs.user_consent_prompt));
+ policy_table::Rpc& rpc = rpcs.rpcs;
+ EXPECT_EQ(1u, rpc.size());
+ policy_table::Rpc::const_iterator rpc_it = rpc.find("SendLocation");
+ EXPECT_TRUE(rpc.end() != rpc_it);
+ const policy_table::HmiLevels& hmi_levels1 = rpc_it->second.hmi_levels;
+ EXPECT_EQ(3u, hmi_levels1.size());
+ EXPECT_TRUE(hmi_levels1.end() !=
+ std::find(hmi_levels1.begin(), hmi_levels1.end(),
+ policy_table::HmiLevel::HL_BACKGROUND));
+ EXPECT_TRUE(hmi_levels1.end() !=
+ std::find(hmi_levels1.begin(), hmi_levels1.end(),
+ policy_table::HmiLevel::HL_LIMITED));
+ EXPECT_TRUE(hmi_levels1.end() != std::find(hmi_levels1.begin(),
+ hmi_levels1.end(),
+ policy_table::HmiLevel::HL_FULL));
+
+ func_groups_it = func_groups.find("OnKeyboardInputOnlyGroup");
+ EXPECT_TRUE(func_groups.end() != func_groups_it);
+ policy_table::Rpcs& rpcs2 = func_groups_it->second;
+ EXPECT_EQ("", static_cast<std::string>(*rpcs2.user_consent_prompt));
+ policy_table::Rpc& rpc2 = rpcs2.rpcs;
+ EXPECT_EQ(1u, rpc2.size());
+ rpc_it = rpc2.find("OnKeyboardInput");
+ EXPECT_TRUE(rpc2.end() != rpc_it);
+ const policy_table::HmiLevels& hmi_levels2 = rpc_it->second.hmi_levels;
+ EXPECT_EQ(1u, hmi_levels2.size());
+ EXPECT_TRUE(hmi_levels2.end() != std::find(hmi_levels2.begin(),
+ hmi_levels2.end(),
+ policy_table::HmiLevel::HL_FULL));
+}
+
+TEST_F(
+ SQLPTRepresentationTest,
+ UpdateRequired_SetUpdateNotRequiredFlagThenCheck_ExpectUpdateNotRequired) {
+ // Arrange
+ EXPECT_FALSE(reps->UpdateRequired());
+}
+
+TEST_F(SQLPTRepresentationTest,
+ UpdateRequired_SetUpdateRequiredFlagThenCheck_ExpectUpdateRequired) {
+ // Arrange
+ const char* query_insert =
+ "UPDATE `module_meta` SET `flag_update_required` = 1";
+ // Assert
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ // Check
+ EXPECT_TRUE(reps->UpdateRequired());
+}
+
+TEST_F(SQLPTRepresentationTest,
+ SaveUpdateRequired_SaveUpdateRequired_ExpectCorrectValues) {
+ // Arrange
+ reps->SaveUpdateRequired(true);
+ // Check
+ EXPECT_TRUE(reps->UpdateRequired());
+ // Act
+ reps->SaveUpdateRequired(false);
+ // Check
+ EXPECT_FALSE(reps->UpdateRequired());
+}
+
+TEST_F(SQLPTRepresentationTest,
+ IsApplicationRepresented_Check_ExpectCorrectResult) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, "
+ "0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'device', 0, 0, 'NONE', "
+ "'COMMUNICATION', 0, 0, 0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', "
+ "0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ // Checks
+ EXPECT_TRUE(reps->IsApplicationRepresented("default"));
+ EXPECT_TRUE(reps->IsApplicationRepresented("device"));
+ EXPECT_TRUE(reps->IsApplicationRepresented("12345"));
+ EXPECT_FALSE(reps->IsApplicationRepresented("1234"));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ IsApplicationRevoked_CheckApps_ExpectCorrectResult) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '7777', 0, 0, 'NONE', 'NONE', 1, "
+ "0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'EMERGENCY', "
+ "0, 0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ // Checks
+ EXPECT_TRUE(reps->IsApplicationRevoked("7777"));
+ EXPECT_FALSE(reps->IsApplicationRevoked("12345"));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ CopyApplication_CopyApplication_ExpectAppCopiedSuccesfully) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, "
+ "1, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '123', 1, 0, 'FULL', "
+ "'COMMUNICATION', 1, 1, 0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ EXPECT_FALSE(reps->IsApplicationRepresented("7777"));
+ EXPECT_FALSE(reps->IsApplicationRepresented("9999"));
+ // Act
+ EXPECT_TRUE(reps->CopyApplication("default", "7777"));
+ EXPECT_TRUE(reps->CopyApplication("123", "9999"));
+ // Checks
+ EXPECT_TRUE(reps->IsApplicationRepresented("7777"));
+ EXPECT_TRUE(reps->IsApplicationRepresented("9999"));
+ EXPECT_FALSE(reps->IsApplicationRevoked("7777"));
+ EXPECT_TRUE(reps->IsApplicationRevoked("9999"));
+ EXPECT_TRUE(reps->IsDefaultPolicy("7777"));
+ std::string priority1;
+ std::string priority2;
+ EXPECT_TRUE(reps->GetPriority("default", &priority1));
+ EXPECT_TRUE(reps->GetPriority("7777", &priority2));
+ EXPECT_EQ(priority1, priority2);
+ EXPECT_TRUE(reps->GetPriority("123", &priority1));
+ EXPECT_TRUE(reps->GetPriority("9999", &priority2));
+ EXPECT_EQ(priority1, priority2);
+}
+
+TEST_F(SQLPTRepresentationTest,
+ IsDefaultPolicy_SetAppPreDataThenCheck_ExpectNotDefaultPolicySet) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( '12345', 0, 0, 'NONE', 'NONE', 0, "
+ "0, "
+ "1, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ // Check
+ EXPECT_FALSE(reps->IsDefaultPolicy("12345"));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ IsDefaultPolicy_SetAppDefaultThenCheck_ExpectNotDefaultPolicySet) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, `default_hmi`, `priority_value`, `is_revoked`, "
+ "`is_default`, `is_predata`, `memory_kb`, `heart_beat_timeout_ms`) "
+ "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 1, 0, 64, 10) ";
+
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ // Check
+ EXPECT_TRUE(reps->IsDefaultPolicy("1234567"));
+}
+
+TEST_F(SQLPTRepresentationTest, Drop_DropExistedPT_ExpectZeroTables) {
+ // Check
+ const char* query_select =
+ "SELECT COUNT(*) FROM `sqlite_master` WHERE `type` = 'table'";
+ // In normally created PT there are more than 0 tables
+ ASSERT_TRUE(dbms->Exec(query_select));
+ ASSERT_GT(dbms->FetchOneInt(query_select), 0);
+ // Destroy schema
+ ASSERT_TRUE(reps->Drop());
+ // Check PT structure destroyed and tables number is 0
+ ASSERT_EQ(0, dbms->FetchOneInt(query_select));
+ // Restore schema
+ ASSERT_TRUE(reps->RefreshDB());
+}
+
+TEST_F(SQLPTRepresentationTest,
+ SetDefaultPolicy_SetDefaultPolicyThenCheck_ExpectDefaultPolicySet) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, "
+ " `default_hmi`, `priority_value`, `is_revoked`, `is_default`, "
+ "`is_predata`, `memory_kb`, "
+ " `heart_beat_timeout_ms`) VALUES( 'default', 0, 0, 'NONE', 'NONE', 0, "
+ "0, "
+ "0, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+
+ query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, `default_hmi`, `priority_value`, `is_revoked`, "
+ "`is_default`, `is_predata`, `memory_kb`, `heart_beat_timeout_ms`) "
+ "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 0, 1, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ EXPECT_FALSE(reps->IsDefaultPolicy("1234567"));
+ // Act
+ ASSERT_TRUE(reps->SetDefaultPolicy("1234567"));
+ // Check
+ EXPECT_TRUE(reps->IsDefaultPolicy("1234567"));
+}
+
+TEST_F(SQLPTRepresentationTest,
+ SetPreloaded_SetPreloaded_ExpectPTSetToPreloaded) {
+ // Arrange
+ const char* query_insert = "UPDATE `module_config` SET `preloaded_pt` = 0";
+ ASSERT_TRUE(dbms->Exec(query_insert));
+ // Check
+ ASSERT_FALSE(reps->IsPTPreloaded());
+ // Act
+ reps->SetPreloaded(true);
+ // Check
+ ASSERT_TRUE(reps->IsPTPreloaded());
+ // Act
+ reps->SetPreloaded(false);
+ // Check
+ ASSERT_FALSE(reps->IsPTPreloaded());
+}
+
+TEST_F(SQLPTRepresentationTest,
+ SetIsDefault_SetIsDefault_ExpectDefaultFlagSet) {
+ // Arrange
+ const char* query_insert_app =
+ "INSERT OR IGNORE INTO `application`(`id`, `keep_context`, "
+ "`steal_focus`, `default_hmi`, `priority_value`, `is_revoked`, "
+ "`is_default`, `is_predata`, `memory_kb`, `heart_beat_timeout_ms`) "
+ "VALUES( '1234567', 0, 0, 'NONE', 'NONE', 0, 0, 1, 64, 10) ";
+ ASSERT_TRUE(dbms->Exec(query_insert_app));
+ const char* query_select =
+ "SELECT `is_default` FROM `application`WHERE`id`= '1234567' ";
+ EXPECT_EQ(0, dbms->FetchOneInt(query_select));
+ // Act
+ EXPECT_TRUE(reps->SetIsDefault("1234567", true));
+ // Check
+ EXPECT_EQ(1, dbms->FetchOneInt(query_select));
+ // Act
+ EXPECT_TRUE(reps->SetIsDefault("1234567", false));
+ // Check
+ EXPECT_EQ(0, dbms->FetchOneInt(query_select));
+}
+
+TEST(SQLPTRepresentationTest3, RemoveDB_RemoveDB_ExpectFileDeleted) {
+ // Arrange
+ SQLPTRepresentation* reps = new SQLPTRepresentation;
+ EXPECT_EQ(::policy::SUCCESS, reps->Init());
+ EXPECT_EQ(::policy::EXISTS, reps->Init());
+ std::string path = (reps->db())->get_path();
+ // Act
+ reps->RemoveDB();
+ // Check
+ EXPECT_FALSE(file_system::FileExists(path));
+ delete reps;
+}
+
+TEST_F(SQLPTRepresentationTest,
GenerateSnapshot_SetPolicyTable_SnapshotIsPresent) {
// Arrange
Json::Value table(Json::objectValue);
@@ -564,7 +1387,7 @@ TEST_F(SQLPTRepresentationTest,
update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
// Assert
- ASSERT_TRUE(IsValid(update));
+ //ASSERT_TRUE(IsValid(update));
ASSERT_TRUE(reps->Save(update));
// Act
@@ -599,6 +1422,137 @@ TEST_F(SQLPTRepresentationTest,
snapshot->ToJsonValue().toStyledString());
}
+TEST_F(SQLPTRepresentationTest, Save_SetPolicyTableThenSave_ExpectSavedToPT) {
+ // Arrange
+ Json::Value table(Json::objectValue);
+ PolicyTableUpdatePrepare(table);
+
+ policy_table::Table update(&table);
+ update.SetPolicyTableType(rpc::policy_table_interface_base::PT_UPDATE);
+ // Checks PT before Save
+ policy_table::FunctionalGroupings func_groups;
+ ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
+ // Check functional groupings section
+ EXPECT_EQ(0u, func_groups.size());
+
+ policy_table::ApplicationPoliciesSection policies;
+ GatherApplicationPoliciesSection(&policies);
+ // Check ApplicationPoliciesSection
+ EXPECT_EQ(0u, policies.apps.size());
+ EXPECT_EQ(policy_table::Priority::P_EMERGENCY, policies.device.priority);
+
+ policy_table::ModuleConfig config;
+ GatherModuleConfig(&config);
+ // Check Module config section
+ EXPECT_TRUE(*config.preloaded_pt);
+ EXPECT_EQ(0, config.exchange_after_x_ignition_cycles);
+ EXPECT_EQ(0, config.exchange_after_x_kilometers);
+ EXPECT_EQ(0, config.exchange_after_x_days);
+ EXPECT_EQ(0, config.timeout_after_x_seconds);
+ EXPECT_EQ("", static_cast<std::string>(*config.vehicle_make));
+ EXPECT_EQ("", static_cast<std::string>(*config.vehicle_model));
+ EXPECT_EQ("", static_cast<std::string>(*config.vehicle_year));
+ EXPECT_EQ("", static_cast<std::string>(*config.preloaded_date));
+ EXPECT_EQ("", static_cast<std::string>(*config.certificate));
+ EXPECT_EQ(0u, config.seconds_between_retries.size());
+ EXPECT_EQ(0u, config.endpoints.size());
+ EXPECT_EQ(0u, config.notifications_per_minute_by_priority.size());
+
+ policy_table::ConsumerFriendlyMessages messages;
+ GatherConsumerFriendlyMessages(&messages);
+ EXPECT_EQ("0", static_cast<std::string>(messages.version));
+ policy_table::DeviceData devices;
+ GatherDeviceData(&devices);
+ EXPECT_EQ(0u, devices.size());
+ policy_table::UsageAndErrorCounts counts;
+ GatherUsageAndErrorCounts(&counts);
+ EXPECT_EQ(0u, counts.app_level->size());
+ //ASSERT_TRUE(IsValid(update));
+ // Act
+ ASSERT_TRUE(reps->Save(update));
+
+ // Check Functional Groupings
+ ASSERT_TRUE(reps->GetFunctionalGroupings(func_groups));
+ // Checks
+ EXPECT_EQ(1u, func_groups.size());
+ policy_table::FunctionalGroupings::iterator func_groups_iter =
+ func_groups.find("default");
+ ASSERT_TRUE(func_groups.end() != func_groups_iter);
+ policy_table::Rpcs& rpcs = func_groups_iter->second;
+ EXPECT_EQ("", static_cast<std::string>(*rpcs.user_consent_prompt));
+ policy_table::Rpc& rpc = rpcs.rpcs;
+ EXPECT_EQ(1u, rpc.size());
+ policy_table::Rpc::const_iterator rpc_iter = rpc.find("Update");
+ EXPECT_TRUE(rpc.end() != rpc_iter);
+ const policy_table::HmiLevels& hmi_levels = rpc_iter->second.hmi_levels;
+ EXPECT_EQ(1u, hmi_levels.size());
+ EXPECT_TRUE(hmi_levels.end() != std::find(hmi_levels.begin(),
+ hmi_levels.end(),
+ policy_table::HmiLevel::HL_FULL));
+
+ const ::policy_table::Parameters& parameters = *(rpc_iter->second.parameters);
+ EXPECT_EQ(1u, parameters.size());
+ EXPECT_TRUE(parameters.end() != std::find(parameters.begin(),
+ parameters.end(),
+ policy_table::Parameter::P_SPEED));
+ // Check Application Policies Section
+ GatherApplicationPoliciesSection(&policies);
+ const uint32_t apps_size = 3u;
+
+ rpc::String<1ul, 255ul> str("default");
+ policy_table::Strings groups;
+ groups.push_back(str);
+ CheckAppPoliciesSection(policies, apps_size,
+ policy_table::Priority::P_EMERGENCY, "1234", 150u,
+ 200u, groups);
+ CheckAppPoliciesSection(policies, apps_size,
+ policy_table::Priority::P_EMERGENCY, "default", 50u,
+ 100u, groups);
+ CheckAppPoliciesSection(policies, apps_size,
+ policy_table::Priority::P_EMERGENCY,
+ "pre_DataConsent", 40u, 90u, groups);
+ CheckAppPoliciesSection(policies, apps_size,
+ policy_table::Priority::P_EMERGENCY, "device", 0u, 0u,
+ groups);
+
+ CheckAppGroups("1234", groups);
+ CheckAppGroups("default", groups);
+ CheckAppGroups("pre_DataConsent", groups);
+
+ GatherModuleConfig(&config);
+ // Check Module Config section
+ ASSERT_FALSE(*config.preloaded_pt);
+ ASSERT_EQ("", static_cast<std::string>(*config.certificate));
+ ASSERT_EQ("", static_cast<std::string>(*config.preloaded_date));
+ ASSERT_EQ("", static_cast<std::string>(*config.vehicle_year));
+ ASSERT_EQ("", static_cast<std::string>(*config.vehicle_model));
+ ASSERT_EQ("", static_cast<std::string>(*config.vehicle_make));
+ ASSERT_EQ(10, config.exchange_after_x_ignition_cycles);
+ ASSERT_EQ(100, config.exchange_after_x_kilometers);
+ ASSERT_EQ(5, config.exchange_after_x_days);
+ ASSERT_EQ(500, config.timeout_after_x_seconds);
+ ASSERT_EQ(3u, config.seconds_between_retries.size());
+ ASSERT_EQ(10, config.seconds_between_retries[0]);
+ ASSERT_EQ(20, config.seconds_between_retries[1]);
+ ASSERT_EQ(30, config.seconds_between_retries[2]);
+ ASSERT_EQ(6u, config.notifications_per_minute_by_priority.size());
+ ASSERT_EQ(1, config.notifications_per_minute_by_priority["emergency"]);
+ ASSERT_EQ(2, config.notifications_per_minute_by_priority["navigation"]);
+ ASSERT_EQ(3, config.notifications_per_minute_by_priority["VOICECOMM"]);
+ ASSERT_EQ(4, config.notifications_per_minute_by_priority["communication"]);
+ ASSERT_EQ(5, config.notifications_per_minute_by_priority["normal"]);
+ ASSERT_EQ(6, config.notifications_per_minute_by_priority["none"]);
+ EXPECT_EQ(1u, config.endpoints.size());
+ policy_table::ServiceEndpoints& service_endpoints = config.endpoints;
+ EXPECT_EQ("0x00", service_endpoints.begin()->first);
+ policy_table::URLList& url_list = service_endpoints.begin()->second;
+ EXPECT_EQ("default", url_list.begin()->first);
+ policy_table::URL& url = url_list.begin()->second;
+ EXPECT_EQ("http://ford.com/cloud/default", static_cast<std::string>(url[0]));
+ GatherConsumerFriendlyMessages(&messages);
+ EXPECT_EQ("1.2", static_cast<std::string>(messages.version));
+}
+
} // namespace policy
} // namespace components
} // namespace test
diff --git a/src/components/policy/test/test-qdb.ini b/src/components/policy/test/test-qdb.ini
deleted file mode 100644
index 5f8c46c0cf..0000000000
--- a/src/components/policy/test/test-qdb.ini
+++ /dev/null
@@ -1,11 +0,0 @@
-# This config file for QDB
-# Format see in manual of QNX
-[policy]
-Filename=policy.db
-Schema File=policy.sql
-
-[test-database]
-Filename=test-database.sqlite
-
-[test-query]
-Filename=test-query.sqlite \ No newline at end of file
diff --git a/src/components/time_tester/test/time_manager_test.cc b/src/components/policy/test/update_status_manager_test.cc
index 60f3bd6814..85550ebc1d 100644
--- a/src/components/time_tester/test/time_manager_test.cc
+++ b/src/components/policy/test/update_status_manager_test.cc
@@ -31,42 +31,58 @@
*/
#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-#include "time_manager.h"
-#include "protocol_handler/time_metric_observer.h"
-#include "protocol_handler.h"
-#include "include/protocol_handler_mock.h"
+#include "mock_policy_listener.h"
+#include "policy/policy_manager_impl.h"
+#include "policy/update_status_manager.h"
+
+using ::policy::MockPolicyListener;
namespace test {
namespace components {
-namespace time_tester_test {
+namespace policy {
+
+using namespace ::policy;
-using namespace time_tester;
+class UpdateStatusManagerTest : public ::testing::Test {
+ protected:
+ UpdateStatusManager* manager_;
+ PolicyTableStatus status_;
+ const uint32_t k_timeout_;
-class StreamerMock : public Streamer {
public:
- StreamerMock(TimeManager* const server)
- : Streamer(server) {
- is_client_connected_ = true;
- }
- MOCK_METHOD1(PushMessage,void(utils::SharedPtr<MetricWrapper> metric));
+ UpdateStatusManagerTest() : k_timeout_(1) {}
+
+ void SetUp() { manager_ = new UpdateStatusManager(); }
+
+ void TearDown() { delete manager_; }
};
-TEST(TimeManagerTest, DISABLED_MessageProcess) {
- //TODO(AK) APPLINK-13351 Disable due to refactor TimeTester
- protocol_handler_test::TransportManagerMock transport_manager_mock;
- protocol_handler::ProtocolHandlerImpl protocol_handler_mock(&transport_manager_mock, 0, 0, 0, 0, 0);
- TimeManager * time_manager = new TimeManager();
- // Streamer will be deleted by Thread
- StreamerMock* streamer_mock = new StreamerMock(time_manager);
- time_manager->set_streamer(streamer_mock);
- time_manager->Init(&protocol_handler_mock);
- utils::SharedPtr<MetricWrapper> test_metric;
- EXPECT_CALL(*streamer_mock, PushMessage(test_metric));
- time_manager->SendMetric(test_metric);
- delete time_manager;
+TEST_F(UpdateStatusManagerTest,
+ StringifiedUpdateStatus_SetStatuses_ExpectCorrectStringifiedStatuses) {
+ // Arrange
+ manager_->OnPolicyInit(false);
+ // Check
+ EXPECT_EQ("UP_TO_DATE", manager_->StringifiedUpdateStatus());
+ manager_->OnPolicyInit(true);
+ // Check
+ EXPECT_EQ("UPDATE_NEEDED", manager_->StringifiedUpdateStatus());
+ manager_->OnUpdateSentOut(k_timeout_);
+ // Check
+ EXPECT_EQ("UPDATING", manager_->StringifiedUpdateStatus());
+}
+
+TEST_F(UpdateStatusManagerTest,
+ OnAppSearchStartedCompleted_ExpectAppSearchCorrectStatus) {
+ // Arrange
+ manager_->OnAppsSearchStarted();
+ // Check
+ EXPECT_TRUE(manager_->IsAppsSearchInProgress());
+ // Arrange
+ manager_->OnAppsSearchCompleted();
+ // Check
+ EXPECT_FALSE(manager_->IsAppsSearchInProgress());
}
-} // namespace time_tester
+} // namespace policy
} // namespace components
} // namespace test
diff --git a/src/components/policy/test/valid_sdl_pt_update.json b/src/components/policy/test/valid_sdl_pt_update.json
index 6556ad5106..56c728f104 100644
--- a/src/components/policy/test/valid_sdl_pt_update.json
+++ b/src/components/policy/test/valid_sdl_pt_update.json
@@ -20,7 +20,7 @@
"nicknames" : [ "SyncProxyTester" ],
"priority" : "EMERGENCY",
"steal_focus" : true,
- "watchdog_timer_ms" : 20000
+ "heart_beat_timeout_ms": 5000
},
"default" : {
"default_hmi" : "NONE",
@@ -28,8 +28,7 @@
"keep_context" : false,
"memory_kb" : 1000,
"priority" : "NONE",
- "steal_focus" : false,
- "watchdog_timer_ms" : 20000
+ "steal_focus" : false
},
"device" : {
"default_hmi" : "NONE",
@@ -46,8 +45,7 @@
"keep_context" : false,
"memory_kb" : 1000,
"priority" : "NONE",
- "steal_focus" : false,
- "watchdog_timer_ms" : 20000
+ "steal_focus" : false
}
},
"consumer_friendly_messages" : {
@@ -1712,7 +1710,6 @@
"NORMAL" : 4,
"VOICECOMM" : 10
},
- "preloaded_pt" : true,
"seconds_between_retries" : [ 1, 5, 25, 125, 625 ],
"timeout_after_x_seconds" : 60,
"vehicle_make" : "Stark Industries",
diff --git a/src/components/protocol/src/service_type.cc b/src/components/protocol/src/service_type.cc
index 09adae23be..2f0f4f2338 100644
--- a/src/components/protocol/src/service_type.cc
+++ b/src/components/protocol/src/service_type.cc
@@ -36,7 +36,7 @@
namespace protocol_handler {
-CREATE_LOGGERPTR_GLOBAL(logger_, "ConnectionHandler")
+CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
namespace {
// Check if provided service value is one of the specified
diff --git a/src/components/protocol_handler/CMakeLists.txt b/src/components/protocol_handler/CMakeLists.txt
index 10a18c48b6..a09a565844 100644
--- a/src/components/protocol_handler/CMakeLists.txt
+++ b/src/components/protocol_handler/CMakeLists.txt
@@ -34,7 +34,6 @@ include_directories(
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/protocol_handler/include/
${COMPONENTS_DIR}/connection_handler/include/
- ${COMPONENTS_DIR}/config_profile/include/
${LOG4CXX_INCLUDE_DIRECTORY}
)
@@ -43,6 +42,7 @@ set(SOURCES
${COMPONENTS_DIR}/protocol_handler/src/protocol_handler_impl.cc
${COMPONENTS_DIR}/protocol_handler/src/protocol_packet.cc
${COMPONENTS_DIR}/protocol_handler/src/protocol_payload.cc
+ ${COMPONENTS_DIR}/protocol_handler/src/multiframe_builder.cc
)
set(LIBRARIES
diff --git a/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h b/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h
index bd64db9063..b02e7de3bf 100644
--- a/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h
+++ b/src/components/protocol_handler/include/protocol_handler/incoming_data_handler.h
@@ -32,7 +32,6 @@
#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_INCOMING_DATA_HANDLER_H_
#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_INCOMING_DATA_HANDLER_H_
-#include <list>
#include <map>
#include <vector>
#include "utils/macro.h"
@@ -53,7 +52,7 @@ class IncomingDataHandler {
* @brief Setting additional validator for checking malformed packets
* \param validator pointer
*/
- void set_validator(const ProtocolPacket::ProtocolHeaderValidator *const validator);
+ void set_validator(const ProtocolPacket::ProtocolHeaderValidator* const validator);
/**
* @brief Concatenate TM messages to ford frames and validate ford header data
* \param TM messages for converting to frames
@@ -65,9 +64,9 @@ class IncomingDataHandler {
* - RESULT_FAIL - packet serialization or validation error occurs
* \return list of complete, correct packets
*/
- std::list<ProtocolFramePtr> ProcessData(const RawMessage &tm_message,
- RESULT_CODE *result,
- size_t *malformed_occurrence);
+ ProtocolFramePtrList ProcessData(const RawMessage& tm_message,
+ RESULT_CODE* result,
+ size_t* malformed_occurrence);
/**
* @brief Add connection for data handling and verification
*/
@@ -83,7 +82,7 @@ class IncomingDataHandler {
/**
* @brief Returns size of frame to be formed from raw bytes.
*/
- static uint32_t GetPacketSize(const ProtocolPacket::ProtocolHeader &header);
+ static uint32_t GetPacketSize(const ProtocolPacket::ProtocolHeader& header);
/**
* @brief Try to create frame from incoming data
* \param incommung_data raw stream
@@ -95,16 +94,17 @@ class IncomingDataHandler {
* - RESULT_OK - one or more frames successfully created
* - RESULT_FAIL - packet serialization or validation error occurs
*/
- RESULT_CODE CreateFrame(std::vector<uint8_t> &incoming_data,
- std::list<ProtocolFramePtr> &out_frames,
- size_t &malformed_occurrence,
+ RESULT_CODE CreateFrame(std::vector<uint8_t>& incoming_data,
+ ProtocolFramePtrList& out_frames,
+ size_t& malformed_occurrence,
const transport_manager::ConnectionUID connection_id);
typedef std::map<transport_manager::ConnectionUID, std::vector<uint8_t> >
ConnectionsDataMap;
ConnectionsDataMap connections_data_;
ProtocolPacket::ProtocolHeader header_;
- const ProtocolPacket::ProtocolHeaderValidator *validator_;
+ const ProtocolPacket::ProtocolHeaderValidator* validator_;
+ bool last_portion_of_data_was_malformed_;
DISALLOW_COPY_AND_ASSIGN(IncomingDataHandler);
};
} // namespace protocol_handler
diff --git a/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h b/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
new file mode 100644
index 0000000000..6ccf891b38
--- /dev/null
+++ b/src/components/protocol_handler/include/protocol_handler/multiframe_builder.h
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_MULTIFRAME_BUILDER_H_
+#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_MULTIFRAME_BUILDER_H_
+
+#include <map>
+#include <ostream> // std::basic_ostream
+#include <iterator> // std::ostream_iterator
+#include <algorithm> // std::copy
+
+#include "utils/date_time.h"
+#include "protocol_handler/protocol_packet.h"
+
+/**
+ *\namespace protocol_handlerHandler
+ *\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
+ */
+namespace protocol_handler {
+/**
+ * \brief Session identifier - contains connection identifier and
+ * session_id from protocol (can be used as hash)
+ */
+// TODO(EZamakhov): move SessionID to protocol_handler/protocol_packet.h
+typedef uint8_t SessionID;
+/**
+ * \brief Message identifier - unique to the session messages
+ */
+// TODO(EZamakhov): move MessageID to protocol_handler/session_observer.h
+typedef uint32_t MessageID;
+
+struct ProtocolFrameData {
+ ProtocolFramePtr frame;
+ TimevalStruct append_time;
+};
+/**
+ *\brief Map of frames with last frame data for messages received in multiple frames.
+ */
+typedef std::map<MessageID, ProtocolFrameData> MessageIDToFrameMap;
+/**
+ *\brief Map of frames with last frame data for messages received in multiple frames.
+ */
+typedef std::map<SessionID, MessageIDToFrameMap> SessionToFrameMap;
+/**
+ *\brief Map of frames with last frame data for messages received in multiple frames.
+ */
+typedef std::map<ConnectionID, SessionToFrameMap> MultiFrameMap;
+
+/**
+ * \class MultiFrameBuilder
+ * \brief Class for assembling consecutive frames according to
+ * messageID to complete multiframes.
+ */
+class MultiFrameBuilder {
+ public:
+ /**
+ * @brief Constructor
+ */
+ MultiFrameBuilder();
+
+ /**
+ *\brief Set timeout of waiting CONSECUTIVE frames
+ */
+ void set_waiting_timeout(const uint32_t consecutive_frame_wait_msecs);
+
+ /**
+ * @brief Add connection for pending data
+ * @return true on success
+ */
+ bool AddConnection(const ConnectionID connection_id);
+
+ /**
+ * @brief Clear all data related to connection_id
+ * @return true on success
+ */
+ bool RemoveConnection(const ConnectionID connection_id);
+
+ /**
+ *\brief Pop assembled and expired frames
+ */
+ ProtocolFramePtrList PopMultiframes();
+
+ /**
+ *\brief Handle Single or Consecutive frame
+ * @return RESULT_OK on success, or RESULT_FAIL in case of any error
+ */
+ RESULT_CODE AddFrame(const ProtocolFramePtr packet);
+
+ private:
+ RESULT_CODE HandleFirstFrame(const ProtocolFramePtr packet);
+ RESULT_CODE HandleConsecutiveFrame(const ProtocolFramePtr packet);
+
+ // Map of frames with last frame data for messages received in multiple frames.
+ MultiFrameMap multiframes_map_;
+ int64_t consecutive_frame_wait_msecs_;
+};
+
+template<typename _CharT>
+std::basic_ostream<_CharT>& operator<<(std::basic_ostream<_CharT>& stream,
+ const protocol_handler::MultiFrameMap& map) {
+ if (map.empty()) {
+ stream << "{empty}";
+ return stream;
+ }
+ for (MultiFrameMap::const_iterator connection_it = map.begin();
+ connection_it != map.end(); ++connection_it) {
+ const SessionToFrameMap& session_map = connection_it->second;
+
+ for (SessionToFrameMap::const_iterator session_it = session_map.begin();
+ session_it != session_map.end(); ++session_it) {
+ const MessageIDToFrameMap& messageId_map = session_it->second;
+
+ for (MessageIDToFrameMap::const_iterator messageId_it = messageId_map.begin();
+ messageId_it != messageId_map.end(); ++messageId_it) {
+ const ProtocolFrameData& frame_data = messageId_it->second;
+
+ stream << "ConnectionID: " << connection_it->first
+ << ", SessionID: " << static_cast<uint32_t>(session_it->first)
+ << ", MessageID: " << static_cast<uint32_t>(messageId_it->first)
+ << " msec, frame: " << frame_data.frame << std::endl;
+ }
+ }
+ }
+ return stream;
+}
+
+} // namespace protocol_handler
+#endif // SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_MULTIFRAME_BUILDER_H_
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 bff972ede4..bda65803e8 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
@@ -36,7 +36,9 @@
#include <map>
#include <memory>
#include <set>
-#include <list>
+#include <cstdint>
+#include <utility> // std::make_pair
+#include <vector>
#include "utils/prioritized_queue.h"
#include "utils/message_queue.h"
#include "utils/threads/message_loop_thread.h"
@@ -45,20 +47,29 @@
#include "protocol_handler/protocol_handler.h"
#include "protocol_handler/protocol_packet.h"
+#include "protocol_handler/protocol_handler_settings.h"
#include "protocol_handler/session_observer.h"
#include "protocol_handler/protocol_observer.h"
#include "protocol_handler/incoming_data_handler.h"
+#include "protocol_handler/multiframe_builder.h"
#include "transport_manager/common.h"
#include "transport_manager/transport_manager.h"
#include "transport_manager/transport_manager_listener_empty.h"
-#ifdef TIME_TESTER
-#include "protocol_handler/time_metric_observer.h"
-#endif // TIME_TESTER
+#include "connection_handler/connection_handler.h"
+
+#ifdef TELEMETRY_MONITOR
+#include "protocol_handler/telemetry_observer.h"
+#include "telemetry_monitor/telemetry_observable.h"
+#endif // TELEMETRY_MONITOR
#ifdef ENABLE_SECURITY
#include "security_manager/security_manager.h"
#endif // ENABLE_SECURITY
+namespace connection_handler {
+class ConnectionHandlerImpl;
+} // namespace connection_handler
+
/**
*\namespace protocol_handlerHandler
*\brief Namespace for SmartDeviceLink ProtocolHandler related functionality.
@@ -85,6 +96,7 @@ namespace impl {
* when we have them.
*/
struct RawFordMessageFromMobile: public ProtocolFramePtr {
+ RawFordMessageFromMobile() {}
explicit RawFordMessageFromMobile(const ProtocolFramePtr message)
: ProtocolFramePtr(message) {}
// PrioritizedQueue requires this method to decide which priority to assign
@@ -95,6 +107,7 @@ struct RawFordMessageFromMobile: public ProtocolFramePtr {
};
struct RawFordMessageToMobile: public ProtocolFramePtr {
+ RawFordMessageToMobile() : is_final(false) {}
explicit RawFordMessageToMobile(const ProtocolFramePtr message,
bool final_message)
: ProtocolFramePtr(message), is_final(final_message) {}
@@ -126,27 +139,24 @@ class ProtocolHandlerImpl
: public ProtocolHandler,
public TransportManagerListenerEmpty,
public impl::FromMobileQueue::Handler,
- public impl::ToMobileQueue::Handler {
+ public impl::ToMobileQueue::Handler
+#ifdef TELEMETRY_MONITOR
+ ,
+ public telemetry_monitor::TelemetryObservable<PHTelemetryObserver>
+#endif // TELEMETRY_MONITOR
+ {
public:
/**
- * \brief Constructor
- * \param transportManager Pointer to Transport layer handler for
- * \param message_frequency_time used as time for flood filtering
- * \param message_frequency_count used as maximum value of messages
- * per message_frequency_time period
- * \param malformed_message_filtering used for malformed filtering enabling
- * \param malformed_message_frequency_time used as time for malformed flood filtering
- * \param malformed_message_frequency_count used as maximum value of malformed
- * messages per message_frequency_time period
- * message exchange.
- */
- explicit ProtocolHandlerImpl(
- transport_manager::TransportManager *transport_manager_param,
- size_t message_frequency_time, size_t message_frequency_count,
- bool malformed_message_filtering,
- size_t malformed_message_frequency_time,
- size_t malformed_message_frequency_count);
-
+ * @brief Constructor
+ * @param settings reference to ProtocolHandlerSettingsImpl object
+ * @param session_observer reference to SessionObserver to access session
+ * information and controll session life cycle
+ * @param transportManager Pointer to Transport layer handler for
+ */
+ ProtocolHandlerImpl(const ProtocolHandlerSettings& settings,
+ protocol_handler::SessionObserver& session_observer,
+ connection_handler::ConnectionHandler& connection_handler,
+ transport_manager::TransportManager& transport_manager);
/**
* \brief Destructor
*/
@@ -159,19 +169,8 @@ class ProtocolHandlerImpl
*/
void AddProtocolObserver(ProtocolObserver *observer);
- /**
- * \brief Removes pointer to higher layer handler for message exchange
- * \param observer Pointer to object of the class implementing
- * IProtocolObserver.
- */
- void RemoveProtocolObserver(ProtocolObserver *observer);
-
- /**
- * \brief Sets pointer for Connection Handler layer for managing sessions
- * \param observer Pointer to object of the class implementing
- * ISessionObserver
- */
- void set_session_observer(SessionObserver *observer);
+ void RemoveProtocolObserver(
+ ProtocolObserver* observer) OVERRIDE;
#ifdef ENABLE_SECURITY
/**
@@ -201,14 +200,14 @@ class ProtocolHandlerImpl
*/
void SendFramesNumber(uint32_t connection_key, int32_t number_of_frames);
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
/**
* @brief Setup observer for time metric.
*
* @param observer - pointer to observer
*/
- void SetTimeMetricObserver(PHMetricObserver *observer);
-#endif // TIME_TESTER
+ void SetTelemetryObserver(PHTelemetryObserver *observer);
+#endif // TELEMETRY_MONITOR
/*
* Prepare and send heartbeat message to mobile
@@ -248,6 +247,10 @@ class ProtocolHandlerImpl
uint8_t service_type,
bool protection);
+ const ProtocolHandlerSettings& get_settings() const OVERRIDE {
+ return settings_;
+ }
+
/**
* \brief Sends fail of starting session to mobile application
* \param connection_id Identifier of connection within which session
@@ -305,22 +308,22 @@ class ProtocolHandlerImpl
*
* @param message Received message
**/
- virtual void OnTMMessageReceived(
- const RawMessagePtr message);
+ void OnTMMessageReceived(
+ const RawMessagePtr message) OVERRIDE;
/**
* @brief Notifies about error on receiving message from TM.
*
* @param error Occurred error
**/
- virtual void OnTMMessageReceiveFailed(
- const transport_manager::DataReceiveError &error);
+ void OnTMMessageReceiveFailed(
+ const transport_manager::DataReceiveError &error) OVERRIDE;
/**
* @brief Notifies about successfully sending message.
*
**/
- virtual void OnTMMessageSend(const RawMessagePtr message);
+ void OnTMMessageSend(const RawMessagePtr message) OVERRIDE;
/**
* @brief Notifies about error occurred during
@@ -329,16 +332,15 @@ class ProtocolHandlerImpl
* @param error Describes occurred error.
* @param message Message during sending which error occurred.
**/
- virtual void OnTMMessageSendFailed(
+ void OnTMMessageSendFailed(
const transport_manager::DataSendError &error,
- const RawMessagePtr message);
+ const RawMessagePtr message) OVERRIDE;
- virtual void OnConnectionEstablished(
- const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectionUID &connection_id);
+ void OnConnectionEstablished(const transport_manager::DeviceInfo &device_info,
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
- virtual void OnConnectionClosed(
- const transport_manager::ConnectionUID &connection_id);
+ void OnConnectionClosed(
+ const transport_manager::ConnectionUID connection_id) OVERRIDE;
/**
* @brief Notifies subscribers about message
@@ -403,9 +405,7 @@ class ProtocolHandlerImpl
* \param packet Received message with protocol header.
* \return \saRESULT_CODE Status of operation
*/
- RESULT_CODE HandleMessage(
- ConnectionID connection_id,
- const ProtocolFramePtr packet);
+ RESULT_CODE HandleMessage(const ProtocolFramePtr packet);
/**
* \brief Handles message received in single frame.
@@ -414,9 +414,7 @@ class ProtocolHandlerImpl
* \param packet Frame of message with protocol header.
* \return \saRESULT_CODE Status of operation
*/
- RESULT_CODE HandleSingleFrameMessage(
- ConnectionID connection_id,
- const ProtocolFramePtr packet);
+ RESULT_CODE HandleSingleFrameMessage(const ProtocolFramePtr packet);
/**
* \brief Handles message received in multiple frames. Collects all frames
* of message.
@@ -425,9 +423,7 @@ class ProtocolHandlerImpl
* \param packet Current frame of message with protocol header.
* \return \saRESULT_CODE Status of operation
*/
- RESULT_CODE HandleMultiFrameMessage(
- ConnectionID connection_id,
- const ProtocolFramePtr packet);
+ RESULT_CODE HandleMultiFrameMessage(const ProtocolFramePtr packet);
/**
* \brief Handles message received in single frame.
@@ -436,21 +432,17 @@ class ProtocolHandlerImpl
* \param packet Received message with protocol header.
* \return \saRESULT_CODE Status of operation
*/
- RESULT_CODE HandleControlMessage(
- ConnectionID connection_id,
- const ProtocolFramePtr packet);
+ RESULT_CODE HandleControlMessage(const ProtocolFramePtr packet);
+
+ RESULT_CODE HandleControlMessageEndSession(const ProtocolPacket& packet);
+
+ RESULT_CODE HandleControlMessageEndServiceACK(const ProtocolPacket& packet);
- RESULT_CODE HandleControlMessageEndSession(
- ConnectionID connection_id,
- const ProtocolPacket &packet);
+ RESULT_CODE HandleControlMessageStartSession(const ProtocolPacket& packet);
- RESULT_CODE HandleControlMessageStartSession(
- ConnectionID connection_id,
- const ProtocolPacket &packet);
+ RESULT_CODE HandleControlMessageHeartBeat(const ProtocolPacket& packet);
- RESULT_CODE HandleControlMessageHeartBeat(
- ConnectionID connection_id,
- const ProtocolPacket &packet);
+ void PopValideAndExpirateMultiframes();
// threads::MessageLoopThread<*>::Handler implementations
// CALLED ON raw_ford_messages_from_mobile_ thread!
@@ -471,8 +463,13 @@ class ProtocolHandlerImpl
bool TrackMalformedMessage(const uint32_t &connection_key,
const size_t count);
+ /**
+ * @brief Function returns supported SDL Protocol Version,
+ */
+ uint8_t SupportedSDLProtocolVersion() const;
+
+ const ProtocolHandlerSettings& settings_;
- private:
/**
*\brief Pointer on instance of class implementing IProtocolObserver
*\brief (JSON Handler)
@@ -481,19 +478,27 @@ class ProtocolHandlerImpl
/**
*\brief Pointer on instance of class implementing ISessionObserver
- *\brief (Connection Handler)
+ *\brief (Connection Handler).
+ * According to usage it can't be null
+ */
+ SessionObserver& session_observer_;
+
+ /**
+ *\brief Pointer on instance of Transport layer handler for message exchange.
+ *\brief Instance of class implementing Connection Handler t keep connection
+ *alive
*/
- SessionObserver *session_observer_;
+ connection_handler::ConnectionHandler& connection_handler_;
/**
*\brief Pointer on instance of Transport layer handler for message exchange.
*/
- transport_manager::TransportManager *transport_manager_;
+ transport_manager::TransportManager& transport_manager_;
/**
- *\brief Map of frames for messages received in multiple frames.
+ *\brief Assembling support class.
*/
- std::map<int32_t, ProtocolFramePtr> incomplete_multi_frame_messages_;
+ MultiFrameBuilder multiframe_builder_;
/**
* \brief Map of messages (frames) received over mobile nave session
@@ -526,19 +531,14 @@ class ProtocolHandlerImpl
/**
*\brief Connections that must be closed after their last messages were sent
*/
- std::list<uint32_t> ready_to_close_connections_;
+ std::vector<uint32_t> ready_to_close_connections_;
ProtocolPacket::ProtocolHeaderValidator protocol_header_validator_;
IncomingDataHandler incoming_data_handler_;
// Use uint32_t as application identifier
utils::MessageMeter<uint32_t> message_meter_;
- size_t message_max_frequency_;
- size_t message_frequency_time_;
- bool malformed_message_filtering_;
// Use uint32_t as connection identifier
utils::MessageMeter<uint32_t> malformed_message_meter_;
- size_t malformed_message_max_frequency_;
- size_t malformed_message_frequency_time_;
#ifdef ENABLE_SECURITY
security_manager::SecurityManager *security_manager_;
@@ -551,9 +551,9 @@ class ProtocolHandlerImpl
sync_primitives::Lock protocol_observers_lock_;
-#ifdef TIME_TESTER
- PHMetricObserver *metric_observer_;
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+ PHTelemetryObserver *metric_observer_;
+#endif // TELEMETRY_MONITOR
};
} // namespace protocol_handler
#endif // SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_HANDLER_IMPL_H_
diff --git a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
index 0b4b253a84..1b68e6c870 100644
--- a/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
+++ b/src/components/protocol_handler/include/protocol_handler/protocol_packet.h
@@ -33,6 +33,7 @@
#ifndef SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_PACKET_H_
#define SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_PACKET_H_
+#include <list>
#include "utils/macro.h"
#include "protocol/common.h"
#include "transport_manager/common.h"
@@ -199,10 +200,12 @@ class ProtocolPacket {
uint8_t service_type() const;
/**
- *\brief Getter of frame data (start/end session, number of frame etc)
+ *\brief Getter and setter of frame data (start/end session, number of frame etc)
*/
uint8_t frame_data() const;
+ void set_frame_data(const uint8_t frame_data);
+
/**
*\brief Getter of session number
*/
@@ -243,13 +246,18 @@ class ProtocolPacket {
/**
* \brief Getter for Connection Identifier
*/
- uint8_t connection_id() const;
+ ConnectionID connection_id() const;
/**
* \brief Getter for data payload size
*/
uint32_t payload_size() const;
+ /**
+ * \brief Getter for full header information
+ */
+ const ProtocolHeader& packet_header() const;
+
private:
/**
*\brief Protocol header
@@ -279,4 +287,36 @@ class ProtocolPacket {
* @brief Type definition for variable that hold shared pointer to protocolol packet
*/
typedef utils::SharedPtr<protocol_handler::ProtocolPacket> ProtocolFramePtr;
+typedef std::list<ProtocolFramePtr> ProtocolFramePtrList;
+
+template<typename _CharT>
+std::basic_ostream<_CharT>& operator<<(std::basic_ostream<_CharT>& stream,
+ const protocol_handler::ProtocolPacket::ProtocolHeader& header) {
+ stream << "Version: " << static_cast<uint32_t>(header.version) <<
+ ", Protection: " << (header.protection_flag ? "ON" : "OFF") <<
+ ", FrameType: " << static_cast<uint32_t>(header.frameType) <<
+ ", ServiceType: " << static_cast<uint32_t>(header.serviceType) <<
+ ", FrameData: " << static_cast<uint32_t>(header.frameData) <<
+ ", SessionId: " << static_cast<uint32_t>(header.sessionId) <<
+ ", DataSize: " << static_cast<uint32_t>(header.dataSize) <<
+ ", MessageId: " << static_cast<uint32_t>(header.messageId);
+ return stream;
+}
+template<typename _CharT>
+std::basic_ostream<_CharT>& operator<<(std::basic_ostream<_CharT>& stream,
+ const protocol_handler::ProtocolPacket& packet) {
+ stream << packet.packet_header() <<
+ ", ConnectionID: " << static_cast<uint32_t>(packet.connection_id()) <<
+ ", TotalDataBytes: " << (packet.total_data_bytes()) <<
+ ", Data: " << static_cast<void*>(packet.data());
+ return stream;
+}
+template<typename _CharT>
+std::basic_ostream<_CharT>& operator<<(std::basic_ostream<_CharT>& stream,
+ const ProtocolFramePtr packet_ptr) {
+ if(packet_ptr) {
+ return stream << *packet_ptr;
+ }
+ return stream << "empty smart pointer";
+}
#endif // SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_PROTOCOL_PACKET_H_
diff --git a/src/components/protocol_handler/include/protocol_handler/time_metric_observer.h b/src/components/protocol_handler/include/protocol_handler/telemetry_observer.h
index 1d3d83ea48..f0923623e0 100644
--- a/src/components/protocol_handler/include/protocol_handler/time_metric_observer.h
+++ b/src/components/protocol_handler/include/protocol_handler/telemetry_observer.h
@@ -39,7 +39,7 @@
namespace protocol_handler {
-class PHMetricObserver {
+class PHTelemetryObserver {
public:
struct MessageMetric {
RawMessagePtr raw_msg;
@@ -50,7 +50,7 @@ class PHMetricObserver {
};
virtual void StartMessageProcess(uint32_t message_id, const TimevalStruct &start_time) = 0;
virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m) = 0;
- virtual ~PHMetricObserver(){}
+ virtual ~PHTelemetryObserver(){}
};
} // protocol_handler
#endif // SRC_COMPONENTS_PROTOCOL_HANDLER_INCLUDE_PROTOCOL_HANDLER_TIME_METRIC_OBSERVER_H_
diff --git a/src/components/protocol_handler/src/incoming_data_handler.cc b/src/components/protocol_handler/src/incoming_data_handler.cc
index 45dc4babff..9a73ba5900 100644
--- a/src/components/protocol_handler/src/incoming_data_handler.cc
+++ b/src/components/protocol_handler/src/incoming_data_handler.cc
@@ -38,51 +38,54 @@ namespace protocol_handler {
CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
IncomingDataHandler::IncomingDataHandler()
- : header_(), validator_(NULL) {}
+ : header_(),
+ validator_(NULL),
+ last_portion_of_data_was_malformed_(false) {
+}
void IncomingDataHandler::set_validator(
- const ProtocolPacket::ProtocolHeaderValidator *const validator) {
+ const ProtocolPacket::ProtocolHeaderValidator* const validator) {
validator_ = validator;
}
static const size_t MIN_HEADER_SIZE = std::min(PROTOCOL_HEADER_V1_SIZE,
PROTOCOL_HEADER_V2_SIZE);
-std::list<ProtocolFramePtr> IncomingDataHandler::ProcessData(
- const RawMessage &tm_message,
- RESULT_CODE *result,
- size_t *malformed_occurrence) {
+ProtocolFramePtrList IncomingDataHandler::ProcessData(
+ const RawMessage& tm_message,
+ RESULT_CODE* result,
+ size_t* malformed_occurrence) {
LOG4CXX_AUTO_TRACE(logger_);
DCHECK(result);
DCHECK(malformed_occurrence);
const transport_manager::ConnectionUID connection_id =
tm_message.connection_key();
- const uint8_t *data = tm_message.data();
+ const uint8_t* data = tm_message.data();
const size_t tm_message_size = tm_message.data_size();
if (tm_message_size == 0 || data == NULL) {
LOG4CXX_WARN(logger_, "Wrong raw message " << tm_message_size << " bytes");
*result = RESULT_FAIL;
- return std::list<ProtocolFramePtr>();
+ return ProtocolFramePtrList();
}
- LOG4CXX_DEBUG(logger_, "Processing incoming data of size "
+ LOG4CXX_INFO(logger_, "Processing incoming data of size "
<< tm_message_size << " for connection " << connection_id);
ConnectionsDataMap::iterator it = connections_data_.find(connection_id);
if (connections_data_.end() == it) {
LOG4CXX_WARN(logger_, "ProcessData requested for unknown connection");
*result = RESULT_FAIL;
- return std::list<ProtocolFramePtr>();
+ return ProtocolFramePtrList();
}
- std::vector<uint8_t> &connection_data = it->second;
+ std::vector<uint8_t>& connection_data = it->second;
connection_data.insert(connection_data.end(), data, data + tm_message_size);
LOG4CXX_DEBUG(logger_, "Total data size for connection "
<< connection_id << " is " << connection_data.size());
- std::list<ProtocolFramePtr> out_frames;
+ ProtocolFramePtrList out_frames;
*malformed_occurrence = 0;
*result = CreateFrame(connection_data, out_frames, *malformed_occurrence, connection_id);
LOG4CXX_DEBUG(logger_, "New data size for connection " << connection_id
<< " is " << connection_data.size());
if (!out_frames.empty()) {
- LOG4CXX_DEBUG(logger_, "Created and passed " << out_frames.size() <<
+ LOG4CXX_INFO(logger_, "Created and passed " << out_frames.size() <<
" packets");
} else {
if (RESULT_DEFERRED == *result) {
@@ -92,7 +95,7 @@ std::list<ProtocolFramePtr> IncomingDataHandler::ProcessData(
LOG4CXX_WARN(logger_, "No packets have been created.");
}
}
- if (*malformed_occurrence > 0u) {
+ if (*malformed_occurrence > 0u || last_portion_of_data_was_malformed_) {
*result = RESULT_MALFORMED_OCCURS;
} else {
*result = RESULT_OK;
@@ -114,7 +117,7 @@ void IncomingDataHandler::RemoveConnection(
}
uint32_t IncomingDataHandler::GetPacketSize(
- const ProtocolPacket::ProtocolHeader &header) {
+ const ProtocolPacket::ProtocolHeader& header) {
switch (header.version) {
case PROTOCOL_VERSION_1:
return header.dataSize + PROTOCOL_HEADER_V1_SIZE;
@@ -123,21 +126,22 @@ uint32_t IncomingDataHandler::GetPacketSize(
case PROTOCOL_VERSION_4:
return header.dataSize + PROTOCOL_HEADER_V2_SIZE;
default:
- LOG4CXX_WARN(logger_, "Unknown version");
+ LOG4CXX_WARN(logger_, "Unknown version: " <<
+ static_cast<int>(header.version));
break;
}
return 0u;
}
RESULT_CODE IncomingDataHandler::CreateFrame(
- std::vector<uint8_t> &incoming_data,
- std::list<ProtocolFramePtr> &out_frames,
- size_t &malformed_occurrence,
+ std::vector<uint8_t>& incoming_data,
+ ProtocolFramePtrList& out_frames,
+ size_t& malformed_occurrence,
const transport_manager::ConnectionUID connection_id) {
LOG4CXX_AUTO_TRACE(logger_);
- bool correct_frame_occurs = true;
std::vector<uint8_t>::iterator data_it = incoming_data.begin();
size_t data_size = incoming_data.size();
+
while (data_size >= MIN_HEADER_SIZE) {
header_.deserialize(&*data_it, data_size);
const RESULT_CODE validate_result =
@@ -145,14 +149,15 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
if (validate_result != RESULT_OK) {
LOG4CXX_WARN(logger_, "Packet validation failed");
- if(correct_frame_occurs) {
+ if (!last_portion_of_data_was_malformed_) {
++malformed_occurrence;
+ LOG4CXX_DEBUG(logger_, "Malformed message found " << malformed_occurrence);
}
- correct_frame_occurs = false;
+ last_portion_of_data_was_malformed_ = true;
++data_it;
--data_size;
LOG4CXX_DEBUG(logger_, "Moved to the next byte " << std::hex
- << static_cast<const void *>(&*data_it));
+ << static_cast<const void*>(&*data_it));
continue;
}
LOG4CXX_DEBUG(logger_, "Payload size " << header_.dataSize);
@@ -162,7 +167,7 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
++data_it;
--data_size;
LOG4CXX_DEBUG(logger_, "Moved to the next byte " << std::hex
- << static_cast<const void *>(&*data_it));
+ << static_cast<const void*>(&*data_it));
continue;
}
if (data_size < packet_size) {
@@ -173,13 +178,17 @@ RESULT_CODE IncomingDataHandler::CreateFrame(
ProtocolFramePtr frame(new protocol_handler::ProtocolPacket(connection_id));
const RESULT_CODE deserialize_result =
frame->deserializePacket(&*data_it, packet_size);
+ LOG4CXX_DEBUG(
+ logger_, "Deserialized frame " << frame);
if (deserialize_result != RESULT_OK) {
LOG4CXX_WARN(logger_, "Packet deserialization failed");
incoming_data.erase(incoming_data.begin(), data_it);
return RESULT_FAIL;
}
+
out_frames.push_back(frame);
- correct_frame_occurs = true;
+ last_portion_of_data_was_malformed_ = false;
+ LOG4CXX_DEBUG(logger_, "Frame added. " << "Connection ID " << connection_id);
data_it += packet_size;
data_size -= packet_size;
diff --git a/src/components/protocol_handler/src/multiframe_builder.cc b/src/components/protocol_handler/src/multiframe_builder.cc
new file mode 100644
index 0000000000..c9cfc4bd0d
--- /dev/null
+++ b/src/components/protocol_handler/src/multiframe_builder.cc
@@ -0,0 +1,274 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "protocol_handler/multiframe_builder.h"
+
+#include <limits>
+
+#include "utils/logger.h"
+#include "utils/make_shared.h"
+#include "utils/lock.h"
+#include "utils/date_time.h"
+
+namespace protocol_handler {
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+
+MultiFrameBuilder::MultiFrameBuilder()
+ : consecutive_frame_wait_msecs_(0u) {
+}
+
+void MultiFrameBuilder::set_waiting_timeout(const uint32_t consecutive_frame_wait_msecs) {
+ consecutive_frame_wait_msecs_ = static_cast<int64_t>(consecutive_frame_wait_msecs);
+ if (consecutive_frame_wait_msecs == 0) {
+ LOG4CXX_WARN(logger_, "Waiting timout disabled");
+ } else {
+ LOG4CXX_DEBUG(logger_, "Waiting time in msec: " << consecutive_frame_wait_msecs_);
+ }
+}
+
+bool MultiFrameBuilder::AddConnection(const ConnectionID connection_id) {
+ LOG4CXX_DEBUG(logger_, "Adding connection_id: " << connection_id);
+ LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ const MultiFrameMap::const_iterator it = multiframes_map_.find(connection_id);
+ if (it != multiframes_map_.end()) {
+ LOG4CXX_ERROR(logger_, "Exists connection_id: " << connection_id);
+ return false;
+ }
+ multiframes_map_[connection_id] = SessionToFrameMap();
+ return true;
+}
+
+bool MultiFrameBuilder::RemoveConnection(const ConnectionID connection_id) {
+ LOG4CXX_DEBUG(logger_, "Removing connection_id: " << connection_id);
+ LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ const MultiFrameMap::iterator it = multiframes_map_.find(connection_id);
+ if (it == multiframes_map_.end()) {
+ LOG4CXX_ERROR(logger_, "Non-existent connection_id: " << connection_id);
+ return false;
+ }
+ const SessionToFrameMap& session_to_frame_map = it->second;
+ if (!session_to_frame_map.empty()) {
+ // FIXME(EZamakhov): Ask ReqManager - do we need to send GenericError
+ LOG4CXX_WARN(logger_, "For connection_id: " << connection_id
+ << " waiting: " << multiframes_map_);
+ }
+ multiframes_map_.erase(it);
+ return true;
+}
+
+ProtocolFramePtrList MultiFrameBuilder::PopMultiframes() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ ProtocolFramePtrList outpute_frame_list;
+ for (MultiFrameMap::iterator connection_it = multiframes_map_.begin();
+ connection_it != multiframes_map_.end(); ++connection_it) {
+ LOG4CXX_TRACE(logger_, "Step over connection: " << connection_it->first);
+ SessionToFrameMap& session_map = connection_it->second;
+
+ for (SessionToFrameMap::iterator session_it = session_map.begin();
+ session_it != session_map.end(); ++session_it) {
+ LOG4CXX_TRACE(logger_, "Step over session: "
+ << static_cast<int>(session_it->first));
+ MessageIDToFrameMap& messageId_map = session_it->second;
+
+ MessageIDToFrameMap::iterator messageId_it = messageId_map.begin();
+ while (messageId_it != messageId_map.end()) {
+ LOG4CXX_TRACE(logger_, "Step over messageId: " << messageId_it->first);
+ ProtocolFrameData& frame_data = messageId_it->second;
+ ProtocolFramePtr frame = frame_data.frame;
+
+ if (frame &&
+ frame->frame_data() == FRAME_DATA_LAST_CONSECUTIVE &&
+ frame->payload_size() > 0u ) {
+ LOG4CXX_DEBUG(logger_, "Ready frame: " << frame);
+ outpute_frame_list.push_back(frame);
+ messageId_map.erase(messageId_it++);
+ continue;
+ }
+ if (consecutive_frame_wait_msecs_ != 0) {
+ LOG4CXX_TRACE(logger_, "Expiration verification");
+ const int64_t time_left =
+ date_time::DateTime::calculateTimeSpan(frame_data.append_time);
+ LOG4CXX_DEBUG(logger_, "mSecs left: " << time_left);
+ if (time_left >= consecutive_frame_wait_msecs_) {
+ LOG4CXX_WARN(logger_, "Expired frame: " << frame);
+ outpute_frame_list.push_back(frame);
+ messageId_map.erase(messageId_it++);
+ continue;
+ }
+ }
+ ++messageId_it;
+ } // iteration over messageId_map
+ } // iteration over session_map
+ } // iteration over multiframes_map_
+ LOG4CXX_DEBUG(logger_, "Result frames count: " << outpute_frame_list.size());
+ return outpute_frame_list;
+}
+
+RESULT_CODE MultiFrameBuilder::AddFrame(const ProtocolFramePtr packet) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Handling frame: " << packet);
+ LOG4CXX_DEBUG(logger_, "Current state is: " << multiframes_map_);
+ if (!packet) {
+ LOG4CXX_ERROR(logger_, "Skip empty frame");
+ return RESULT_FAIL;
+ }
+ switch (packet->frame_type()) {
+ case FRAME_TYPE_FIRST:
+ LOG4CXX_TRACE(logger_, "FRAME_TYPE_FIRST");
+ return HandleFirstFrame(packet);
+ case FRAME_TYPE_CONSECUTIVE:
+ LOG4CXX_TRACE(logger_, "FRAME_TYPE_CONSECUTIVE");
+ return HandleConsecutiveFrame(packet);
+ default:
+ LOG4CXX_ERROR(logger_, "Frame is not FIRST or CONSECUTIVE :"
+ << packet);
+ break;
+ }
+ return RESULT_FAIL;
+}
+
+RESULT_CODE MultiFrameBuilder::HandleFirstFrame(const ProtocolFramePtr packet) {
+ DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_FIRST,
+ RESULT_FAIL);
+ LOG4CXX_DEBUG(logger_, "Waiting : " << multiframes_map_);
+ LOG4CXX_DEBUG(logger_, "Handling FIRST frame: " << packet);
+ if (packet->payload_size() != 0u) {
+ LOG4CXX_ERROR(logger_,
+ "First frame shall have no data:" << packet);
+ return RESULT_FAIL;
+ }
+
+ const ConnectionID connection_id = packet->connection_id();
+ MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id);
+ if (connection_it == multiframes_map_.end()) {
+ LOG4CXX_ERROR(logger_, "Unknown connection_id: " << connection_id);
+ return RESULT_FAIL;
+ }
+ SessionToFrameMap& session_map = connection_it->second;
+
+ const SessionID session_id = packet->session_id();
+ // No need to verify session existance
+ MessageIDToFrameMap& messageId_map = session_map[session_id];
+
+ const MessageID message_id = packet->message_id();
+ MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id);
+ if (messageId_it != messageId_map.end()) {
+ LOG4CXX_ERROR(logger_, "Already waiting message for connection_id: " << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
+ return RESULT_FAIL;
+ }
+
+ LOG4CXX_DEBUG(logger_, "Start waiting frames for connection_id: " << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
+ messageId_map[message_id] = {packet, date_time::DateTime::getCurrentTime()};
+ return RESULT_OK;
+}
+
+RESULT_CODE MultiFrameBuilder::HandleConsecutiveFrame(const ProtocolFramePtr packet) {
+ DCHECK_OR_RETURN(packet->frame_type() == FRAME_TYPE_CONSECUTIVE,
+ RESULT_FAIL);
+ LOG4CXX_DEBUG(logger_, "Handling CONSECUTIVE frame: " << packet);
+
+
+ const ConnectionID connection_id = packet->connection_id();
+ MultiFrameMap::iterator connection_it = multiframes_map_.find(connection_id);
+ if (connection_it == multiframes_map_.end()) {
+ LOG4CXX_ERROR(logger_, "Unknown connection_id: " << connection_id);
+ return RESULT_FAIL;
+ }
+ SessionToFrameMap& session_map = connection_it->second;
+
+ const SessionID session_id = packet->session_id();
+ // No need to verify session existance
+ MessageIDToFrameMap& messageId_map = session_map[session_id];
+
+ const MessageID message_id = packet->message_id();
+ MessageIDToFrameMap::iterator messageId_it = messageId_map.find(message_id);
+ if (messageId_it == messageId_map.end()) {
+ LOG4CXX_ERROR(logger_, "No waiting message for connection_id: " << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
+ return RESULT_FAIL;
+ }
+
+ ProtocolFrameData& frame_data = messageId_it->second;
+ ProtocolFramePtr assembling_frame = frame_data.frame;
+ DCHECK_OR_RETURN(packet->message_id() == assembling_frame->message_id(),
+ RESULT_FAIL);
+
+ const uint8_t new_frame_data = packet->frame_data();
+ const bool is_last_consecutive = (new_frame_data ==
+ FRAME_DATA_LAST_CONSECUTIVE);
+
+ if (is_last_consecutive) {
+ // TODO(EZamakhov): implement count of frames and result size verification
+ LOG4CXX_DEBUG(logger_, "Last CONSECUTIVE frame");
+ } else {
+ uint8_t previous_frame_data = assembling_frame->frame_data();
+ if (previous_frame_data == std::numeric_limits<uint8_t>::max()) {
+ previous_frame_data = 0u;
+ }
+ // The next frame data is bigger at 1
+ if (new_frame_data != (previous_frame_data + 1)) {
+ LOG4CXX_ERROR(logger_,
+ "Unexpected CONSECUTIVE frame for connection_id: " << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id
+ << ", frame: " << packet);
+ return RESULT_FAIL;
+ }
+ }
+
+ assembling_frame->set_frame_data(new_frame_data);
+
+ LOG4CXX_DEBUG(logger_,
+ "Appending " << packet->data_size() << " bytes "
+ << "; frame_data " << static_cast<int>(new_frame_data)
+ << "; for connection_id: " << connection_id
+ << ", session_id: " << static_cast<int>(session_id)
+ << ", message_id: " << message_id);
+
+ if (assembling_frame->appendData(packet->data(),
+ packet->data_size()) != RESULT_OK) {
+ LOG4CXX_ERROR(logger_, "Failed to append frame for multiframe message.");
+ return RESULT_FAIL;
+ }
+ LOG4CXX_INFO(logger_, "Assembled frame with payload size: " << assembling_frame->payload_size());
+ frame_data.append_time = date_time::DateTime::getCurrentTime();
+ return RESULT_OK;
+}
+
+} // namespace protocol_handler
diff --git a/src/components/protocol_handler/src/protocol_handler_impl.cc b/src/components/protocol_handler/src/protocol_handler_impl.cc
index 3289c6b4d8..f701fb02e5 100644
--- a/src/components/protocol_handler/src/protocol_handler_impl.cc
+++ b/src/components/protocol_handler/src/protocol_handler_impl.cc
@@ -35,7 +35,6 @@
#include <algorithm> // std::find
#include "connection_handler/connection_handler_impl.h"
-#include "config_profile/profile.h"
#include "utils/byte_order.h"
#include "protocol/common.h"
@@ -55,28 +54,19 @@ CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
std::string ConvertPacketDataToString(const uint8_t *data,
const size_t data_size);
-/**
- * @brief Function returns supported SDL Protocol Version,
- */
-uint8_t SupportedSDLProtocolVersion();
-
-
const size_t kStackSize = 32768;
-ProtocolHandlerImpl::ProtocolHandlerImpl(
- transport_manager::TransportManager *transport_manager_param,
- size_t message_frequency_time, size_t message_frequency_count,
- bool malformed_message_filtering,
- size_t malformed_message_frequency_time, size_t malformed_message_frequency_count)
- : protocol_observers_(),
- session_observer_(0),
- transport_manager_(transport_manager_param),
- kPeriodForNaviAck(5),
- message_max_frequency_(message_frequency_count),
- message_frequency_time_(message_frequency_time),
- malformed_message_filtering_(malformed_message_filtering),
- malformed_message_max_frequency_(malformed_message_frequency_count),
- malformed_message_frequency_time_(malformed_message_frequency_time),
+ProtocolHandlerImpl::ProtocolHandlerImpl(const ProtocolHandlerSettings& settings,
+ protocol_handler::SessionObserver& session_observer,
+ connection_handler::ConnectionHandler& connection_handler,
+ transport_manager::TransportManager& transport_manager)
+ : settings_(settings)
+ , protocol_observers_()
+ , session_observer_(session_observer)
+ , connection_handler_(connection_handler)
+ , transport_manager_(transport_manager)
+ , kPeriodForNaviAck(5)
+ ,
#ifdef ENABLE_SECURITY
security_manager_(NULL),
#endif // ENABLE_SECURITY
@@ -84,30 +74,38 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
threads::ThreadOptions(kStackSize)),
raw_ford_messages_to_mobile_("PH ToMobile", this,
threads::ThreadOptions(kStackSize))
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
, metric_observer_(NULL)
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
{
LOG4CXX_AUTO_TRACE(logger_);
- protocol_header_validator_.set_max_payload_size(profile::Profile::instance()->maximum_payload_size());
+ protocol_header_validator_.set_max_payload_size(
+ get_settings().maximum_payload_size());
incoming_data_handler_.set_validator(&protocol_header_validator_);
- if (message_frequency_time_ > 0u &&
- message_max_frequency_ > 0u) {
- message_meter_.set_time_range(message_frequency_time_);
- LOG4CXX_DEBUG(logger_, "Frequency meter is enabled ( " << message_max_frequency_
- << " per " << message_frequency_time_ << " mSecond)");
+ const size_t& message_frequency_count = get_settings().message_frequency_count();
+ const size_t& message_frequency_time = get_settings().message_frequency_time();
+
+ if (message_frequency_time > 0u &&
+ message_frequency_count > 0u) {
+ message_meter_.set_time_range(message_frequency_time);
+ LOG4CXX_DEBUG(logger_, "Frequency meter is enabled ( " << message_frequency_count
+ << " per " << message_frequency_time << " mSecond)");
} else {
LOG4CXX_WARN(logger_, "Frequency meter is disabled");
}
- if (malformed_message_filtering_) {
- if(malformed_message_frequency_time_ > 0u &&
- malformed_message_max_frequency_ > 0u) {
- malformed_message_meter_.set_time_range(malformed_message_frequency_time_);
- LOG4CXX_DEBUG(logger_, "Malformed frequency meter is enabled ( " << malformed_message_max_frequency_
- << " per " << malformed_message_frequency_time_ << " mSecond)");
+ const size_t& malformed_frequency_time = get_settings().malformed_frequency_time();
+ const size_t& malformed_frequency_count = get_settings().message_frequency_time();
+
+ if (get_settings().malformed_message_filtering()) {
+ if (malformed_frequency_time > 0u &&
+ malformed_frequency_count > 0u) {
+ malformed_message_meter_.set_time_range(malformed_frequency_time);
+ LOG4CXX_DEBUG(logger_, "Malformed frequency meter is enabled ( "
+ << malformed_frequency_count << " per "
+ << malformed_frequency_time << " mSecond)");
} else {
LOG4CXX_WARN(logger_, "Malformed frequency meter is disabled");
}
@@ -115,6 +113,7 @@ ProtocolHandlerImpl::ProtocolHandlerImpl(
LOG4CXX_WARN(logger_, "Malformed message filtering is disabled."
<< "Connection will be close on first malformed message detection");
}
+ multiframe_builder_.set_waiting_timeout(get_settings().multiframe_waiting_timeout());
}
ProtocolHandlerImpl::~ProtocolHandlerImpl() {
@@ -144,14 +143,6 @@ void ProtocolHandlerImpl::RemoveProtocolObserver(ProtocolObserver* observer) {
protocol_observers_.erase(observer);
}
-void ProtocolHandlerImpl::set_session_observer(SessionObserver *observer) {
- if (!observer) {
- LOG4CXX_WARN(logger_, "Invalid (NULL) pointer to ISessionObserver.");
- // Do not return from here!
- }
- session_observer_ = observer;
-}
-
void set_hash_id(uint32_t hash_id, protocol_handler::ProtocolPacket& packet) {
if (HASH_ID_NOT_SUPPORTED == hash_id ||
HASH_ID_WRONG == hash_id) {
@@ -261,7 +252,7 @@ void ProtocolHandlerImpl::SendEndServicePrivate(int32_t connection_id,
LOG4CXX_AUTO_TRACE(logger_);
uint8_t protocol_version;
- if (session_observer_->ProtocolVersionUsed(connection_id,
+ if (session_observer_.ProtocolVersionUsed(connection_id,
session_id, protocol_version)) {
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
protocol_version, PROTECTION_OFF, FRAME_TYPE_CONTROL,
@@ -295,16 +286,16 @@ RESULT_CODE ProtocolHandlerImpl::SendHeartBeatAck(ConnectionID connection_id,
LOG4CXX_AUTO_TRACE(logger_);
uint8_t protocol_version;
- if (session_observer_->ProtocolVersionUsed(connection_id,
- session_id, protocol_version)) {
- ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
+ if (session_observer_.ProtocolVersionUsed(connection_id,
+ session_id, protocol_version)) {
+ ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
protocol_version, PROTECTION_OFF, FRAME_TYPE_CONTROL,
- SERVICE_TYPE_CONTROL, FRAME_DATA_HEART_BEAT_ACK, session_id,
- 0u, message_id));
+ SERVICE_TYPE_CONTROL, FRAME_DATA_HEART_BEAT_ACK, session_id,
+ 0u, message_id));
- raw_ford_messages_to_mobile_.PostMessage(
- impl::RawFordMessageToMobile(ptr, false));
- return RESULT_OK;
+ raw_ford_messages_to_mobile_.PostMessage(
+ impl::RawFordMessageToMobile(ptr, false));
+ return RESULT_OK;
}
LOG4CXX_WARN(logger_, "SendHeartBeatAck is failed connection or session does not exist");
return RESULT_FAIL;
@@ -314,16 +305,14 @@ void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id,
uint8_t session_id) {
LOG4CXX_AUTO_TRACE(logger_);
uint8_t protocol_version;
- if (session_observer_->ProtocolVersionUsed(connection_id,
- session_id, protocol_version)) {
+ if (session_observer_.ProtocolVersionUsed(connection_id,
+ session_id, protocol_version)) {
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- protocol_version, PROTECTION_OFF, FRAME_TYPE_CONTROL,
+ protocol_version, PROTECTION_OFF, FRAME_TYPE_CONTROL,
SERVICE_TYPE_CONTROL, FRAME_DATA_HEART_BEAT, session_id,
0u, message_counters_[session_id]++));
-
- raw_ford_messages_to_mobile_.PostMessage(
- impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_, "SendHeartBeat finished successfully");
+ raw_ford_messages_to_mobile_.PostMessage(impl::RawFordMessageToMobile(ptr, false));
+ LOG4CXX_DEBUG(logger_, "SendHeartBeat finished successfully");
} else {
LOG4CXX_WARN(logger_, "SendHeartBeat is failed connection or session does not exist");
}
@@ -331,9 +320,9 @@ void ProtocolHandlerImpl::SendHeartBeat(int32_t connection_id,
void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
bool final_message) {
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
LOG4CXX_AUTO_TRACE(logger_);
if (!message) {
LOG4CXX_ERROR(logger_,
@@ -341,25 +330,17 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
return;
}
- if (!session_observer_) {
- LOG4CXX_ERROR(
- logger_,
- "Cannot handle message to mobile app:" <<
- " ISessionObserver doesn't exist.");
- return;
- }
uint32_t connection_handle = 0;
uint8_t sessionID = 0;
- session_observer_->PairFromKey(message->connection_key(), &connection_handle,
+ session_observer_.PairFromKey(message->connection_key(), &connection_handle,
&sessionID);
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
uint32_t message_id = message_counters_[sessionID];
if (metric_observer_) {
metric_observer_->StartMessageProcess(message_id, start_time);
}
-#endif // TIME_TESTER
- const size_t max_frame_size =
- profile::Profile::instance()->maximum_payload_size();
+#endif // TELEMETRY_MONITOR
+ const size_t max_frame_size = get_settings().maximum_payload_size();
size_t frame_size = MAXIMUM_FRAME_DATA_V2_SIZE;
switch (message->protocol_version()) {
case PROTOCOL_VERSION_3:
@@ -371,7 +352,7 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
break;
}
#ifdef ENABLE_SECURITY
- const security_manager::SSLContext *ssl_context = session_observer_->
+ const security_manager::SSLContext *ssl_context = session_observer_.
GetSSLContext(message->connection_key(), message->service_type());
if (ssl_context && ssl_context->IsInitCompleted()) {
const size_t max_block_size = ssl_context->get_max_block_size(frame_size);
@@ -413,10 +394,10 @@ void ProtocolHandlerImpl::SendMessageToMobileApp(const RawMessagePtr message,
"ProtocolHandler failed to send multiframe messages.");
}
}
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- PHMetricObserver::MessageMetric *metric
- = new PHMetricObserver::MessageMetric();
+ PHTelemetryObserver::MessageMetric *metric
+ = new PHTelemetryObserver::MessageMetric();
metric->message_id = message_id;
metric->connection_key = message->connection_key();
metric->raw_msg = message;
@@ -442,34 +423,34 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
" msg data_size " << tm_message->data_size());
RESULT_CODE result;
- size_t malformed_occurs = false;
- const std::list<ProtocolFramePtr> protocol_frames =
+ size_t malformed_occurs = 0u;
+ const ProtocolFramePtrList protocol_frames =
incoming_data_handler_.ProcessData(*tm_message, &result, &malformed_occurs);
- LOG4CXX_DEBUG(logger_, "Proccessed " << protocol_frames.size() << "frames");
+ LOG4CXX_DEBUG(logger_, "Proccessed " << protocol_frames.size() << " frames");
if (result != RESULT_OK) {
if (result == RESULT_MALFORMED_OCCURS) {
LOG4CXX_WARN(logger_, "Malformed message occurs, connection id "
<< connection_key);
- if (!malformed_message_filtering_) {
+ if (!get_settings().malformed_message_filtering()) {
LOG4CXX_DEBUG(logger_, "Malformed message filterign disabled");
- if (session_observer_) {
- session_observer_->OnMalformedMessageCallback(connection_key);
- }
+ session_observer_.OnMalformedMessageCallback(connection_key);
// For tracking only malformed occurrence check outpute
- } else if(!protocol_frames.empty()) {
- TrackMalformedMessage(connection_key, malformed_occurs);
+ } else {
+ if (malformed_occurs > 0) {
+ TrackMalformedMessage(connection_key, malformed_occurs);
+ }
}
} else {
LOG4CXX_ERROR(logger_, "Incoming data processing failed.");
- transport_manager_->DisconnectForce(connection_key);
+ transport_manager_.DisconnectForce(connection_key);
}
}
- for (std::list<ProtocolFramePtr>::const_iterator it =
+ for (ProtocolFramePtrList::const_iterator it =
protocol_frames.begin(); it != protocol_frames.end(); ++it) {
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
ProtocolFramePtr frame = *it;
#ifdef ENABLE_SECURITY
const RESULT_CODE result = DecryptFrame(frame);
@@ -479,11 +460,11 @@ void ProtocolHandlerImpl::OnTMMessageReceived(const RawMessagePtr tm_message) {
}
#endif // ENABLE_SECURITY
impl::RawFordMessageFromMobile msg(frame);
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
metric_observer_->StartMessageProcess(msg->message_id(), start_time);
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
raw_ford_messages_from_mobile_.PostMessage(msg);
}
@@ -498,9 +479,15 @@ void ProtocolHandlerImpl::OnTMMessageReceiveFailed(
void ProtocolHandlerImpl::NotifySubscribers(const RawMessagePtr message) {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock lock(protocol_observers_lock_);
+ if (protocol_observers_.empty()) {
+ LOG4CXX_ERROR(
+ logger_,
+ "Cannot handle multiframe message: no IProtocolObserver is set.");
+ }
for (ProtocolObservers::iterator it = protocol_observers_.begin();
protocol_observers_.end() != it; ++it) {
- (*it)->OnMessageReceived(message);
+ ProtocolObserver* observe = *it;
+ observe->OnMessageReceived(message);
}
}
@@ -510,17 +497,17 @@ void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) {
uint32_t connection_handle = 0;
uint8_t sessionID = 0;
- session_observer_->PairFromKey(message->connection_key(),
+ session_observer_.PairFromKey(message->connection_key(),
&connection_handle,
&sessionID);
- std::list<uint32_t>::iterator connection_it =
+ std::vector<uint32_t>::iterator connection_it =
std::find(ready_to_close_connections_.begin(),
ready_to_close_connections_.end(), connection_handle);
if (ready_to_close_connections_.end() != connection_it) {
ready_to_close_connections_.erase(connection_it);
- transport_manager_->Disconnect(connection_handle);
+ transport_manager_.Disconnect(connection_handle);
return;
}
@@ -555,22 +542,26 @@ void ProtocolHandlerImpl::OnTMMessageSend(const RawMessagePtr message) {
void ProtocolHandlerImpl::OnTMMessageSendFailed(
const transport_manager::DataSendError &error,
const RawMessagePtr message) {
+ DCHECK_OR_RETURN_VOID(message);
// TODO(PV): implement
LOG4CXX_ERROR(logger_, "Sending message " << message->data_size()
- << " bytes failed: " << error.text());
+ << "bytes failed, connection_key " << message->connection_key()
+ << "Error_text: " << error.text());
}
void ProtocolHandlerImpl::OnConnectionEstablished(
const transport_manager::DeviceInfo &device_info,
- const transport_manager::ConnectionUID &connection_id) {
+ const transport_manager::ConnectionUID connection_id) {
incoming_data_handler_.AddConnection(connection_id);
+ multiframe_builder_.AddConnection(connection_id);
}
void ProtocolHandlerImpl::OnConnectionClosed(
- const transport_manager::ConnectionUID &connection_id) {
+ const transport_manager::ConnectionUID connection_id) {
incoming_data_handler_.RemoveConnection(connection_id);
message_meter_.ClearIdentifiers();
malformed_message_meter_.ClearIdentifiers();
+ multiframe_builder_.RemoveConnection(connection_id);
}
RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) {
@@ -595,20 +586,16 @@ RESULT_CODE ProtocolHandlerImpl::SendFrame(const ProtocolFramePtr packet) {
if (!message_to_send) {
LOG4CXX_ERROR(logger_, "Serialization error");
return RESULT_FAIL;
- };
+ }
LOG4CXX_DEBUG(logger_,
"Message to send with connection id " <<
static_cast<int>(packet->connection_id()));
- if (!transport_manager_) {
- LOG4CXX_WARN(logger_, "No Transport Manager found.");
- return RESULT_FAIL;
- }
if (transport_manager::E_SUCCESS !=
- transport_manager_->SendMessageToDevice(message_to_send)) {
+ transport_manager_.SendMessageToDevice(message_to_send)) {
LOG4CXX_WARN(logger_, "Can't send message to device");
return RESULT_FAIL;
- };
+ }
return RESULT_OK;
}
@@ -699,22 +686,22 @@ RESULT_CODE ProtocolHandlerImpl::SendMultiFrameMessage(
return RESULT_OK;
}
-RESULT_CODE ProtocolHandlerImpl::HandleMessage(ConnectionID connection_id,
- const ProtocolFramePtr packet) {
- LOG4CXX_AUTO_TRACE(logger_);
+RESULT_CODE ProtocolHandlerImpl::HandleMessage(const ProtocolFramePtr packet) {
+ DCHECK_OR_RETURN(packet, RESULT_UNKNOWN);
+ LOG4CXX_DEBUG(logger_, "Handling message " << packet);
switch (packet->frame_type()) {
case FRAME_TYPE_CONTROL:
- LOG4CXX_TRACE(logger_, "handleMessage() - case FRAME_TYPE_CONTROL");
- return HandleControlMessage(connection_id, packet);
+ LOG4CXX_TRACE(logger_, "FRAME_TYPE_CONTROL");
+ return HandleControlMessage(packet);
case FRAME_TYPE_SINGLE:
- LOG4CXX_TRACE(logger_, "handleMessage() - case FRAME_TYPE_SINGLE");
- return HandleSingleFrameMessage(connection_id, packet);
+ LOG4CXX_TRACE(logger_, "FRAME_TYPE_SINGLE");
+ return HandleSingleFrameMessage(packet);
case FRAME_TYPE_FIRST:
case FRAME_TYPE_CONSECUTIVE:
- LOG4CXX_TRACE(logger_, "handleMessage() - case FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE");
- return HandleMultiFrameMessage(connection_id, packet);
+ LOG4CXX_TRACE(logger_, "FRAME_TYPE_FIRST or FRAME_TYPE_CONSECUTIVE");
+ return HandleMultiFrameMessage(packet);
default: {
- LOG4CXX_WARN(logger_, "handleMessage() - case unknown frame type"
+ LOG4CXX_WARN(logger_, "Unknown frame type"
<< packet->frame_type());
return RESULT_FAIL;
}
@@ -722,23 +709,15 @@ RESULT_CODE ProtocolHandlerImpl::HandleMessage(ConnectionID connection_id,
return RESULT_OK;
}
-RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
- ConnectionID connection_id, const ProtocolFramePtr packet) {
+RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
"FRAME_TYPE_SINGLE message of size " << packet->data_size() << "; message "
<< ConvertPacketDataToString(packet->data(), packet->data_size()));
- if (!session_observer_) {
- LOG4CXX_ERROR(logger_,
- "Cannot handle message from Transport"
- << " Manager: ISessionObserver doesn't exist.");
- return RESULT_FAIL;
- }
-
const uint32_t connection_key =
- session_observer_->KeyFromPair(connection_id, packet->session_id());
+ session_observer_.KeyFromPair(packet->connection_id(), packet->session_id());
const RawMessagePtr rawMessage(
new RawMessage(connection_key,
@@ -750,10 +729,10 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
if (!rawMessage) {
return RESULT_FAIL;
}
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- PHMetricObserver::MessageMetric *metric
- = new PHMetricObserver::MessageMetric();
+ PHTelemetryObserver::MessageMetric *metric
+ = new PHTelemetryObserver::MessageMetric();
metric->message_id = packet->message_id();
metric->connection_key = connection_key;
metric->raw_msg = rawMessage;
@@ -766,120 +745,41 @@ RESULT_CODE ProtocolHandlerImpl::HandleSingleFrameMessage(
return RESULT_OK;
}
-RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(
- ConnectionID connection_id, const ProtocolFramePtr packet) {
+RESULT_CODE ProtocolHandlerImpl::HandleMultiFrameMessage(const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
- if (!session_observer_) {
- LOG4CXX_ERROR(logger_, "No ISessionObserver set.");
- return RESULT_FAIL;
+ if (multiframe_builder_.AddFrame(packet) != RESULT_OK) {
+ LOG4CXX_WARN(logger_, "Frame assembling issue");
}
- const uint32_t key = session_observer_->KeyFromPair(connection_id,
- packet->session_id());
- LOG4CXX_DEBUG(
- logger_,
- "Packet " << packet << "; session id " << static_cast<int32_t>(key));
-
- if (packet->frame_type() == FRAME_TYPE_FIRST) {
- LOG4CXX_DEBUG(logger_, "handleMultiFrameMessage() - FRAME_TYPE_FIRST "
- << packet->data_size());
- incomplete_multi_frame_messages_[key] = packet;
- } else {
- LOG4CXX_DEBUG(logger_, "handleMultiFrameMessage() - Consecutive frame");
-
- std::map<int32_t, ProtocolFramePtr>::iterator it =
- incomplete_multi_frame_messages_.find(key);
-
- if (it == incomplete_multi_frame_messages_.end()) {
- LOG4CXX_ERROR(
- logger_, "Frame of multiframe message for non-existing session id");
- return RESULT_FAIL;
- }
-
- if (it->second->appendData(packet->data(), packet->data_size())
- != RESULT_OK) {
- LOG4CXX_ERROR(logger_,
- "Failed to append frame for multiframe message.");
- return RESULT_FAIL;
- }
-
- if (packet->frame_data() == FRAME_DATA_LAST_CONSECUTIVE) {
- LOG4CXX_DEBUG(
- logger_,
- "Last frame of multiframe message size " << packet->data_size()
- << "; connection key " << key);
- {
- sync_primitives::AutoLock lock(protocol_observers_lock_);
- if (protocol_observers_.empty()) {
- LOG4CXX_ERROR(
- logger_,
- "Cannot handle multiframe message: no IProtocolObserver is set.");
- return RESULT_FAIL;
- }
- }
-
- ProtocolFramePtr completePacket = it->second;
- const uint32_t connection_key =
- session_observer_->KeyFromPair(connection_id,
- completePacket->session_id());
- const RawMessagePtr rawMessage(
- new RawMessage(connection_key,
- completePacket->protocol_version(),
- completePacket->data(),
- completePacket->total_data_bytes(),
- completePacket->service_type(),
- completePacket->payload_size()));
-
- LOG4CXX_DEBUG(logger_,
- "total_data_bytes " << completePacket->total_data_bytes() <<
- " packet_size " << completePacket->packet_size() <<
- " data size " << completePacket->data_size() <<
- " payload_size " << completePacket->payload_size());
-
- if (!rawMessage) {
- return RESULT_FAIL;
- }
-
-#ifdef TIME_TESTER
- if (metric_observer_) {
- PHMetricObserver::MessageMetric *metric =
- new PHMetricObserver::MessageMetric();
- metric->raw_msg = rawMessage;
- metric_observer_->EndMessageProcess(metric);
- }
-#endif // TIME_TESTER
- // TODO(EZamakhov): check service in session
- NotifySubscribers(rawMessage);
-
- incomplete_multi_frame_messages_.erase(it);
- }
- }
return RESULT_OK;
}
-RESULT_CODE ProtocolHandlerImpl::HandleControlMessage(
- ConnectionID connection_id, const ProtocolFramePtr packet) {
+RESULT_CODE ProtocolHandlerImpl::HandleControlMessage(const ProtocolFramePtr packet) {
LOG4CXX_AUTO_TRACE(logger_);
- if (!session_observer_) {
- LOG4CXX_ERROR(logger_, "ISessionObserver is not set.");
- return RESULT_FAIL;
- }
-
+ // TODO{ALeshin}: Rename "Session" to "Service" on PH, CH, AM levels
switch (packet->frame_data()) {
- case FRAME_DATA_START_SERVICE:
- return HandleControlMessageStartSession(connection_id, *(packet.get()));
- case FRAME_DATA_END_SERVICE:
- return HandleControlMessageEndSession(connection_id, *(packet.get()));
+ case FRAME_DATA_START_SERVICE: {
+ LOG4CXX_TRACE(logger_, "FrameData: StartService");
+ return HandleControlMessageStartSession(*packet);
+ }
+ case FRAME_DATA_END_SERVICE: {
+ LOG4CXX_TRACE(logger_, "FrameData: StopService");
+ return HandleControlMessageEndSession(*packet);
+ }
+ case FRAME_DATA_END_SERVICE_ACK: {
+ LOG4CXX_TRACE(logger_, "FrameData: StopService ACK");
+ return HandleControlMessageEndServiceACK(*packet);
+ }
case FRAME_DATA_HEART_BEAT: {
- LOG4CXX_DEBUG(logger_,
- "Received heart beat for connection " << connection_id);
- return HandleControlMessageHeartBeat(connection_id, *(packet.get()));
+ LOG4CXX_TRACE(logger_, "FrameData: Heartbeat");
+ return HandleControlMessageHeartBeat(*packet);
}
case FRAME_DATA_HEART_BEAT_ACK: {
- LOG4CXX_DEBUG(logger_, "Received heart beat ack from mobile app"
- " for connection " << connection_id);
+ LOG4CXX_TRACE(logger_, "FrameData Heartbeat ACK");
+ LOG4CXX_DEBUG(logger_, "Received Heartbeat ACK from mobile,"
+ " connection: " << packet->connection_id());
return RESULT_OK;
}
default:
@@ -906,21 +806,21 @@ uint32_t get_hash_id(const ProtocolPacket &packet) {
return hash_le == HASH_ID_NOT_SUPPORTED ? HASH_ID_WRONG : hash_le;
}
-RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
- ConnectionID connection_id, const ProtocolPacket &packet) {
+RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(const ProtocolPacket& packet) {
LOG4CXX_AUTO_TRACE(logger_);
const uint8_t current_session_id = packet.session_id();
const uint32_t hash_id = get_hash_id(packet);
const ServiceType service_type = ServiceTypeFromByte(packet.service_type());
- const uint32_t session_key = session_observer_->OnSessionEndedCallback(
+ const ConnectionID connection_id = packet.connection_id();
+ const uint32_t session_key = session_observer_.OnSessionEndedCallback(
connection_id, current_session_id, hash_id, service_type);
// TODO(EZamakhov): add clean up output queue (for removed service)
if (session_key != 0) {
- SendEndSessionAck( connection_id, current_session_id,
- packet.protocol_version(), service_type);
+ SendEndSessionAck(connection_id, current_session_id,
+ packet.protocol_version(), service_type);
message_counters_.erase(current_session_id);
} else {
LOG4CXX_WARN(
@@ -931,6 +831,26 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndSession(
}
return RESULT_OK;
}
+
+RESULT_CODE ProtocolHandlerImpl::HandleControlMessageEndServiceACK(const ProtocolPacket& packet) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const uint8_t current_session_id = packet.session_id();
+ const 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);
+
+ if (0 == session_key) {
+ LOG4CXX_WARN(logger_, "Refused to end service");
+ return RESULT_FAIL;
+ }
+
+ return RESULT_OK;
+}
+
#ifdef ENABLE_SECURITY
namespace {
/**
@@ -942,12 +862,13 @@ class StartSessionHandler : public security_manager::SecurityManagerListener {
StartSessionHandler(
uint32_t connection_key,
ProtocolHandlerImpl *protocol_handler,
- SessionObserver *session_observer,
+ SessionObserver& session_observer,
ConnectionID connection_id,
int32_t session_id,
uint8_t protocol_version,
uint32_t hash_id,
- ServiceType service_type)
+ ServiceType service_type,
+ const std::vector<int>& force_protected_service)
: connection_key_(connection_key),
protocol_handler_(protocol_handler),
session_observer_(session_observer),
@@ -955,22 +876,24 @@ class StartSessionHandler : public security_manager::SecurityManagerListener {
session_id_(session_id),
protocol_version_(protocol_version),
hash_id_(hash_id),
- service_type_(service_type) {
+ service_type_(service_type)
+ ,force_protected_service_(force_protected_service)
+ {
}
- bool OnHandshakeDone(const uint32_t connection_key, const bool success) OVERRIDE {
+
+ bool OnHandshakeDone(
+ const uint32_t connection_key,
+ security_manager::SSLContext::HandshakeResult result) OVERRIDE {
if (connection_key != connection_key_) {
return false;
}
+ const bool success =
+ result == security_manager::SSLContext::Handshake_Result_Success;
// check current service protection
const bool was_service_protection_enabled =
- session_observer_->GetSSLContext(connection_key_, service_type_) != NULL;
+ session_observer_.GetSSLContext(connection_key_, service_type_) != NULL;
if (was_service_protection_enabled) {
- // On Success handshake
- if (success) {
-// const std::string error_text("Connection is already protected");
-// LOG4CXX_WARN(logger_, error_text << ", key " << connection_key);
-// security_manager_->SendInternalError(
-// connection_key, security_manager::SecurityManager::ERROR_SERVICE_ALREADY_PROTECTED, error_text);
+ if (!success) {
protocol_handler_->SendStartSessionNAck(connection_id_, session_id_,
protocol_version_, service_type_);
} else {
@@ -979,33 +902,44 @@ class StartSessionHandler : public security_manager::SecurityManagerListener {
}
} else {
if (success) {
- session_observer_->SetProtectionFlag(connection_key_, service_type_);
+ session_observer_.SetProtectionFlag(connection_key_, service_type_);
}
- protocol_handler_->SendStartSessionAck(connection_id_, session_id_,
- protocol_version_, hash_id_, service_type_, success);
+ protocol_handler_->SendStartSessionAck(
+ connection_id_, session_id_,
+ protocol_version_, hash_id_,
+ service_type_,
+ success);
}
delete this;
return true;
}
+ void OnCertificateUpdateRequired() OVERRIDE {
+ }
+
+ virtual const std::vector<int>& force_protected_service() const {
+ return force_protected_service_;
+ }
+
private:
const uint32_t connection_key_;
ProtocolHandlerImpl *protocol_handler_;
- SessionObserver *session_observer_;
+ SessionObserver& session_observer_;
const ConnectionID connection_id_;
const int32_t session_id_;
const uint8_t protocol_version_;
const uint32_t hash_id_;
const ServiceType service_type_;
+ const std::vector<int> force_protected_service_;
};
} // namespace
#endif // ENABLE_SECURITY
-RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
- ConnectionID connection_id, const ProtocolPacket &packet) {
+RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(const ProtocolPacket& packet) {
+ LOG4CXX_AUTO_TRACE(logger_);
LOG4CXX_DEBUG(logger_,
- "Protocol version: " <<
+ "Protocol version:" <<
static_cast<int>(packet.protocol_version()));
const ServiceType service_type = ServiceTypeFromByte(packet.service_type());
const uint8_t protocol_version = packet.protocol_version();
@@ -1018,13 +952,13 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
const bool protection = false;
#endif // ENABLE_SECURITY
- DCHECK(session_observer_);
uint32_t hash_id;
- const uint32_t session_id = session_observer_->OnSessionStartedCallback(
+ const ConnectionID connection_id = packet.connection_id();
+ const uint32_t session_id = session_observer_.OnSessionStartedCallback(
connection_id, packet.session_id(), service_type, protection, &hash_id);
if (0 == session_id) {
- LOG4CXX_WARN_EXT(logger_, "Refused to create service " <<
+ LOG4CXX_WARN(logger_, "Refused by session_observer to create service " <<
static_cast<int32_t>(service_type) << " type.");
SendStartSessionNAck(connection_id, packet.session_id(),
protocol_version, packet.service_type());
@@ -1035,7 +969,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
// for packet is encrypted and security plugin is enable
if (protection && security_manager_) {
const uint32_t connection_key =
- session_observer_->KeyFromPair(connection_id, session_id);
+ session_observer_.KeyFromPair(connection_id, session_id);
security_manager::SSLContext *ssl_context =
security_manager_->CreateSSLContext(connection_key);
@@ -1051,7 +985,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
}
if (ssl_context->IsInitCompleted()) {
// mark service as protected
- session_observer_->SetProtectionFlag(connection_key, service_type);
+ session_observer_.SetProtectionFlag(connection_key, service_type);
// Start service as protected with current SSLContext
SendStartSessionAck(connection_id, session_id, packet.protocol_version(),
hash_id, packet.service_type(), PROTECTION_ON);
@@ -1060,7 +994,7 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
new StartSessionHandler(
connection_key, this, session_observer_,
connection_id, session_id, packet.protocol_version(),
- hash_id, service_type));
+ hash_id, service_type, get_settings().force_protected_service()));
if (!ssl_context->IsHandshakePending()) {
// Start handshake process
security_manager_->StartHandshake(connection_key);
@@ -1077,21 +1011,20 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageStartSession(
return RESULT_OK;
}
-RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(
- ConnectionID connection_id, const ProtocolPacket &packet) {
+RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(const ProtocolPacket& packet) {
+ const ConnectionID connection_id = packet.connection_id();
LOG4CXX_DEBUG(
logger_,
"Sending heart beat acknowledgment for connection " << connection_id);
uint8_t protocol_version;
- if (session_observer_->ProtocolVersionUsed(
+ if (session_observer_.ProtocolVersionUsed(
connection_id, packet.session_id(), protocol_version)) {
// TODO(EZamakhov): investigate message_id for HeartBeatAck
if (PROTOCOL_VERSION_3 == protocol_version ||
PROTOCOL_VERSION_4 == protocol_version) {
return SendHeartBeatAck(connection_id, packet.session_id(),
packet.message_id());
- }
- else {
+ } else {
LOG4CXX_WARN(logger_, "HeartBeat is not supported");
return RESULT_HEARTBEAT_IS_NOT_SUPPORTED;
}
@@ -1102,17 +1035,51 @@ RESULT_CODE ProtocolHandlerImpl::HandleControlMessageHeartBeat(
}
}
+void ProtocolHandlerImpl::PopValideAndExpirateMultiframes() {
+ const ProtocolFramePtrList& frame_list = multiframe_builder_.PopMultiframes();
+ for (ProtocolFramePtrList::const_iterator it = frame_list.begin();
+ it != frame_list.end(); ++it) {
+ const ProtocolFramePtr frame = *it;
+ DCHECK(frame);
+ if(!frame) {
+ continue;
+ }
+
+ const uint32_t connection_key =
+ session_observer_.KeyFromPair(frame->connection_id(), frame->session_id());
+ LOG4CXX_DEBUG(logger_, "Result frame" << frame <<
+ "for connection "<< connection_key);
+ const RawMessagePtr rawMessage(
+ new RawMessage(connection_key,
+ frame->protocol_version(),
+ frame->data(),
+ frame->total_data_bytes(),
+ frame->service_type(),
+ frame->payload_size()));
+ DCHECK(rawMessage);
+
+#ifdef TELEMETRY_MONITOR
+ if (metric_observer_) {
+ PHTelemetryObserver::MessageMetric *metric =
+ new PHTelemetryObserver::MessageMetric();
+ metric->raw_msg = rawMessage;
+ metric_observer_->EndMessageProcess(metric);
+ }
+#endif // TELEMETRY_MONITOR
+ NotifySubscribers(rawMessage);
+ }
+}
+
bool ProtocolHandlerImpl::TrackMessage(const uint32_t& connection_key) {
LOG4CXX_AUTO_TRACE(logger_);
- if (message_frequency_time_ > 0u &&
- message_max_frequency_ > 0u) {
+ const size_t& frequency_time = get_settings().message_frequency_time();
+ const size_t& frequency_count = get_settings().message_frequency_count();
+ if (frequency_time > 0u && frequency_count > 0u) {
const size_t message_frequency = message_meter_.TrackMessage(connection_key);
LOG4CXX_DEBUG(logger_, "Frequency of " << connection_key << " is " << message_frequency);
- if (message_frequency > message_max_frequency_) {
+ if (message_frequency > frequency_count) {
LOG4CXX_WARN(logger_, "Frequency of " << connection_key << " is marked as high.");
- if (session_observer_) {
- session_observer_->OnApplicationFloodCallBack(connection_key);
- }
+ session_observer_.OnApplicationFloodCallBack(connection_key);
message_meter_.RemoveIdentifier(connection_key);
return true;
}
@@ -1122,20 +1089,20 @@ bool ProtocolHandlerImpl::TrackMessage(const uint32_t& connection_key) {
bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t &connection_key,
const size_t count) {
+ const size_t& malformed_frequency_count =
+ get_settings().malformed_frequency_count();
LOG4CXX_AUTO_TRACE(logger_);
- if (malformed_message_frequency_time_ > 0u &&
- malformed_message_max_frequency_ > 0u) {
+ if (get_settings().malformed_frequency_time() > 0u &&
+ malformed_frequency_count > 0u) {
const size_t malformed_message_frequency =
malformed_message_meter_.TrackMessages(connection_key, count);
LOG4CXX_DEBUG(logger_, "Malformed frequency of " << connection_key
<< " is " << malformed_message_frequency);
- if (!malformed_message_filtering_ ||
- malformed_message_frequency > malformed_message_max_frequency_) {
+ if (!get_settings().malformed_message_filtering() ||
+ malformed_message_frequency > malformed_frequency_count) {
LOG4CXX_WARN(logger_, "Malformed frequency of " << connection_key
<< " is marked as high.");
- if (session_observer_) {
- session_observer_->OnMalformedMessageCallback(connection_key);
- }
+ session_observer_.OnMalformedMessageCallback(connection_key);
malformed_message_meter_.RemoveIdentifier(connection_key);
return true;
}
@@ -1143,21 +1110,15 @@ bool ProtocolHandlerImpl::TrackMalformedMessage(const uint32_t &connection_key,
return false;
}
-void ProtocolHandlerImpl::Handle(
- const impl::RawFordMessageFromMobile message) {
+void ProtocolHandlerImpl::Handle(const impl::RawFordMessageFromMobile message) {
LOG4CXX_AUTO_TRACE(logger_);
- if (NULL == session_observer_) {
- LOG4CXX_WARN(logger_, "Session Observer is NULL");
- return;
- }
-
switch (message->service_type()) {
case kMobileNav:
case kAudio:
break;
default: {
- const uint32_t connection_key = session_observer_->KeyFromPair(
+ const uint32_t connection_key = session_observer_.KeyFromPair(
message->connection_id(), message->session_id());
if (TrackMessage(connection_key)) {
return;
@@ -1165,15 +1126,12 @@ void ProtocolHandlerImpl::Handle(
}
break;
}
-
- connection_handler::ConnectionHandlerImpl *connection_handler =
- connection_handler::ConnectionHandlerImpl::instance();
LOG4CXX_DEBUG(logger_, "Message : " << message.get());
const uint8_t c_id = message->connection_id();
- const uint32_t m_id = message->session_id();
+ const uint32_t m_id = message->session_id();
- if (session_observer_->IsHeartBeatSupported(c_id, m_id)) {
- connection_handler->KeepConnectionAlive(c_id, m_id);
+ if (session_observer_.IsHeartBeatSupported(c_id, m_id)) {
+ connection_handler_.KeepConnectionAlive(c_id, m_id);
}
// TODO(EZamakhov): remove dublication of IncomingDataHandler logic
@@ -1181,7 +1139,8 @@ void ProtocolHandlerImpl::Handle(
FRAME_TYPE_CONTROL == message->frame_type() ||
FRAME_TYPE_FIRST == message->frame_type()) {
LOG4CXX_DEBUG(logger_, "Packet: dataSize " << message->data_size());
- HandleMessage(message->connection_id(), message);
+ HandleMessage(message);
+ PopValideAndExpirateMultiframes();
} else {
LOG4CXX_WARN(logger_,
"handleMessagesFromMobileApp() - incorrect or NULL data");
@@ -1227,17 +1186,13 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
packet->frame_type() == FRAME_TYPE_CONTROL) {
return RESULT_OK;
}
- if (!session_observer_) {
- LOG4CXX_WARN(logger_, "No session_observer_ set.");
- return RESULT_FAIL;
- }
if (!security_manager_) {
LOG4CXX_WARN(logger_, "No security_manager_ set.");
return RESULT_FAIL;
}
- const uint32_t connection_key = session_observer_->KeyFromPair(
+ const uint32_t connection_key = session_observer_.KeyFromPair(
packet->connection_id(), packet->session_id());
- security_manager::SSLContext *context = session_observer_->GetSSLContext(
+ security_manager::SSLContext *context = session_observer_.GetSSLContext(
connection_key, ServiceTypeFromByte(packet->service_type()));
if (!context || !context->IsInitCompleted()) {
return RESULT_OK;
@@ -1251,11 +1206,11 @@ RESULT_CODE ProtocolHandlerImpl::EncryptFrame(ProtocolFramePtr packet) {
security_manager_->SendInternalError(connection_key,
security_manager::SecurityManager::ERROR_ENCRYPTION_FAILED, error_text);
// Close session to prevent usage unprotected service/session
- session_observer_->OnSessionEndedCallback(
+ session_observer_.OnSessionEndedCallback(
packet->connection_id(), packet->session_id(),
packet->message_id(), kRpc);
return RESULT_OK;
- };
+ }
LOG4CXX_DEBUG(logger_, "Encrypted " << packet->data_size() << " bytes to "
<< out_data_size << " bytes");
DCHECK(out_data);
@@ -1273,17 +1228,13 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
packet->frame_type() == FRAME_TYPE_CONTROL) {
return RESULT_OK;
}
- if (!session_observer_) {
- LOG4CXX_WARN(logger_, "No session_observer_ set.");
- return RESULT_FAIL;
- }
if (!security_manager_) {
LOG4CXX_WARN(logger_, "No security_manager_ set.");
return RESULT_FAIL;
}
- const uint32_t connection_key = session_observer_->KeyFromPair(
+ const uint32_t connection_key = session_observer_.KeyFromPair(
packet->connection_id(), packet->session_id());
- security_manager::SSLContext *context = session_observer_->GetSSLContext(
+ security_manager::SSLContext *context = session_observer_.GetSSLContext(
connection_key, ServiceTypeFromByte(packet->service_type()));
if (!context || !context->IsInitCompleted()) {
const std::string error_text("Fail decryption for unprotected service ");
@@ -1301,11 +1252,11 @@ RESULT_CODE ProtocolHandlerImpl::DecryptFrame(ProtocolFramePtr packet) {
security_manager_->SendInternalError(connection_key,
security_manager::SecurityManager::ERROR_DECRYPTION_FAILED, error_text);
// Close session to prevent usage unprotected service/session
- session_observer_->OnSessionEndedCallback(
+ session_observer_.OnSessionEndedCallback(
packet->connection_id(), packet->session_id(),
packet->message_id(), kRpc);
return RESULT_ENCRYPTION_FAILED;
- };
+ }
LOG4CXX_DEBUG(logger_, "Decrypted " << packet->data_size() << " bytes to "
<< out_data_size << " bytes");
DCHECK(out_data);
@@ -1323,34 +1274,33 @@ void ProtocolHandlerImpl::SendFramesNumber(uint32_t connection_key,
// TODO(EZamakhov): add protocol version check - to avoid send for PROTOCOL_VERSION_1
transport_manager::ConnectionUID connection_id = 0;
uint8_t session_id = 0;
- session_observer_->PairFromKey(connection_key, &connection_id, &session_id);
+ session_observer_.PairFromKey(connection_key, &connection_id, &session_id);
uint8_t protocol_version;
- if (session_observer_->ProtocolVersionUsed(connection_id, session_id,
- protocol_version)) {
+ if (session_observer_.ProtocolVersionUsed(connection_id, session_id,
+ protocol_version)) {
ProtocolFramePtr ptr(new protocol_handler::ProtocolPacket(connection_id,
- protocol_version, PROTECTION_OFF, FRAME_TYPE_CONTROL,
- SERVICE_TYPE_NAVI, FRAME_DATA_SERVICE_DATA_ACK,
- session_id, 0, message_counters_[session_id]++));
+ protocol_version, PROTECTION_OFF, FRAME_TYPE_CONTROL,
+ SERVICE_TYPE_NAVI, FRAME_DATA_SERVICE_DATA_ACK,
+ session_id, 0, message_counters_[session_id]++));
// Flow control data shall be 4 bytes according Ford Protocol
DCHECK(sizeof(number_of_frames) == 4);
number_of_frames = LE_TO_BE32(number_of_frames);
ptr->set_data(reinterpret_cast<const uint8_t*>(&number_of_frames),
- sizeof(number_of_frames));
- raw_ford_messages_to_mobile_.PostMessage(
- impl::RawFordMessageToMobile(ptr, false));
- LOG4CXX_DEBUG(logger_, "SendFramesNumber finished successfully");
+ sizeof(number_of_frames));
+ raw_ford_messages_to_mobile_.PostMessage(
+ impl::RawFordMessageToMobile(ptr, false));
+ LOG4CXX_DEBUG(logger_, "SendFramesNumber finished successfully");
} else {
- LOG4CXX_WARN(logger_, "SendFramesNumber is failed connection or session does not exist");
+ LOG4CXX_WARN(logger_, "SendFramesNumber is failed connection or session does not exist");
}
-
}
-#ifdef TIME_TESTER
-void ProtocolHandlerImpl::SetTimeMetricObserver(PHMetricObserver *observer) {
+#ifdef TELEMETRY_MONITOR
+void ProtocolHandlerImpl::SetTelemetryObserver(PHTelemetryObserver *observer) {
metric_observer_ = observer;
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
std::string ConvertPacketDataToString(const uint8_t *data,
const size_t data_size) {
@@ -1369,12 +1319,13 @@ std::string ConvertPacketDataToString(const uint8_t *data,
return is_printable_array ? std::string(text, data_size) : std::string("is raw data");
}
-uint8_t SupportedSDLProtocolVersion() {
+uint8_t ProtocolHandlerImpl::SupportedSDLProtocolVersion() const {
LOG4CXX_AUTO_TRACE(logger_);
bool heart_beat_support =
- (0 != profile::Profile::instance()->heart_beat_timeout());
- bool sdl4_support = profile::Profile::instance()->enable_protocol_4();
+ (0 != get_settings().heart_beat_timeout());
+
+ bool sdl4_support = get_settings().enable_protocol_4();
if (sdl4_support) {
return PROTOCOL_VERSION_4;
diff --git a/src/components/protocol_handler/src/protocol_packet.cc b/src/components/protocol_handler/src/protocol_packet.cc
index a31678ec6e..9a3e6e49d6 100644
--- a/src/components/protocol_handler/src/protocol_packet.cc
+++ b/src/components/protocol_handler/src/protocol_packet.cc
@@ -33,6 +33,7 @@
#include <stdint.h>
#include <memory.h>
#include <new>
+#include <memory>
#include <cstring>
#include <limits>
@@ -43,6 +44,8 @@
namespace protocol_handler {
+CREATE_LOGGERPTR_GLOBAL(logger_, "ProtocolHandler")
+
ProtocolPacket::ProtocolData::ProtocolData()
: data(NULL), totalDataBytes(0u) { }
@@ -86,7 +89,10 @@ inline uint32_t read_be_uint32(const uint8_t* const data) {
void ProtocolPacket::ProtocolHeader::deserialize(
const uint8_t* message, const size_t messageSize) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(message);
if (messageSize < PROTOCOL_HEADER_V1_SIZE) {
+ LOG4CXX_DEBUG(logger_, "Message size less " << PROTOCOL_HEADER_V1_SIZE << " bytes");
return;
}
// first 4 bits
@@ -105,14 +111,17 @@ void ProtocolPacket::ProtocolHeader::deserialize(
switch (version) {
case PROTOCOL_VERSION_2:
case PROTOCOL_VERSION_3:
- case PROTOCOL_VERSION_4:{
+ case PROTOCOL_VERSION_4: {
if (messageSize < PROTOCOL_HEADER_V2_SIZE) {
+ LOG4CXX_DEBUG(logger_, "Message size less " << PROTOCOL_HEADER_V2_SIZE << " bytes");
return;
}
messageId = read_be_uint32(message + 8);
}
break;
default:
+ LOG4CXX_WARN(logger_, "Unknown version:" <<
+ static_cast<int>(version));
messageId = 0;
break;
}
@@ -124,6 +133,7 @@ ProtocolPacket::ProtocolHeaderValidator::ProtocolHeaderValidator()
void ProtocolPacket::ProtocolHeaderValidator::set_max_payload_size(
const size_t max_payload_size) {
+ LOG4CXX_DEBUG(logger_, "New maximum payload size is " << max_payload_size);
max_payload_size_ = max_payload_size;
}
@@ -133,6 +143,7 @@ size_t ProtocolPacket::ProtocolHeaderValidator::max_payload_size() const {
RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
const ProtocolHeader& header) const {
+ LOG4CXX_DEBUG(logger_, "Validating header - " << header);
// expected payload size will be calculated depending
// on used protocol version
size_t payload_size = MAXIMUM_FRAME_DATA_V2_SIZE;
@@ -147,10 +158,14 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
max_payload_size_ : MAXIMUM_FRAME_DATA_V2_SIZE;
break;
default:
+ LOG4CXX_WARN(logger_, "Unknown version:" <<
+ static_cast<int>(header.version));
return RESULT_FAIL;
}
// ServiceType shall be equal 0x0 (Control), 0x07 (RPC), 0x0A (PCM), 0x0B (Video), 0x0F (Bulk)
if (ServiceTypeFromByte(header.serviceType) == kInvalidServiceType) {
+ LOG4CXX_WARN(logger_, "Invalide service type" <<
+ static_cast<int>(header.serviceType));
return RESULT_FAIL;
}
// Check frame info for each frame type
@@ -171,17 +186,23 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
case FRAME_DATA_HEART_BEAT_ACK:
break;
default:
+ LOG4CXX_WARN(logger_, "FRAME_TYPE_CONTROL - Invalide frame data " <<
+ static_cast<int>(header.frameData));
return RESULT_FAIL;
}
break;
}
case FRAME_TYPE_SINGLE:
if (header.frameData != FRAME_DATA_SINGLE) {
+ LOG4CXX_WARN(logger_, "FRAME_TYPE_SINGLE - Invalide frame data " <<
+ static_cast<int>(header.frameData));
return RESULT_FAIL;
}
break;
case FRAME_TYPE_FIRST:
if (header.frameData != FRAME_DATA_FIRST) {
+ LOG4CXX_WARN(logger_, "FRAME_TYPE_FIRST - Invalide frame data " <<
+ static_cast<int>(header.frameData));
return RESULT_FAIL;
}
break;
@@ -189,6 +210,8 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
// Could have any FrameInfo value
break;
default:
+ LOG4CXX_WARN(logger_, "Unknown frame type " <<
+ static_cast<int>(header.frameType));
// All other Frame type is invalid
return RESULT_FAIL;
}
@@ -196,12 +219,16 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
// For Single and Consecutive Data Size value shall be greater than 0x00
// and shall be less than payload size
if (header.dataSize > payload_size) {
+ LOG4CXX_WARN(logger_, "Packet data size is " << header.dataSize <<
+ " and bigger than allowed payload size " << payload_size << " bytes");
return RESULT_FAIL;
}
switch (header.frameType) {
case FRAME_TYPE_SINGLE:
case FRAME_TYPE_CONSECUTIVE:
- if (header.dataSize <= 0) {
+ if (header.dataSize <= 0u) {
+ LOG4CXX_WARN(logger_,
+ "Data size of Single and Consecutive frame shall be not equal 0 byte ");
return RESULT_FAIL;
}
break;
@@ -209,17 +236,20 @@ RESULT_CODE ProtocolPacket::ProtocolHeaderValidator::validate(
break;
}
// Message ID be equal or greater than 0x01 (not actual for 1 protocol version and Control frames)
- if (FRAME_TYPE_CONTROL != header.frameType && PROTOCOL_VERSION_1 != header.version
- && header.messageId <= 0) {
- // Message ID shall be greater than 0x00, but not implemented in SPT
- // TODO(EZamakhov): return on fix on mobile side - APPLINK-9990
- return RESULT_FAIL;
+ if (header.messageId <= 0) {
+ if (FRAME_TYPE_CONTROL != header.frameType &&
+ PROTOCOL_VERSION_1 != header.version) {
+ LOG4CXX_WARN(logger_, "Message ID shall be greater than 0x00");
+ // Message ID shall be greater than 0x00, but not implemented in SPT
+ return RESULT_FAIL;
+ }
}
+ LOG4CXX_DEBUG(logger_, "Message header is completely correct.");
return RESULT_OK;
}
ProtocolPacket::ProtocolPacket()
- : payload_size_(0), connection_id_(0) {
+ : payload_size_(0u), connection_id_(0u) {
}
ProtocolPacket::ProtocolPacket(ConnectionID connection_id,
@@ -246,6 +276,7 @@ ProtocolPacket::ProtocolPacket(ConnectionID connection_id)
// Serialization
RawMessagePtr ProtocolPacket::serializePacket() const {
+ LOG4CXX_AUTO_TRACE(logger_);
// TODO(EZamakhov): Move header serialization to ProtocolHeader
// version is low byte
const uint8_t version_byte = packet_header_.version << 4;
@@ -271,7 +302,7 @@ RawMessagePtr ProtocolPacket::serializePacket() const {
header[offset++] = packet_header_.messageId >> 16;
header[offset++] = packet_header_.messageId >> 8;
header[offset++] = packet_header_.messageId;
- };
+ }
size_t total_packet_size = offset + (packet_data_.data ? packet_data_.totalDataBytes : 0);
@@ -339,6 +370,8 @@ bool ProtocolPacket::operator==(const ProtocolPacket& other) const {
RESULT_CODE ProtocolPacket::deserializePacket(
const uint8_t *message, const size_t messageSize) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN(message, RESULT_FAIL);
packet_header_.deserialize(message, messageSize);
const uint8_t offset =
packet_header_.version == PROTOCOL_VERSION_1 ? PROTOCOL_HEADER_V1_SIZE
@@ -352,16 +385,6 @@ RESULT_CODE ProtocolPacket::deserializePacket(
dataPayloadSize = messageSize - offset;
}
- uint8_t *data = NULL;
- if (dataPayloadSize) {
- data = new (std::nothrow) uint8_t[dataPayloadSize];
- if (!data) {
- return RESULT_FAIL;
- }
- memcpy(data, message + offset, dataPayloadSize);
- payload_size_ = dataPayloadSize;
- }
-
if (packet_header_.frameType == FRAME_TYPE_FIRST) {
payload_size_ = 0;
const uint8_t *data = message + offset;
@@ -373,9 +396,12 @@ RESULT_CODE ProtocolPacket::deserializePacket(
if (0 == packet_data_.data) {
return RESULT_FAIL;
}
- } else {
+ } else if (dataPayloadSize) {
+
delete[] packet_data_.data;
- packet_data_.data = data;
+ packet_data_.data = new (std::nothrow) uint8_t[dataPayloadSize];
+ memcpy(packet_data_.data, message + offset, dataPayloadSize);
+ payload_size_ = dataPayloadSize;
}
return RESULT_OK;
@@ -405,6 +431,10 @@ uint8_t ProtocolPacket::frame_data() const {
return packet_header_.frameData;
}
+void ProtocolPacket::set_frame_data(const uint8_t frame_data) {
+ packet_header_.frameData = frame_data;
+}
+
uint8_t ProtocolPacket::session_id() const {
return packet_header_.sessionId;
}
@@ -448,7 +478,7 @@ uint32_t ProtocolPacket::total_data_bytes() const {
return packet_data_.totalDataBytes;
}
-uint8_t ProtocolPacket::connection_id() const {
+ConnectionID ProtocolPacket::connection_id() const {
return connection_id_;
}
@@ -456,5 +486,8 @@ uint32_t ProtocolPacket::payload_size() const {
return payload_size_;
}
-// End of Deserialization
+const ProtocolPacket::ProtocolHeader& ProtocolPacket::packet_header() const {
+ return packet_header_;
+}
+
} // namespace protocol_handler
diff --git a/src/components/protocol_handler/test/CMakeLists.txt b/src/components/protocol_handler/test/CMakeLists.txt
index 935ae5c475..44b609edb9 100644
--- a/src/components/protocol_handler/test/CMakeLists.txt
+++ b/src/components/protocol_handler/test/CMakeLists.txt
@@ -31,6 +31,7 @@
if(BUILD_TESTS)
include_directories(
+ include
${GMOCK_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/protocol_handler/include
${COMPONENTS_DIR}/protocol_handler/test/include
@@ -49,9 +50,10 @@ set(LIBRARIES
set(SOURCES
incoming_data_handler_test.cc
protocol_header_validator_test.cc
- #protocol_handler_tm_test.cc
+ protocol_handler_tm_test.cc
protocol_packet_test.cc
protocol_payload_test.cc
+ multiframe_builder_test.cc
)
create_test("protocol_handler_test" "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/protocol_handler/test/include/control_message_matcher.h b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
index 9239d0847f..9239d0847f 100644
--- a/src/components/protocol_handler/test/include/control_message_matcher.h
+++ b/src/components/protocol_handler/test/include/protocol_handler/control_message_matcher.h
diff --git a/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h b/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h
new file mode 100644
index 0000000000..83037c9631
--- /dev/null
+++ b/src/components/protocol_handler/test/include/protocol_handler/mock_telemetry_observer.h
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TIME_METRIC_OBSERVER_H_
+#define SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TIME_METRIC_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include "protocol_handler/time_metric_observer.h"
+#include "utils/shared_ptr.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+class MockPHTelemetryObserver : public ::protocol_handler::PHTelemetryObserver {
+ public:
+ MOCK_METHOD2(StartMessageProcess, void(uint32_t, const TimevalStruct&));
+ MOCK_METHOD2(EndMessageProcess, void(utils::SharedPtr<MessageMetric>));
+};
+
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
+
+-#endif // SRC_COMPONENTS_INCLUDE_TEST_PROTOCOL_HANDLER_MOCK_TIME_METRIC_OBSERVER_H_
diff --git a/src/components/protocol_handler/test/include/protocol_handler_mock.h b/src/components/protocol_handler/test/include/protocol_handler/protocol_handler_mock.h
index 41b7c491a4..575e82514a 100644
--- a/src/components/protocol_handler/test/include/protocol_handler_mock.h
+++ b/src/components/protocol_handler/test/include/protocol_handler/protocol_handler_mock.h
@@ -35,7 +35,8 @@
#include <gmock/gmock.h>
#include "transport_manager/transport_manager.h"
#include "protocol_handler/session_observer.h"
-#include "protocol_handler/protocol_packet.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler/protocol_handler_settings.h"
namespace test {
namespace components {
@@ -59,112 +60,12 @@ class ProtocolHandlerMock : public protocol_handler::ProtocolHandler {
void(::protocol_handler::ProtocolObserver *observer));
MOCK_METHOD2(SendFramesNumber,
void(uint32_t connection_key, int32_t number_of_frames));
- MOCK_METHOD2(SendHeartBeat,
- void(int32_t connection_id, uint8_t session_id));
- MOCK_METHOD2(SendEndSession,
- void(int32_t connection_id, uint8_t session_id));
+ MOCK_METHOD2(SendHeartBeat, void(int32_t connection_id, uint8_t session_id));
+ MOCK_METHOD2(SendEndSession, void(int32_t connection_id, uint8_t session_id));
MOCK_METHOD3(SendEndService,
void(int32_t connection_id, uint8_t session_id, uint8_t service_type));
-};
-
-/*
- * MOCK implementation of transport_manager::TransportManager interface
- */
-class TransportManagerMock : public TransportManager {
- public:
- MOCK_METHOD0(Init,
- int());
- MOCK_METHOD0(SearchDevices,
- int());
- MOCK_METHOD1(ConnectDevice,
- int(const DeviceHandle&));
- MOCK_METHOD1(DisconnectDevice,
- int(const DeviceHandle&));
- MOCK_METHOD1(Disconnect,
- int(const ConnectionUID &));
- MOCK_METHOD1(DisconnectForce,
- int(const ConnectionUID &));
- MOCK_METHOD1(SendMessageToDevice,
- int(const ::protocol_handler::RawMessagePtr));
- MOCK_METHOD1(ReceiveEventFromDevice,
- int(const TransportAdapterEvent&));
- MOCK_METHOD1(AddTransportAdapter,
- int(transport_adapter::TransportAdapter *));
- MOCK_METHOD1(AddEventListener,
- int(TransportManagerListener *));
- MOCK_METHOD0(Stop,
- int());
- MOCK_METHOD1(RemoveDevice,
- int(const DeviceHandle& ));
- MOCK_CONST_METHOD1(Visibility,
- int(const bool &));
- MOCK_METHOD0(Reinit,
- int());
-};
-
-/*
- * MOCK implementation of protocol_handler::SessionObserver interface
- */
-class SessionObserverMock : public protocol_handler::SessionObserver {
- public:
-#ifdef ENABLE_SECURITY
- MOCK_METHOD2(SetSSLContext,
- int (const uint32_t& key,
- security_manager::SSLContext* context));
- MOCK_METHOD2(GetSSLContext,
- security_manager::SSLContext* (
- const uint32_t& key,
- const protocol_handler::ServiceType& service_type));
-#endif // ENABLE_SECURITY
- MOCK_METHOD2(SetProtectionFlag,
- void(
- const uint32_t& key,
- const protocol_handler::ServiceType& service_type));
- MOCK_METHOD5(OnSessionStartedCallback,
- uint32_t(
- const transport_manager::ConnectionUID &connection_handle,
- const uint8_t session_id,
- const ::protocol_handler::ServiceType &service_type,
- const bool is_protected, uint32_t* hash_id));
- MOCK_METHOD4(OnSessionEndedCallback,
- uint32_t(
- const transport_manager::ConnectionUID& connection_handle,
- const uint8_t sessionId,
- const uint32_t& hashCode,
- const protocol_handler::ServiceType& service_type));
- MOCK_METHOD1(OnApplicationFloodCallBack,
- void(const uint32_t&));
- MOCK_METHOD1(OnMalformedMessageCallback,
- void(const uint32_t&));
- MOCK_METHOD2(KeyFromPair,
- uint32_t(
- transport_manager::ConnectionUID connection_handle,
- uint8_t sessionId));
- MOCK_METHOD3(PairFromKey,
- void(
- uint32_t key,
- transport_manager::ConnectionUID* connection_handle,
- uint8_t* sessionId));
- MOCK_METHOD4(GetDataOnSessionKey,
- int32_t(uint32_t key,
- uint32_t* app_id,
- std::list<int32_t>* sessions_list,
- uint32_t* device_id));
- MOCK_METHOD5(GetDataOnDeviceID,
- int32_t(
- uint32_t device_handle,
- std::string *device_name,
- std::list<uint32_t> *applications_list,
- std::string *mac_address,
- std::string *connection_type));
- MOCK_METHOD2(IsHeartBeatSupported,
- bool( transport_manager::ConnectionUID connection_handle,
- uint8_t session_id));
- MOCK_METHOD3(ProtocolVersionUsed,
- bool( uint32_t connection_id,
- uint8_t session_id, uint8_t& protocol_version));
- MOCK_CONST_METHOD1(GetHandshakeContext,
- security_manager::SSLContext::HandshakeContext (const uint32_t key) );
+ MOCK_CONST_METHOD0(get_settings,
+ const ::protocol_handler::ProtocolHandlerSettings&());
};
#ifdef ENABLE_SECURITY
diff --git a/src/components/protocol_handler/test/include/protocol_observer_mock.h b/src/components/protocol_handler/test/include/protocol_handler/protocol_observer_mock.h
index c415e66e40..c415e66e40 100644
--- a/src/components/protocol_handler/test/include/protocol_observer_mock.h
+++ b/src/components/protocol_handler/test/include/protocol_handler/protocol_observer_mock.h
diff --git a/src/components/protocol_handler/test/include/session_observer_mock.h b/src/components/protocol_handler/test/include/session_observer_mock.h
deleted file mode 100644
index 383ebaa161..0000000000
--- a/src/components/protocol_handler/test/include/session_observer_mock.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
-#define TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
-
-#include <gmock/gmock.h>
-#include <string>
-#include <list>
-#include "protocol_handler/session_observer.h"
-
-namespace test {
-namespace components {
-namespace protocol_handler_test {
-/*
- * MOCK implementation of ::protocol_handler::SessionObserver interface
- */
-class SessionObserverMock: public ::protocol_handler::SessionObserver {
- public:
- MOCK_METHOD5(OnSessionStartedCallback,
- uint32_t(
- const transport_manager::ConnectionUID &connection_handle,
- const uint8_t session_id,
- const ::protocol_handler::ServiceType &service_type,
- const bool is_protected, uint32_t* hash_id));
- MOCK_METHOD4(OnSessionEndedCallback,
- uint32_t(
- const transport_manager::ConnectionUID &connection_handle,
- const uint8_t sessionId,
- const uint32_t &hashCode,
- const ::protocol_handler::ServiceType &service_type));
- MOCK_METHOD1(OnApplicationFloodCallBack,
- void(const uint32_t&));
- MOCK_METHOD1(OnMalformedMessageCallback,
- void(const uint32_t&));
- MOCK_METHOD2(KeyFromPair,
- uint32_t(
- transport_manager::ConnectionUID connection_handle,
- uint8_t sessionId));
- MOCK_METHOD3(PairFromKey,
- void(
- uint32_t key,
- transport_manager::ConnectionUID *connection_handle,
- uint8_t *sessionId));
- MOCK_METHOD4(GetDataOnSessionKey,
- int32_t(uint32_t key,
- uint32_t *app_id,
- std::list<int32_t> *sessions_list,
- uint32_t *device_id));
- MOCK_METHOD5(GetDataOnDeviceID,
- int32_t(
- uint32_t device_handle,
- std::string *device_name,
- std::list<uint32_t> *applications_list,
- std::string *mac_address,
- std::string *connection_type));
- MOCK_METHOD2(IsHeartBeatSupported,
- bool(transport_manager::ConnectionUID connection_handle,
- uint8_t session_id));
- MOCK_METHOD3(ProtocolVersionUsed,
- bool ( uint32_t connection_id,
- uint8_t session_id, uint8_t& protocol_version));
-#ifdef ENABLE_SECURITY
- MOCK_METHOD2(SetSSLContext,
- int(const uint32_t &key,
- ::security_manager::SSLContext *context));
- MOCK_METHOD2(GetSSLContext,
- ::security_manager::SSLContext * (
- const uint32_t &key,
- const ::protocol_handler::ServiceType &service_type));
- MOCK_METHOD2(SetProtectionFlag,
- void(
- const uint32_t &key,
- const ::protocol_handler::ServiceType &service_type));
- MOCK_CONST_METHOD1(GetHandshakeContext,
- security_manager::SSLContext::HandshakeContext (const uint32_t key) );
-
-#endif // ENABLE_SECURITY
-};
-} // namespace protocol_handler_test
-} // namespace components
-} // namespace test
-#endif // TEST_COMPONENTS_INCLUDE_PROTOCOL_HANDLER_SESSION_OBSERVER_MOCK_H_
diff --git a/src/components/protocol_handler/test/incoming_data_handler_test.cc b/src/components/protocol_handler/test/incoming_data_handler_test.cc
index e45b11f7a1..dd30620733 100644
--- a/src/components/protocol_handler/test/incoming_data_handler_test.cc
+++ b/src/components/protocol_handler/test/incoming_data_handler_test.cc
@@ -214,12 +214,12 @@ TEST_F(IncomingDataHandlerTest, MixedPayloadData_TwoConnections) {
// TODO(EZamakhov): add validator abstraction and replace next test with check only return frames
-// Protocol version shall be from 1 to 3
-TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_Version) {
+// Protocol version shall be from 1 to 4
+TEST_F(IncomingDataHandlerTest, MalformedPacket_Version) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_versions;
malformed_versions.push_back(0);
- for (uint8_t version = PROTOCOL_VERSION_3 + 1; version <= PROTOCOL_VERSION_MAX; ++version) {
+ for (uint8_t version = PROTOCOL_VERSION_4 + 1; version <= PROTOCOL_VERSION_MAX; ++version) {
malformed_versions.push_back(version);
}
for (size_t i = 0; i < malformed_versions.size(); ++i) {
@@ -250,7 +250,7 @@ TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_Version) {
}
// ServiceType shall be equal 0x0 (Control), 0x07 (RPC), 0x0A (PCM), 0x0B (Video), 0x0F (Bulk)
-TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_ServiceType) {
+TEST_F(IncomingDataHandlerTest, MalformedPacket_ServiceType) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_serv_types;
for (uint8_t service_type = kControl + 1; service_type < kRpc; ++service_type) {
@@ -290,7 +290,7 @@ TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_ServiceType) {
}
// Frame type shall be 0x00 (Control), 0x01 (Single), 0x02 (First), 0x03 (Consecutive)
-TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_FrameType) {
+TEST_F(IncomingDataHandlerTest, MalformedPacket_FrameType) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_frame_types;
for (uint8_t frame_type = FRAME_TYPE_CONSECUTIVE + 1;
@@ -325,7 +325,7 @@ TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_FrameType) {
}
// For Control frames Frame info value shall be from 0x00 to 0x06 or 0xFE(Data Ack), 0xFF(HB Ack)
-TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_ControlFrame) {
+TEST_F(IncomingDataHandlerTest, MalformedPacket_ControlFrame) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_frame_data;
for (uint8_t frame_type = FRAME_DATA_END_SERVICE_NACK + 1;
@@ -360,7 +360,7 @@ TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_ControlFrame) {
}
// For Single and First frames Frame info value shall be equal 0x00
-TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_SingleFrame) {
+TEST_F(IncomingDataHandlerTest, MalformedPacket_SingleFrame) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_frame_data;
for (uint8_t frame_type = FRAME_DATA_SINGLE + 1;
@@ -396,7 +396,7 @@ TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_SingleFrame) {
}
// For Single and First frames Frame info value shall be equal 0x00
-TEST_F(IncomingDataHandlerTest, DISABLED_MalformedPacket_FirstFrame) {
+TEST_F(IncomingDataHandlerTest, MalformedPacket_FirstFrame) {
FrameList malformed_packets;
std::vector<uint8_t> malformed_frame_data;
for (uint8_t frame_type = FRAME_DATA_FIRST + 1;
@@ -671,7 +671,7 @@ TEST_F(IncomingDataHandlerTest, OnePortionOfData_MalformedCorrectMalformedCorrec
EXPECT_EQ(2u, actual_frames.size());
}
-TEST_F(IncomingDataHandlerTest, DISABLED_TwoPortionsOfData_CorrectMalformedANDCorrectMalformed_TwoMalformedCounted) {
+TEST_F(IncomingDataHandlerTest, TwoPortionsOfData_CorrectMalformedANDCorrectMalformed_TwoMalformedCounted) {
// Arrange
ProtocolPacket correct_hb_packet_(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_CONTROL,
kControl, FRAME_DATA_HEART_BEAT, some_session_id, 0u,
@@ -701,7 +701,7 @@ TEST_F(IncomingDataHandlerTest, DISABLED_TwoPortionsOfData_CorrectMalformedANDCo
EXPECT_EQ(1u, actual_frames.size());
}
-TEST_F(IncomingDataHandlerTest, DISABLED_TwoPortionsOfData_CorrectMalformedANDMalformedCorrect_OneMalformedCounted) {
+TEST_F(IncomingDataHandlerTest, TwoPortionsOfData_CorrectMalformedANDMalformedCorrect_OneMalformedCounted) {
// Arrange
ProtocolPacket correct_hb_packet_(uid1, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_CONTROL,
kControl, FRAME_DATA_HEART_BEAT, some_session_id, 0u,
diff --git a/src/components/protocol_handler/test/multiframe_builder_test.cc b/src/components/protocol_handler/test/multiframe_builder_test.cc
new file mode 100644
index 0000000000..d1910c18e1
--- /dev/null
+++ b/src/components/protocol_handler/test/multiframe_builder_test.cc
@@ -0,0 +1,522 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+#include <gtest/gtest.h>
+#include <vector>
+#include <utility>
+#include <limits>
+#include "utils/make_shared.h"
+#include "protocol_handler/multiframe_builder.h"
+
+namespace test {
+namespace components {
+namespace protocol_handler_test {
+
+using namespace protocol_handler;
+
+typedef std::vector<ConnectionID> ConnectionList;
+typedef std::vector<uint8_t> UCharDataVector;
+
+struct MutiframeData {
+ UCharDataVector binary_data;
+ ProtocolFramePtrList multiframes;
+};
+
+/**
+ *\brief Map of MutiframeData by MessageID key
+ */
+typedef std::map<MessageID, MutiframeData> MessageIDToMutiframeDataTestMap;
+/**
+ *\brief Map of MessageIDToMutiframeDataMap by SessionID key
+ */
+typedef std::map<SessionID, MessageIDToMutiframeDataTestMap> SessionToMutiframeDataTestMap;
+/**
+ *\brief Map of SessionToMutiframeDataMap by ConnectionID key
+ */
+typedef std::map<ConnectionID, SessionToMutiframeDataTestMap> MultiFrameTestMap;
+
+template<typename IntegerType>
+std::vector<IntegerType> getTestVector() {
+ // Prepare array with a few minimals, middle and a few maximum values
+ const IntegerType array[] = {
+ std::numeric_limits<IntegerType>::min(),
+ std::numeric_limits<IntegerType>::min() + 1,
+ std::numeric_limits<IntegerType>::max() / 2,
+ std::numeric_limits<IntegerType>::max() - 1 ,
+ std::numeric_limits<IntegerType>::max()
+ };
+ return std::vector<IntegerType>(array,
+ array + sizeof(array) / sizeof(array[0]) );
+}
+template<typename IntegerType>
+struct Incrementor {
+ IntegerType value;
+ Incrementor(const IntegerType value = 0u)
+ : value(value) {
+ }
+ IntegerType operator() () {
+ return ++value;
+ }
+};
+
+
+class MultiFrameBuilderTest : public ::testing::Test {
+ protected:
+ void SetUp() OVERRIDE {
+
+ const std::vector<ConnectionID> connections = getTestVector<ConnectionID>();
+ const std::vector<SessionID> sessions = getTestVector<SessionID>();
+ const std::vector<MessageID> messages = getTestVector<MessageID>();
+
+ MutiframeData some_data;
+
+ const uint8_t protocol_version = PROTOCOL_VERSION_2;
+ const uint8_t service_type = SERVICE_TYPE_RPC;
+
+ // We need 255+ messages for rolling over max uint8_t value
+ int multi_frames_count = std::numeric_limits<uint8_t>::max() * 2;
+
+ // Prepare C connections with S sessions with M messages data
+ for (size_t c = 0; c < connections.size(); ++c) {
+ const ConnectionID connection_id = connections[c];
+
+ SessionToMutiframeDataTestMap sessions_map;
+ for (size_t s = 0; s < sessions.size(); ++s) {
+ const SessionID session_id = sessions[s];
+
+ MessageIDToMutiframeDataTestMap messages_map;
+ for (size_t m = 0; m < messages.size(); ++m) {
+ const MessageID message_id = messages[m];
+
+ UCharDataVector& data_vector = some_data.binary_data;
+ // Sahll not be 1 consecutive frame
+ ASSERT_GT(multi_frames_count, 1);
+ data_vector.resize(++multi_frames_count * mtu_);
+
+ std::generate(data_vector.begin(), data_vector.end(), Incrementor<uint8_t>(0u));
+
+ PrepareMultiFrames(connection_id,
+ protocol_version,
+ service_type,
+ session_id,
+ message_id,
+ mtu_,
+ data_vector,
+ some_data.multiframes);
+ messages_map.insert(std::make_pair(message_id, some_data));
+ }
+ sessions_map.insert(std::make_pair(session_id, messages_map));
+ }
+ test_data_map_.insert(std::make_pair(connection_id, sessions_map));
+ }
+ }
+
+ // Support method for first and consecutive frame disassembling
+ static void PrepareMultiFrames(
+ const ConnectionID connection_id,
+ const uint8_t protocol_version,
+ const uint8_t service_type,
+ const uint8_t session_id,
+ const uint32_t message_id,
+ const size_t max_frame_size,
+ const UCharDataVector& data,
+ ProtocolFramePtrList& out_frames);
+
+ void AddConnection(const ConnectionID connection_id);
+
+ void AddConnections();
+
+ void VerifyConsecutiveAdd(const MutiframeData& multiframe_data);
+
+ MultiFrameBuilder multiframe_builder_;
+ MultiFrameTestMap test_data_map_;
+ static size_t mtu_;
+};
+
+size_t MultiFrameBuilderTest::mtu_ = 10;
+
+TEST_F(MultiFrameBuilderTest, Pop_Frames_From_Empty_builder) {
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes());
+}
+
+TEST_F(MultiFrameBuilderTest, Pop_Frames_with_existing_connections) {
+ AddConnections();
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes());
+}
+
+TEST_F(MultiFrameBuilderTest, Add_EmptyFrame) {
+ EXPECT_EQ(RESULT_FAIL,
+ multiframe_builder_.AddFrame(ProtocolFramePtr()));
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes());
+}
+
+TEST_F(MultiFrameBuilderTest, Add_NonSingleOrConsecutive_Frames) {
+ UCharDataVector types;
+ types.reserve(std::numeric_limits<uint8_t>::max());
+ for (uint8_t type = std::numeric_limits<uint8_t>::min();
+ type < std::numeric_limits<uint8_t>::max(); ++type) {
+ if (type != FRAME_TYPE_FIRST &&
+ type != FRAME_TYPE_CONSECUTIVE) {
+ types.push_back(type);
+ }
+ }
+
+ for (UCharDataVector::iterator it = types.begin(); it != types.end(); ++it) {
+ const uint8_t frame_type = *it;
+ const ProtocolFramePtr unexpected_frame(
+ new ProtocolPacket( 0u, PROTOCOL_VERSION_3, PROTECTION_OFF, frame_type,
+ SERVICE_TYPE_RPC, FRAME_DATA_FIRST, 0u, 0u, 0u));
+ EXPECT_EQ(RESULT_FAIL,
+ multiframe_builder_.AddFrame(unexpected_frame))
+ << "Unexpected frame: " << unexpected_frame;
+
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes())
+ << "Unexpected frame: " << unexpected_frame;
+ }
+}
+
+TEST_F(MultiFrameBuilderTest, Add_FirstFrames_NoConnections) {
+ for (MultiFrameTestMap::iterator connection_it = test_data_map_.begin();
+ connection_it != test_data_map_.end(); ++connection_it) {
+ SessionToMutiframeDataTestMap& session_map = connection_it->second;
+ const ConnectionID connection_id = connection_it->first;
+
+ for (SessionToMutiframeDataTestMap::iterator session_it = session_map.begin();
+ session_it != session_map.end(); ++session_it) {
+ MessageIDToMutiframeDataTestMap& messageId_map = session_it->second;
+
+ for (MessageIDToMutiframeDataTestMap::iterator messageId_it = messageId_map.begin();
+ messageId_it != messageId_map.end(); ++messageId_it) {
+ const MutiframeData& multiframe_data = messageId_it->second;
+
+ const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
+ ASSERT_FALSE(multiframes.empty());
+ const ProtocolFramePtr first_frame = multiframes.front();
+ ASSERT_TRUE(first_frame);
+ EXPECT_EQ(RESULT_FAIL,
+ multiframe_builder_.AddFrame(first_frame))
+ << "Unexisting connection " << connection_id
+ << "- to be skipped first frame: " << first_frame;
+
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes())
+ << "First frame: " << first_frame;
+ }
+ }
+ }
+}
+
+TEST_F(MultiFrameBuilderTest, Add_FirstFrames_only) {
+ AddConnections();
+ for (MultiFrameTestMap::iterator connection_it = test_data_map_.begin();
+ connection_it != test_data_map_.end(); ++connection_it) {
+ SessionToMutiframeDataTestMap& session_map = connection_it->second;
+
+ for (SessionToMutiframeDataTestMap::iterator session_it = session_map.begin();
+ session_it != session_map.end(); ++session_it) {
+ MessageIDToMutiframeDataTestMap& messageId_map = session_it->second;
+
+ for (MessageIDToMutiframeDataTestMap::iterator messageId_it = messageId_map.begin();
+ messageId_it != messageId_map.end(); ++messageId_it) {
+ const MutiframeData& multiframe_data = messageId_it->second;
+
+ const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
+ ASSERT_FALSE(multiframes.empty());
+ const ProtocolFramePtr first_frame = multiframes.front();
+ ASSERT_TRUE(first_frame);
+ EXPECT_EQ(RESULT_OK,
+ multiframe_builder_.AddFrame(first_frame))
+ << "First frame: " << first_frame;
+
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes())
+ << "First frame: " << first_frame;
+ }
+ }
+ }
+}
+
+TEST_F(MultiFrameBuilderTest, Add_ConsecutiveFrame) {
+ ASSERT_FALSE(test_data_map_.empty());
+ const ConnectionID& connection_id = test_data_map_.begin()->first;
+ SessionToMutiframeDataTestMap& session_map = test_data_map_.begin()->second;
+
+ AddConnection(connection_id);
+
+ ASSERT_FALSE(session_map.empty());
+ MessageIDToMutiframeDataTestMap& messageId_map = session_map.begin()->second;
+
+ ASSERT_FALSE(messageId_map.empty());
+ const MutiframeData& multiframe_data = messageId_map.begin()->second;
+
+ VerifyConsecutiveAdd(multiframe_data);
+}
+
+TEST_F(MultiFrameBuilderTest, Add_ConsecutiveFrames_OneByOne) {
+ AddConnections();
+ for (MultiFrameTestMap::iterator connection_it = test_data_map_.begin();
+ connection_it != test_data_map_.end(); ++connection_it) {
+ SessionToMutiframeDataTestMap& session_map = connection_it->second;
+
+ for (SessionToMutiframeDataTestMap::iterator session_it = session_map.begin();
+ session_it != session_map.end(); ++session_it) {
+ MessageIDToMutiframeDataTestMap& messageId_map = session_it->second;
+
+ for (MessageIDToMutiframeDataTestMap::iterator messageId_it = messageId_map.begin();
+ messageId_it != messageId_map.end(); ++messageId_it) {
+ const MutiframeData& multiframe_data = messageId_it->second;
+
+ VerifyConsecutiveAdd(multiframe_data);
+ }
+ }
+ }
+}
+
+TEST_F(MultiFrameBuilderTest, Add_ConsecutiveFrames_per1) {
+ AddConnections();
+ ASSERT_FALSE(test_data_map_.empty());
+ // After processing each frame we remove it from messageId_it
+ // After processing all session data - it removes from session_map
+ // and so on
+ // TODO(Ezamakhov): optimize speed of test by skipping erasing data
+ while (!test_data_map_.empty()) {
+ MultiFrameTestMap::iterator connection_it = test_data_map_.begin();
+ while (connection_it != test_data_map_.end()) {
+ SessionToMutiframeDataTestMap& session_map = connection_it->second;
+
+ SessionToMutiframeDataTestMap::iterator session_it = session_map.begin();
+ while (session_it != session_map.end()) {
+ MessageIDToMutiframeDataTestMap& messageId_map = session_it->second;
+
+ MessageIDToMutiframeDataTestMap::iterator messageId_it = messageId_map.begin();
+ while (messageId_it != messageId_map.end()) {
+
+ MutiframeData& multiframe_data = messageId_it->second;
+ ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
+ ASSERT_FALSE(multiframes.empty());
+
+ const ProtocolFramePtr frame = multiframes.front();
+ ASSERT_TRUE(frame);
+
+ EXPECT_EQ(RESULT_OK,
+ multiframe_builder_.AddFrame(frame)) << "Frame: " << frame;
+
+ multiframes.pop_front();
+
+ // If all frames are assembled
+ if (multiframes.empty()) {
+ const ProtocolFramePtrList& multiframe_list
+ = multiframe_builder_.PopMultiframes();
+ ASSERT_EQ(multiframe_list.size(), 1u);
+
+ const ProtocolFramePtr result_multiframe = multiframe_list.front();
+ const UCharDataVector& binary_data = multiframe_data.binary_data;
+ EXPECT_EQ(binary_data,
+ UCharDataVector(result_multiframe->data(),
+ result_multiframe->data() +
+ result_multiframe->payload_size()));
+ messageId_map.erase(messageId_it++);
+ } else {
+ // Multiframe is not completed
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes()) << "Frame: " << frame;
+ ++messageId_it;
+ }
+ }
+ if (messageId_map.empty()) {
+ session_map.erase(session_it++);
+ } else {
+ ++session_it;
+ }
+ }
+ if (session_map.empty()) {
+ test_data_map_.erase(connection_it++);
+ } else {
+ ++connection_it;
+ }
+ }
+ }
+}
+
+TEST_F(MultiFrameBuilderTest, FrameExpired_OneMSec) {
+ multiframe_builder_.set_waiting_timeout(1);
+
+ ASSERT_FALSE(test_data_map_.empty());
+ const ConnectionID& connection_id = test_data_map_.begin()->first;
+ SessionToMutiframeDataTestMap& session_map = test_data_map_.begin()->second;
+
+ AddConnection(connection_id);
+
+ ASSERT_FALSE(session_map.empty());
+ MessageIDToMutiframeDataTestMap& messageId_map = session_map.begin()->second;
+
+ ASSERT_FALSE(messageId_map.empty());
+ const MutiframeData& multiframe_data = messageId_map.begin()->second;
+
+ const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
+ ASSERT_FALSE(multiframes.empty());
+ const ProtocolFramePtr first_frame = multiframes.front();
+ ASSERT_TRUE(first_frame);
+ EXPECT_EQ(RESULT_OK,
+ multiframe_builder_.AddFrame(first_frame))
+ << "First frame: " << first_frame;
+
+ // Wait frame expire
+ usleep(1000);
+ const ProtocolFramePtrList& list = multiframe_builder_.PopMultiframes();
+ ASSERT_FALSE(list.empty());
+ EXPECT_EQ(first_frame,
+ list.front());
+}
+
+/*
+ * Testing support methods
+ */
+
+void MultiFrameBuilderTest::VerifyConsecutiveAdd(const MutiframeData& multiframe_data) {
+ const ProtocolFramePtrList& multiframes = multiframe_data.multiframes;
+ const UCharDataVector& binary_data = multiframe_data.binary_data;
+ ASSERT_FALSE(multiframes.empty());
+
+ // Frame of multiframe loop
+ ProtocolFramePtrList::const_iterator it = multiframes.begin();
+ // Skip last final frame
+ const ProtocolFramePtrList::const_iterator it_last = --(multiframes.end());
+ while (it != it_last) {
+ const ProtocolFramePtr frame = *it;
+ ASSERT_TRUE(frame);
+ EXPECT_EQ(RESULT_OK,
+ multiframe_builder_.AddFrame(frame))
+ << "Non final CONSECUTIVE frame: " << frame;
+ EXPECT_EQ(ProtocolFramePtrList(),
+ multiframe_builder_.PopMultiframes())
+ << "Non final CONSECUTIVE frame: " << frame;
+ ++it;
+ // Skip last final frame
+ }
+
+ const ProtocolFramePtr final_frame = multiframes.back();
+
+ EXPECT_EQ(RESULT_OK,
+ multiframe_builder_.AddFrame(final_frame))
+ << "Final CONSECUTIVE frame: " << final_frame;
+
+ const ProtocolFramePtrList& multiframe_list
+ = multiframe_builder_.PopMultiframes();
+ ASSERT_EQ(multiframe_list.size(), 1u);
+
+ const ProtocolFramePtr result_multiframe = multiframe_list.front();
+ EXPECT_EQ(binary_data,
+ UCharDataVector(result_multiframe->data(),
+ result_multiframe->data() + result_multiframe->payload_size()));
+}
+
+void MultiFrameBuilderTest::PrepareMultiFrames(const ConnectionID connection_id,
+ const uint8_t protocol_version,
+ const uint8_t service_type,
+ const uint8_t session_id,
+ const uint32_t message_id,
+ const size_t max_payload_size,
+ const UCharDataVector& data,
+ ProtocolFramePtrList& out_frames) {
+ ASSERT_GT(max_payload_size, FIRST_FRAME_DATA_SIZE);
+ ASSERT_EQ(FIRST_FRAME_DATA_SIZE, 0x08);
+
+ // TODO(EZamakhov): move to the separate class
+ const size_t data_size = data.size();
+ // remainder of last frame
+ const size_t lastframe_remainder = data_size % max_payload_size;
+ // size of last frame (full fill or not)
+ const size_t lastframe_size =
+ lastframe_remainder > 0 ? lastframe_remainder : max_payload_size;
+
+ const size_t frames_count = data_size / max_payload_size +
+ // add last frame if not empty
+ (lastframe_remainder > 0 ? 1 : 0);
+
+ uint8_t out_data[FIRST_FRAME_DATA_SIZE];
+ out_data[0] = data_size >> 24;
+ out_data[1] = data_size >> 16;
+ out_data[2] = data_size >> 8;
+ out_data[3] = data_size;
+
+ out_data[4] = frames_count >> 24;
+ out_data[5] = frames_count >> 16;
+ out_data[6] = frames_count >> 8;
+ out_data[7] = frames_count;
+
+ ProtocolFramePtr first_frame(
+ new ProtocolPacket(
+ connection_id, protocol_version, PROTECTION_OFF, FRAME_TYPE_FIRST,
+ service_type, FRAME_DATA_FIRST, session_id, FIRST_FRAME_DATA_SIZE,
+ message_id, out_data));
+ // Note: PHIMpl already prepare First frames the total_data_bytes on desirialization
+ first_frame->set_total_data_bytes(data_size);
+
+ out_frames.clear();
+ out_frames.push_back(first_frame);
+
+ for (size_t i = 0; i < frames_count; ++i) {
+ const bool is_last_frame = (i == (frames_count - 1));
+ const size_t frame_size = is_last_frame ? lastframe_size : max_payload_size;
+ const uint8_t data_type =
+ is_last_frame
+ ? FRAME_DATA_LAST_CONSECUTIVE
+ : (i % FRAME_DATA_MAX_CONSECUTIVE + 1);
+
+ const ProtocolFramePtr consecutive_frame(
+ new ProtocolPacket(
+ connection_id, protocol_version, PROTECTION_OFF, FRAME_TYPE_CONSECUTIVE,
+ service_type, data_type, session_id, frame_size, message_id,
+ &data[max_payload_size * i]));
+ out_frames.push_back(consecutive_frame);
+ }
+}
+
+void MultiFrameBuilderTest::AddConnection(const ConnectionID connection_id) {
+ ASSERT_TRUE(multiframe_builder_.AddConnection(connection_id));
+}
+
+void MultiFrameBuilderTest::AddConnections() {
+ for (MultiFrameTestMap::iterator connection_it = test_data_map_.begin();
+ connection_it != test_data_map_.end(); ++connection_it) {
+ const ConnectionID connection_id = connection_it->first;
+ ASSERT_TRUE(multiframe_builder_.AddConnection(connection_id));
+ }
+}
+
+} // namespace protocol_handler_test
+} // namespace components
+} // namespace test
diff --git a/src/components/protocol_handler/test/protocol_handler_tm_test.cc b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
index 4ef070c52f..3f04ea5564 100644
--- a/src/components/protocol_handler/test/protocol_handler_tm_test.cc
+++ b/src/components/protocol_handler/test/protocol_handler_tm_test.cc
@@ -29,32 +29,36 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
+#include "gtest/gtest.h"
#include <string>
+#include "protocol_handler/protocol_handler.h"
#include "protocol_handler/protocol_handler_impl.h"
#include "protocol/common.h"
-#include "control_message_matcher.h"
-#include "protocol_handler_mock.h"
-#include "protocol_observer_mock.h"
+#include "protocol_handler/control_message_matcher.h"
+#include "protocol_handler/protocol_handler_mock.h"
+#include "protocol_handler/protocol_observer_mock.h"
+#include "protocol_handler/mock_protocol_handler_settings.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "transport_manager/transport_manager_mock.h"
+#include "utils/make_shared.h"
namespace test {
namespace components {
namespace protocol_handler_test {
-// id passed as NULL for new session establishing
+// Id passed as NULL for new session establishing
#define NEW_SESSION_ID 0u
#define SESSION_START_REJECT 0u
using namespace ::protocol_handler;
using namespace ::transport_manager;
-// For TM states
using ::transport_manager::TransportManagerListener;
using ::testing::Return;
+using ::testing::ReturnRefOfCopy;
using ::testing::ReturnNull;
using ::testing::AnyOf;
-using ::testing::Ge;
-using ::testing::Le;
using ::testing::_;
using ::testing::Invoke;
@@ -64,13 +68,27 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const size_t period_msec, const size_t max_messages,
bool malformed_message_filtering = false,
const size_t malformd_period_msec = 0u,
- const size_t malformd_max_messages = 0u) {
- protocol_handler_impl.reset(
- new ProtocolHandlerImpl(&transport_manager_mock,
- period_msec, max_messages,
- malformed_message_filtering,
- malformd_period_msec, malformd_max_messages));
- protocol_handler_impl->set_session_observer(&session_observer_mock);
+ const size_t malformd_max_messages = 0u,
+ const int32_t multiframe_waiting_timeout = 0,
+ const size_t maximum_payload_size = 0u) {
+ ON_CALL(protocol_handler_settings_mock, maximum_payload_size())
+ .WillByDefault(Return(maximum_payload_size));
+ ON_CALL(protocol_handler_settings_mock, message_frequency_time())
+ .WillByDefault(Return(period_msec));
+ ON_CALL(protocol_handler_settings_mock, message_frequency_count())
+ .WillByDefault(Return(max_messages));
+ ON_CALL(protocol_handler_settings_mock, malformed_message_filtering())
+ .WillByDefault(Return(malformed_message_filtering));
+ ON_CALL(protocol_handler_settings_mock, malformed_frequency_time())
+ .WillByDefault(Return(malformd_period_msec));
+ ON_CALL(protocol_handler_settings_mock, malformed_frequency_count())
+ .WillByDefault(Return(malformd_max_messages));
+ ON_CALL(protocol_handler_settings_mock, multiframe_waiting_timeout())
+ .WillByDefault(Return(multiframe_waiting_timeout));
+ protocol_handler_impl.reset(new ProtocolHandlerImpl(protocol_handler_settings_mock,
+ session_observer_mock,
+ connection_handler_mock,
+ transport_manager_mock));
tm_listener = protocol_handler_impl.get();
}
void SetUp() OVERRIDE {
@@ -81,14 +99,14 @@ class ProtocolHandlerImplTest : public ::testing::Test {
message_id = 0xABCDEFu;
some_data.resize(256, 0xAB);
- // expect ConnectionHandler support methods call (conversion, check heartbeat)
+ // Expect ConnectionHandler support methods call (conversion, check heartbeat)
EXPECT_CALL(session_observer_mock,
KeyFromPair(connection_id, _)).
- //return some connection_key
+ // Return some connection_key
WillRepeatedly(Return(connection_key));
EXPECT_CALL(session_observer_mock,
IsHeartBeatSupported(connection_id, _)).
- //return false to avoid call KeepConnectionAlive
+ // Return false to avoid call KeepConnectionAlive
WillRepeatedly(Return(false));
}
@@ -114,14 +132,14 @@ class ProtocolHandlerImplTest : public ::testing::Test {
// For disabled protection callback shall ignore protection income flad and use protection OFF
const bool callback_protection_flag = PROTECTION_OFF;
#endif // ENABLE_SECURITY
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service,
callback_protection_flag, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
- // expect send Ack with PROTECTION_OFF (on no Security Manager)
+ // Expect send Ack with PROTECTION_OFF (on no Security Manager)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF)))
.WillOnce(Return(E_SUCCESS));
@@ -144,9 +162,16 @@ class ProtocolHandlerImplTest : public ::testing::Test {
const ProtocolPacket packet(connection_id, version, protection, frameType,
serviceType, frameData, sessionId, dataSize,
messageID, data);
- // Emulate resive packet from transoprt manager
+ // Emulate receive packet from transoprt manager
tm_listener->OnTMMessageReceived(packet.serializePacket());
}
+
+ void SetProtocolVersion2() {
+ // Set protocol version 2
+ ON_CALL(protocol_handler_settings_mock, max_supported_protocol_version())
+ .WillByDefault(Return(PROTOCOL_VERSION_2));
+ }
+
void SendControlMessage(bool protection, uint8_t service_type,
uint8_t sessionId, uint32_t frame_data,
uint32_t dataSize = 0u, const uint8_t *data = NULL) {
@@ -155,19 +180,21 @@ class ProtocolHandlerImplTest : public ::testing::Test {
dataSize, message_id, data);
}
+ testing::NiceMock<MockProtocolHandlerSettings> protocol_handler_settings_mock;
::utils::SharedPtr<ProtocolHandlerImpl> protocol_handler_impl;
TransportManagerListener* tm_listener;
// Uniq connection
::transport_manager::ConnectionUID connection_id;
- // id of established session
+ // Id of established session
uint8_t session_id;
- // uniq id as connection_id and session_id in one
+ // Uniq id as connection_id and session_id in one
uint32_t connection_key;
uint32_t message_id;
std::vector<uint8_t> some_data;
// Strict mocks (same as all methods EXPECT_CALL().Times(0))
- testing::StrictMock<protocol_handler_test::TransportManagerMock> transport_manager_mock;
- testing::StrictMock<protocol_handler_test::SessionObserverMock> session_observer_mock;
+ testing::NiceMock<connection_handler_test::MockConnectionHandler> connection_handler_mock;
+ testing::StrictMock<transport_manager_test::MockTransportManager> transport_manager_mock;
+ testing::StrictMock<protocol_handler_test::MockSessionObserver> session_observer_mock;
#ifdef ENABLE_SECURITY
testing::NiceMock<protocol_handler_test::SecurityManagerMock> security_manager_mock;
testing::NiceMock<protocol_handler_test::SSLContextMock> ssl_context_mock;
@@ -213,15 +240,15 @@ TEST_F(ProtocolHandlerImplTest, RecieveOnUnknownConnection) {
TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverReject) {
const int call_times = 5;
AddConnection();
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(
connection_id, NEW_SESSION_ID, AnyOf(kControl, kRpc, kAudio,
kMobileNav, kBulk), PROTECTION_OFF, _)).Times(call_times).
- //return sessions start rejection
+ // Return sessions start rejection
WillRepeatedly(Return(SESSION_START_REJECT));
- // expect send NAck
+ // Expect send NAck
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, PROTECTION_OFF)))
.Times(call_times).WillRepeatedly(Return(E_SUCCESS));
@@ -249,19 +276,19 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
// For enabled protection callback shall use protection ON
const bool callback_protection_flag = PROTECTION_ON;
#else
- // For disabled protection callback shall ignore protection income flad and use protection OFF
+ // For disabled protection callback shall ignore protection income flag and use protection OFF
const bool callback_protection_flag = PROTECTION_OFF;
#endif // ENABLE_SECURITY
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(
connection_id, NEW_SESSION_ID, AnyOf(kControl, kRpc, kAudio,
kMobileNav, kBulk), callback_protection_flag, _)).Times(
call_times).
- //return sessions start rejection
+ // Return sessions start rejection
WillRepeatedly(Return(SESSION_START_REJECT));
- // expect send NAck with encryption OFF
+ // Expect send NAck with encryption OFF
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_NACK, PROTECTION_OFF)))
.Times(call_times).WillRepeatedly(Return(E_SUCCESS));
@@ -284,14 +311,15 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverReject) {
TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverAccept) {
AddConnection();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF, _))
.
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
- // expect send Ack
+ SetProtocolVersion2();
+ // Expect send Ack
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF)))
.WillOnce(Return(E_SUCCESS));
@@ -305,6 +333,7 @@ TEST_F(ProtocolHandlerImplTest, StartSession_Unprotected_SessionObserverAccept)
* For ENABLE_SECURITY=OFF session_observer shall be called with protection flag OFF
*/
TEST_F(ProtocolHandlerImplTest, StartSession_Protected_SessionObserverAccept) {
+ SetProtocolVersion2();
AddSession();
}
// TODO(EZamakhov): add test for get_hash_id/set_hash_id from protocol_handler_impl.cc
@@ -315,13 +344,14 @@ TEST_F(ProtocolHandlerImplTest, EndSession_SessionObserverReject) {
AddSession();
const ServiceType service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionEndedCallback(connection_id, session_id, _, service)).
// reject session start
WillOnce(Return(SESSION_START_REJECT));
- // expect send NAck
+ SetProtocolVersion2();
+ // Expect send NAck
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_NACK, PROTECTION_OFF)))
.WillOnce(Return(E_SUCCESS));
@@ -336,13 +366,14 @@ TEST_F(ProtocolHandlerImplTest, EndSession_Success) {
AddSession();
const ServiceType service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionEndedCallback(connection_id, session_id, _, service)).
// return sessions start success
WillOnce(Return(connection_key));
- // expect send Ack
+ SetProtocolVersion2();
+ // Expect send Ack
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_END_SERVICE_ACK, PROTECTION_OFF)))
.WillOnce(Return(E_SUCCESS));
@@ -361,13 +392,14 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtocoloV1) {
// Add security manager
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
- // expect send Ack with PROTECTION_OFF (on no Security Manager)
+ SetProtocolVersion2();
+ // Expect send Ack with PROTECTION_OFF (on no Security Manager)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))).
WillOnce(Return(E_SUCCESS));
@@ -383,13 +415,14 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionUnprotected) {
// Add security manager
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_OFF, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
- // expect send Ack with PROTECTION_OFF (on no Security Manager)
+ SetProtocolVersion2();
+ // Expect send Ack with PROTECTION_OFF (on no Security Manager)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))).
WillOnce(Return(E_SUCCESS));
@@ -403,19 +436,20 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_Fail) {
AddConnection();
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
- // expect start protection for unprotected session
+ SetProtocolVersion2();
+ // Expect start protection for unprotected session
EXPECT_CALL(security_manager_mock,
CreateSSLContext(connection_key)).
- //return fail protection
+ // Return fail protection
WillOnce(ReturnNull());
- // expect send Ack with PROTECTION_OFF (on fail SLL creation)
+ // Expect send Ack with PROTECTION_OFF (on fail SLL creation)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))).
WillOnce(Return(E_SUCCESS));
@@ -429,19 +463,20 @@ TEST_F(ProtocolHandlerImplTest,SecurityEnable_StartSessionProtected_SSLInitializ
AddConnection();
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
+ SetProtocolVersion2();
// call new SSLContext creation
EXPECT_CALL(security_manager_mock,
CreateSSLContext(connection_key)).
- //return new SSLContext
+ // Return new SSLContext
WillOnce(Return(&ssl_context_mock));
- // initilization check
+ // Initilization check
EXPECT_CALL(ssl_context_mock,
IsInitCompleted()).
//emulate SSL is initilized
@@ -451,7 +486,7 @@ TEST_F(ProtocolHandlerImplTest,SecurityEnable_StartSessionProtected_SSLInitializ
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service));
- // expect send Ack with PROTECTION_ON (on SSL is initilized)
+ // Expect send Ack with PROTECTION_ON (on SSL is initilized)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))).
WillOnce(Return(E_SUCCESS));
@@ -465,19 +500,26 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeFa
AddConnection();
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
+ std::vector<int> services;
+ // TODO(AKutsan) : APPLINK-21398 use named constants instead of magic numbers
+ services.push_back(0x0A);
+ services.push_back(0x0B);
+ ON_CALL(protocol_handler_settings_mock, force_protected_service())
+ .WillByDefault(ReturnRefOfCopy(services));
+
// call new SSLContext creation
EXPECT_CALL(security_manager_mock,
CreateSSLContext(connection_key)).
- //return new SSLContext
+ // Return new SSLContext
WillOnce(Return(&ssl_context_mock));
- // initilization check
+ // Initilization check
EXPECT_CALL(ssl_context_mock,
IsInitCompleted()).
//emulate SSL is not initilized
@@ -489,10 +531,10 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeFa
//emulate is pending
WillOnce(Return(true));
- // expect add listener for handshake result
+ // Expect add listener for handshake result
EXPECT_CALL(security_manager_mock,
AddListener(_))
- // emulate handshake fail
+ // Emulate handshake fail
.WillOnce(Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Fail)));
@@ -500,10 +542,10 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeFa
// Listener check SSLContext
EXPECT_CALL(session_observer_mock,
GetSSLContext(connection_key, start_service)).
- // emulate protection for service is not enabled
+ // Emulate protection for service is not enabled
WillOnce(ReturnNull());
- // expect send Ack with PROTECTION_OFF (on fail handshake)
+ // Expect send Ack with PROTECTION_OFF (on fail handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_OFF))).
WillOnce(Return(E_SUCCESS));
@@ -517,19 +559,25 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSu
AddConnection();
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+
+ // No services are protected
+ std::vector<int> services;
+ ON_CALL(protocol_handler_settings_mock, force_protected_service())
+ .WillByDefault(ReturnRefOfCopy(services));
+
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
// call new SSLContext creation
EXPECT_CALL(security_manager_mock,
CreateSSLContext(connection_key)).
- //return new SSLContext
+ // Return new SSLContext
WillOnce(Return(&ssl_context_mock));
- // initilization check
+ // Initilization check
EXPECT_CALL(ssl_context_mock,
IsInitCompleted()).
//emulate SSL is not initilized
@@ -541,10 +589,10 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSu
//emulate is pending
WillOnce(Return(true));
- // expect add listener for handshake result
+ // Expect add listener for handshake result
EXPECT_CALL(security_manager_mock,
AddListener(_))
- // emulate handshake fail
+ // Emulate handshake fail
.WillOnce(Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Success)));
@@ -552,14 +600,14 @@ TEST_F(ProtocolHandlerImplTest, SecurityEnable_StartSessionProtected_HandshakeSu
// Listener check SSLContext
EXPECT_CALL(session_observer_mock,
GetSSLContext(connection_key, start_service)).
- // emulate protection for service is not enabled
+ // Emulate protection for service is not enabled
WillOnce(ReturnNull());
// Expect service protection enable
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service));
- // expect send Ack with PROTECTION_OFF (on fail handshake)
+ // Expect send Ack with PROTECTION_OFF (on fail handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))).
WillOnce(Return(E_SUCCESS));
@@ -574,19 +622,24 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+
+ std::vector<int> services;
+ ON_CALL(protocol_handler_settings_mock, force_protected_service())
+ .WillByDefault(ReturnRefOfCopy(services));
+
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
// call new SSLContext creation
EXPECT_CALL(security_manager_mock,
CreateSSLContext(connection_key)).
- //return new SSLContext
+ // Return new SSLContext
WillOnce(Return(&ssl_context_mock));
- // initilization check
+ // Initilization check
EXPECT_CALL(ssl_context_mock,
IsInitCompleted()).
//emulate SSL is not initilized
@@ -598,10 +651,10 @@ TEST_F(ProtocolHandlerImplTest,
//emulate is pending
WillOnce(Return(true));
- // expect add listener for handshake result
+ // Expect add listener for handshake result
EXPECT_CALL(security_manager_mock,
AddListener(_))
- // emulate handshake fail
+ // Emulate handshake fail
.WillOnce(Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Success)));
@@ -609,14 +662,14 @@ TEST_F(ProtocolHandlerImplTest,
// Listener check SSLContext
EXPECT_CALL(session_observer_mock,
GetSSLContext(connection_key, start_service)).
- // emulate protection for service is not enabled
+ // Emulate protection for service is not enabled
WillOnce(ReturnNull());
// Expect service protection enable
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service));
- // expect send Ack with PROTECTION_OFF (on fail handshake)
+ // Expect send Ack with PROTECTION_OFF (on fail handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))).
WillOnce(Return(E_SUCCESS));
@@ -631,19 +684,24 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSecurityManager();
const ServiceType start_service = kRpc;
- // expect ConnectionHandler check
+
+ std::vector<int> services;
+ ON_CALL(protocol_handler_settings_mock, force_protected_service())
+ .WillByDefault(ReturnRefOfCopy(services));
+
+ // Expect ConnectionHandler check
EXPECT_CALL(session_observer_mock,
OnSessionStartedCallback(connection_id, NEW_SESSION_ID, start_service, PROTECTION_ON, _)).
- //return sessions start success
+ // Return sessions start success
WillOnce(Return(session_id));
// call new SSLContext creation
EXPECT_CALL(security_manager_mock,
CreateSSLContext(connection_key)).
- //return new SSLContext
+ // Return new SSLContext
WillOnce(Return(&ssl_context_mock));
- // initilization check
+ // Initilization check
EXPECT_CALL(ssl_context_mock,
IsInitCompleted()).
//emulate SSL is not initilized
@@ -659,10 +717,10 @@ TEST_F(ProtocolHandlerImplTest,
EXPECT_CALL(security_manager_mock,
StartHandshake(connection_key));
- // expect add listener for handshake result
+ // Expect add listener for handshake result
EXPECT_CALL(security_manager_mock,
AddListener(_))
- // emulate handshake fail
+ // Emulate handshake fail
.WillOnce(Invoke(OnHandshakeDoneFunctor(
connection_key,
security_manager::SSLContext::Handshake_Result_Success)));
@@ -670,14 +728,14 @@ TEST_F(ProtocolHandlerImplTest,
// Listener check SSLContext
EXPECT_CALL(session_observer_mock,
GetSSLContext(connection_key, start_service)).
- // emulate protection for service is not enabled
+ // Emulate protection for service is not enabled
WillOnce(ReturnNull());
// Expect service protection enable
EXPECT_CALL(session_observer_mock,
SetProtectionFlag(connection_key, start_service));
- // expect send Ack with PROTECTION_OFF (on fail handshake)
+ // Expect send Ack with PROTECTION_OFF (on fail handshake)
EXPECT_CALL(transport_manager_mock,
SendMessageToDevice(ControlMessage(FRAME_DATA_START_SERVICE_ACK, PROTECTION_ON))).
WillOnce(Return(E_SUCCESS));
@@ -694,11 +752,16 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect flood notification to CH
+ // Expect flood notification to CH
EXPECT_CALL(session_observer_mock,
OnApplicationFloodCallBack(connection_key)).
Times(1);
+ ON_CALL(protocol_handler_settings_mock, message_frequency_time())
+ .WillByDefault(Return(period_msec));
+ ON_CALL(protocol_handler_settings_mock, message_frequency_count())
+ .WillByDefault(Return(max_messages));
+
for (size_t i = 0; i < max_messages + 1; ++i) {
SendTMMessage(connection_id, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE,
kControl, FRAME_DATA_SINGLE, session_id,
@@ -713,7 +776,14 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect NO flood notification to CH
+ ON_CALL(protocol_handler_settings_mock, message_frequency_time())
+ .WillByDefault(Return(period_msec));
+ ON_CALL(protocol_handler_settings_mock, message_frequency_count())
+ .WillByDefault(Return(max_messages));
+
+ // Expect NO flood notification to CH
+ EXPECT_CALL(session_observer_mock, OnApplicationFloodCallBack(connection_key))
+ .Times(0);
for (size_t i = 0; i < max_messages - 1; ++i) {
SendTMMessage(connection_id, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE,
kControl, FRAME_DATA_SINGLE, session_id,
@@ -728,7 +798,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect NO flood notification to CH on video data streaming
+ // Expect NO flood notification to CH on video data streaming
for (size_t i = 0; i < max_messages + 1; ++i) {
SendTMMessage(connection_id, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE,
kMobileNav, FRAME_DATA_SINGLE, session_id,
@@ -743,7 +813,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect NO flood notification to CH on video data streaming
+ // Expect NO flood notification to CH on video data streaming
for (size_t i = 0; i < max_messages + 1; ++i) {
SendTMMessage(connection_id, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE,
kAudio, FRAME_DATA_SINGLE, session_id,
@@ -758,7 +828,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect NO flood notification to session observer
+ // Expect NO flood notification to session observer
for (size_t i = 0; i < max_messages + 1; ++i) {
SendTMMessage(connection_id, PROTOCOL_VERSION_3, PROTECTION_OFF, FRAME_TYPE_SINGLE,
kControl, FRAME_DATA_SINGLE, session_id,
@@ -775,7 +845,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect malformed notification to CH
+ // Expect malformed notification to CH
EXPECT_CALL(session_observer_mock,
OnMalformedMessageCallback(connection_id)).
Times(max_messages);
@@ -796,7 +866,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect malformed notification to CH
+ // Expect malformed notification to CH
EXPECT_CALL(session_observer_mock,
OnMalformedMessageCallback(connection_id)).
Times(1);
@@ -823,7 +893,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect malformed notification to CH
+ // Expect malformed notification to CH
EXPECT_CALL(session_observer_mock,
OnMalformedMessageCallback(connection_id)).
Times(1);
@@ -861,7 +931,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect NO malformed notification to CH
+ // Expect NO malformed notification to CH
EXPECT_CALL(session_observer_mock,
OnMalformedMessageCallback(connection_id)).
Times(0);
@@ -896,7 +966,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect no malformed notification to CH
+ // Expect no malformed notification to CH
EXPECT_CALL(session_observer_mock,
OnMalformedMessageCallback(connection_id)).
Times(0);
@@ -917,7 +987,7 @@ TEST_F(ProtocolHandlerImplTest,
AddConnection();
AddSession();
- // expect no malformed notification to CH
+ // Expect no malformed notification to CH
EXPECT_CALL(session_observer_mock,
OnMalformedMessageCallback(connection_id)).
Times(0);
diff --git a/src/components/protocol_handler/test/protocol_header_validator_test.cc b/src/components/protocol_handler/test/protocol_header_validator_test.cc
index 0f38ae98ab..a229e96e79 100644
--- a/src/components/protocol_handler/test/protocol_header_validator_test.cc
+++ b/src/components/protocol_handler/test/protocol_header_validator_test.cc
@@ -67,7 +67,7 @@ TEST_F(ProtocolHeaderValidatorTest, MaxPayloadSizeSetGet) {
}
}
-// Protocol version shall be from 1 to 3
+// Protocol version shall be from 1 to 4
TEST_F(ProtocolHeaderValidatorTest, Malformed_Version) {
std::vector<uint8_t> malformed_versions;
malformed_versions.push_back(0);
diff --git a/src/components/resumption/src/last_state.cc b/src/components/resumption/src/last_state.cc
index 7d609fe84f..4c1bc440b4 100644
--- a/src/components/resumption/src/last_state.cc
+++ b/src/components/resumption/src/last_state.cc
@@ -37,7 +37,7 @@
namespace resumption {
-CREATE_LOGGERPTR_GLOBAL(logger_, "LastState");
+CREATE_LOGGERPTR_GLOBAL(logger_, "Resumption")
void LastState::SaveToFileSystem() {
LOG4CXX_AUTO_TRACE(logger_);
@@ -76,7 +76,7 @@ LastState::LastState() {
}
LastState::~LastState() {
- SaveToFileSystem();
+
}
}
diff --git a/src/components/resumption/test/CMakeLists.txt b/src/components/resumption/test/CMakeLists.txt
index c7b7f52db7..6fa1c07381 100644
--- a/src/components/resumption/test/CMakeLists.txt
+++ b/src/components/resumption/test/CMakeLists.txt
@@ -47,6 +47,7 @@ set(LIBRARIES
Utils
Resumption
jsoncpp
+ ConfigProfile
)
set(SOURCES
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base.h b/src/components/rpc_base/include/rpc_base/rpc_base.h
index 019f7edc0e..da0a7f2388 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base.h
@@ -229,10 +229,10 @@ class String : public PrimitiveType {
explicit String(const Json::Value* value);
explicit String(dbus::MessageReader* reader);
String(const Json::Value* value, const std::string& def_value);
- bool operator<(String new_val);
+ bool operator<(const String& new_val) const;
String& operator=(const std::string& new_val);
String& operator=(const String& new_val);
- bool operator==(const String& rhs);
+ bool operator==(const String& rhs) const;
operator const std::string& () const;
Json::Value ToJsonValue() const;
void ToDbusWriter(dbus::MessageWriter* writer) const;
@@ -254,7 +254,7 @@ class Enum : public PrimitiveType {
explicit Enum(const Json::Value* value);
explicit Enum(dbus::MessageReader* reader);
Enum(const Json::Value* value, EnumType def_value);
- Enum& operator=(EnumType new_val);
+ Enum& operator=(const EnumType& new_val);
operator EnumType() const;
Json::Value ToJsonValue() const;
void ToDbusWriter(dbus::MessageWriter* writer) const;
diff --git a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
index 2241a4707b..eb374188c3 100644
--- a/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
+++ b/src/components/rpc_base/include/rpc_base/rpc_base_inl.h
@@ -187,7 +187,10 @@ Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator=(IntType new_va
template<typename T, T minval, T maxval>
Integer<T, minval, maxval>& Integer<T, minval, maxval>::operator=(const Integer& new_val) {
this->value_ = new_val.value_;
- this->value_state_= range_.Includes(new_val.value_) ? kValid : kInvalid;
+ if (new_val.is_initialized()) {
+ this->value_state_= range_.Includes(new_val.value_) ? kValid : kInvalid;
+ }
+
return *this;
}
@@ -266,7 +269,7 @@ String<minlen, maxlen>::String(const char* value)
}
template<size_t minlen, size_t maxlen>
-bool String<minlen, maxlen>::operator<(String new_val) {
+bool String<minlen, maxlen>::operator<(const String& new_val) const {
return value_ < new_val.value_;
}
@@ -279,13 +282,16 @@ String<minlen, maxlen>& String<minlen, maxlen>::operator=(const std::string& new
template<size_t minlen, size_t maxlen>
String<minlen, maxlen>& String<minlen, maxlen>::operator=(const String& new_val) {
+ if(*this == new_val) {
+ return *this;
+ }
value_.assign(new_val.value_);
value_state_ = new_val.value_state_;
return *this;
}
template<size_t minlen, size_t maxlen>
-bool String<minlen, maxlen>::operator==(const String& rhs) {
+bool String<minlen, maxlen>::operator==(const String& rhs) const {
return value_ == rhs.value_;
}
@@ -310,7 +316,7 @@ Enum<T>::Enum(EnumType value)
}
template<typename T>
-Enum<T>& Enum<T>::operator=(EnumType new_val) {
+Enum<T>& Enum<T>::operator=(const EnumType& new_val) {
value_ = new_val;
value_state_ = IsValidEnum(value_) ? kValid : kInvalid;
return *this;
diff --git a/src/components/security_manager/CMakeLists.txt b/src/components/security_manager/CMakeLists.txt
index 6973a98e07..3cc6178931 100644
--- a/src/components/security_manager/CMakeLists.txt
+++ b/src/components/security_manager/CMakeLists.txt
@@ -33,7 +33,9 @@ include_directories(
include/
${COMPONENTS_DIR}/protocol_handler/include/
${COMPONENTS_DIR}/connection_handler/include
+ ${COMPONENTS_DIR}/config_profile/include/
${COMPONENTS_DIR}/utils/include/
+ ${COMPONENTS_DIR}/application_manager/include/
${JSONCPP_INCLUDE_DIRECTORY}
${CMAKE_SOURCE_DIR}/src/thirdPartyLibs/jsoncpp/include
${APR_INCLUDE_DIRECTORY}
@@ -51,4 +53,4 @@ target_link_libraries(SecurityManager crypto ssl ProtocolHandler jsoncpp Protoco
if(BUILD_TESTS)
add_subdirectory(test)
-endif() \ No newline at end of file
+endif()
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_impl.h
index 43bb63ef67..ab9bcf9ad6 100644
--- a/src/components/security_manager/include/security_manager/crypto_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/crypto_manager_impl.h
@@ -42,34 +42,51 @@
#include "security_manager/crypto_manager.h"
#include "security_manager/ssl_context.h"
+#include "security_manager/security_manager_settings.h"
+
#include "utils/macro.h"
#include "utils/lock.h"
+#include "utils/shared_ptr.h"
namespace security_manager {
class CryptoManagerImpl : public CryptoManager {
private:
class SSLContextImpl : public SSLContext {
public:
- SSLContextImpl(SSL *conn, Mode mode);
+ SSLContextImpl(SSL *conn, Mode mode, size_t maximum_payload_size);
+ ~SSLContextImpl();
virtual HandshakeResult StartHandshake(const uint8_t** const out_data,
size_t *out_data_size);
virtual HandshakeResult DoHandshakeStep(const uint8_t *const in_data,
size_t in_data_size,
const uint8_t** const out_data,
- size_t *out_data_size);
- virtual bool Encrypt(const uint8_t *const in_data, size_t in_data_size,
- const uint8_t ** const out_data, size_t *out_data_size);
- virtual bool Decrypt(const uint8_t *const in_data, size_t in_data_size,
- const uint8_t ** const out_data, size_t *out_data_size);
- virtual bool IsInitCompleted() const;
- virtual bool IsHandshakePending() const;
- virtual size_t get_max_block_size(size_t mtu) const;
- virtual std::string LastError() const;
- virtual ~SSLContextImpl();
+ size_t *out_data_size) OVERRIDE;
+ bool Encrypt(const uint8_t *const in_data, size_t in_data_size,
+ const uint8_t ** const out_data, size_t *out_data_size) OVERRIDE;
+ bool Decrypt(const uint8_t *const in_data, size_t in_data_size,
+ const uint8_t ** const out_data, size_t *out_data_size) OVERRIDE;
+ bool IsInitCompleted() const OVERRIDE;
+ bool IsHandshakePending() const OVERRIDE;
+ size_t get_max_block_size(size_t mtu) const OVERRIDE;
+ std::string LastError() const OVERRIDE;
+ void ResetConnection() OVERRIDE;
+ void SetHandshakeContext(const HandshakeContext& hsh_ctx) OVERRIDE;
- private:
+ void PrintCertData(X509* cert, const std::string& cert_owner);
+ private:
+ void PrintCertInfo();
+ HandshakeResult CheckCertContext();
+ bool ReadHandshakeData(const uint8_t** const out_data,
+ size_t* out_data_size);
+ bool WriteHandshakeData(const uint8_t* const in_data, size_t in_data_size);
+ HandshakeResult PerformHandshake();
typedef size_t(*BlockSizeGetter)(size_t);
void EnsureBufferSizeEnough(size_t size);
+ void SetHandshakeError(const int error);
+ HandshakeResult openssl_error_convert_to_internal(const long error);
+
+ std::string GetTextBy(X509_NAME* name, int object) const;
+
SSL *connection_;
BIO *bioIn_;
BIO *bioOut_;
@@ -79,29 +96,38 @@ class CryptoManagerImpl : public CryptoManager {
uint8_t *buffer_;
bool is_handshake_pending_;
Mode mode_;
+ mutable std::string last_error_;
BlockSizeGetter max_block_size_;
static std::map<std::string, BlockSizeGetter> max_block_sizes;
static std::map<std::string, BlockSizeGetter> create_max_block_sizes();
+ HandshakeContext hsh_context_;
DISALLOW_COPY_AND_ASSIGN(SSLContextImpl);
};
public:
- CryptoManagerImpl();
- virtual bool Init(Mode mode,
- Protocol protocol,
- const std::string &cert_filename,
- const std::string &key_filename,
- const std::string &ciphers_list,
- bool verify_peer);
- virtual void Finish();
- virtual SSLContext *CreateSSLContext();
- virtual void ReleaseSSLContext(SSLContext *context);
- virtual std::string LastError() const;
+ explicit CryptoManagerImpl(
+ const utils::SharedPtr<const CryptoManagerSettings> set);
+ ~CryptoManagerImpl();
- private:
+ bool Init() OVERRIDE;
+ bool OnCertificateUpdated(const std::string &data) OVERRIDE;
+ SSLContext *CreateSSLContext() OVERRIDE;
+ void ReleaseSSLContext(SSLContext *context) OVERRIDE;
+ std::string LastError() const OVERRIDE;
+ virtual bool IsCertificateUpdateRequired() const OVERRIDE;
+ virtual const CryptoManagerSettings& get_settings() const OVERRIDE;
+
+private:
+ bool set_certificate(const std::string &cert_data);
+
+ int pull_number_from_buf(char* buf, int* idx);
+ void asn1_time_to_tm(ASN1_TIME* time);
+
+ const utils::SharedPtr<const CryptoManagerSettings> settings_;
SSL_CTX *context_;
- Mode mode_;
+ mutable struct tm expiration_time_;
static uint32_t instance_count_;
+ static sync_primitives::Lock instance_lock_;
DISALLOW_COPY_AND_ASSIGN(CryptoManagerImpl);
};
} // namespace security_manager
diff --git a/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
new file mode 100644
index 0000000000..0e359f201d
--- /dev/null
+++ b/src/components/security_manager/include/security_manager/crypto_manager_settings_impl.h
@@ -0,0 +1,66 @@
+
+#ifndef SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_SETTINGS_IMPL_H_
+#define SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_SETTINGS_IMPL_H_
+#include "security_manager/security_manager_settings.h"
+#include "config_profile/profile.h"
+
+namespace security_manager {
+
+class CryptoManagerSettingsImpl : public CryptoManagerSettings {
+ public:
+ CryptoManagerSettingsImpl(const profile::Profile& profile,
+ const std::string& certificate_data)
+ : profile_(profile), certificate_data_(certificate_data) {}
+
+ // CryptoManagerSettings interface
+ Mode security_manager_mode() const OVERRIDE {
+ return profile_.ssl_mode() == "SERVER" ? security_manager::SERVER
+ : security_manager::CLIENT;
+ }
+ Protocol security_manager_protocol_name() const OVERRIDE {
+ CREATE_LOGGERPTR_LOCAL(logger_, "SecurityManager")
+
+ const std::string& protocol_str = profile_.security_manager_protocol_name();
+ if (protocol_str == "TLSv1.0") {
+ return security_manager::TLSv1;
+ }
+ if (protocol_str == "TLSv1.1") {
+ return security_manager::TLSv1_1;
+ }
+ if (protocol_str == "TLSv1.2") {
+ return security_manager::TLSv1_2;
+ }
+ if (protocol_str == "SSLv3") {
+ return security_manager::SSLv3;
+ }
+ LOG4CXX_ERROR(
+ logger_,
+ "Unknown protocol: " << profile::Profile::instance()
+ ->security_manager_protocol_name());
+ return static_cast<security_manager::Protocol>(-1);
+ }
+ bool verify_peer() const OVERRIDE {
+ return profile_.verify_peer();
+ }
+ const std::string& certificate_data() const OVERRIDE {
+ return certificate_data_;
+ }
+ const std::string& ciphers_list() const OVERRIDE {
+ return profile_.ciphers_list();
+ }
+ const std::string& ca_cert_path() const OVERRIDE {
+ return profile_.ca_cert_path();
+ }
+ size_t update_before_hours() const OVERRIDE {
+ return profile_.update_before_hours();
+ }
+ size_t maximum_payload_size() const OVERRIDE {
+ return profile_.maximum_payload_size();
+ }
+
+ private:
+ const profile::Profile& profile_;
+ const std::string certificate_data_;
+};
+}
+#endif // SRC_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_CRYPTO_MANAGER_SETTINGS_IMPL_H_
diff --git a/src/components/security_manager/include/security_manager/security_manager_impl.h b/src/components/security_manager/include/security_manager/security_manager_impl.h
index 2aa03087eb..329d84b3ca 100644
--- a/src/components/security_manager/include/security_manager/security_manager_impl.h
+++ b/src/components/security_manager/include/security_manager/security_manager_impl.h
@@ -52,6 +52,7 @@ namespace security_manager {
* for thread working
*/
struct SecurityMessage: public SecurityQueryPtr {
+ SecurityMessage() {}
explicit SecurityMessage(const SecurityQueryPtr &message)
: SecurityQueryPtr(message) {}
// PrioritizedQueue requires this method to decide which priority to assign
@@ -148,7 +149,14 @@ class SecurityManagerImpl
* \param success result of connection protection
*/
void NotifyListenersOnHandshakeDone(const uint32_t &connection_key,
- const bool success);
+ SSLContext::HandshakeResult error);
+
+ /**
+ * @brief Notifiers for listeners.
+ * Allows to notify that certificate should be updated
+ */
+ void NotifyOnCertififcateUpdateRequired();
+
/**
* @brief SecurityConfigSection
* @return Session name in config file
diff --git a/src/components/security_manager/src/crypto_manager_impl.cc b/src/components/security_manager/src/crypto_manager_impl.cc
index 69121a7b19..34b005a51c 100644
--- a/src/components/security_manager/src/crypto_manager_impl.cc
+++ b/src/components/security_manager/src/crypto_manager_impl.cc
@@ -31,47 +31,107 @@
*/
#include "security_manager/crypto_manager_impl.h"
+
#include <openssl/bio.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
+#include <openssl/pkcs12.h>
+
+#include <fstream>
+#include <iostream>
+#include <stdio.h>
#include "security_manager/security_manager.h"
+
#include "utils/logger.h"
#include "utils/atomic.h"
+#include "utils/macro.h"
+#include "utils/scope_guard.h"
#define TLS1_1_MINIMAL_VERSION 0x1000103fL
#define CONST_SSL_METHOD_MINIMAL_VERSION 0x00909000L
namespace security_manager {
-CREATE_LOGGERPTR_GLOBAL(logger_, "CryptoManagerImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager")
uint32_t CryptoManagerImpl::instance_count_ = 0;
+sync_primitives::Lock CryptoManagerImpl::instance_lock_;
+
+namespace {
+ int debug_callback(int preverify_ok, X509_STORE_CTX *ctx) {
+ if (!preverify_ok) {
+ const int error = X509_STORE_CTX_get_error(ctx);
+ UNUSED(error);
+ LOG4CXX_WARN(
+ logger_,
+ "Certificate verification failed with error " << error
+ << " \"" << X509_verify_cert_error_string(error) << '"');
+ }
+ return preverify_ok;
+ }
-CryptoManagerImpl::CryptoManagerImpl()
- : context_(NULL), mode_(CLIENT) {
+ void free_ctx(SSL_CTX** ctx) {
+ if (ctx) {
+ SSL_CTX_free(*ctx);
+ *ctx = NULL;
+ }
+ }
}
-bool CryptoManagerImpl::Init(Mode mode,
- Protocol protocol,
- const std::string &cert_filename,
- const std::string &key_filename,
- const std::string &ciphers_list,
- bool verify_peer) {
- if (atomic_post_inc(&instance_count_) == 0) {
+CryptoManagerImpl::CryptoManagerImpl(
+ const utils::SharedPtr<const CryptoManagerSettings> set)
+ : settings_(set)
+ , context_(NULL) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(instance_lock_);
+ instance_count_++;
+ if (instance_count_ == 1) {
+ LOG4CXX_DEBUG(logger_, "Openssl engine initialization");
SSL_load_error_strings();
ERR_load_BIO_strings();
OpenSSL_add_all_algorithms();
SSL_library_init();
}
+}
- mode_ = mode;
+CryptoManagerImpl::~CryptoManagerImpl() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock lock(instance_lock_);
+ LOG4CXX_DEBUG(logger_, "Deinitilization");
+ if (!context_) {
+ LOG4CXX_WARN(logger_, "Manager is not initialized");
+ } else {
+ SSL_CTX_free(context_);
+ }
+ instance_count_--;
+ if (instance_count_ == 0) {
+ LOG4CXX_DEBUG(logger_, "Openssl engine deinitialization");
+ EVP_cleanup();
+ ERR_free_strings();
+ }
+}
+
+bool CryptoManagerImpl::Init() {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const Mode mode = get_settings().security_manager_mode();
const bool is_server = (mode == SERVER);
+ if (is_server) {
+ LOG4CXX_DEBUG(logger_, "Server mode");
+ } else {
+ LOG4CXX_DEBUG(logger_, "Client mode");
+ }
+ LOG4CXX_DEBUG(logger_, "Peer verification "
+ << (get_settings().verify_peer() ? "enabled" : "disabled"));
+ LOG4CXX_DEBUG(logger_, "CA certificate file is \""
+ << get_settings().ca_cert_path() << '"');
+
#if OPENSSL_VERSION_NUMBER < CONST_SSL_METHOD_MINIMAL_VERSION
SSL_METHOD *method;
#else
const SSL_METHOD *method;
#endif
- switch (protocol) {
+ switch (get_settings().security_manager_protocol_name()) {
case SSLv3:
method = is_server ?
SSLv3_server_method() :
@@ -109,65 +169,71 @@ bool CryptoManagerImpl::Init(Mode mode,
#endif
break;
default:
- LOG4CXX_ERROR(logger_, "Unknown protocol: " << protocol);
+ LOG4CXX_ERROR(logger_, "Unknown protocol: "
+ << get_settings().security_manager_protocol_name());
return false;
}
+ if (context_) {
+ free_ctx(&context_);
+ }
context_ = SSL_CTX_new(method);
+
+ utils::ScopeGuard guard = utils::MakeGuard(free_ctx, &context_);
+
// Disable SSL2 as deprecated
SSL_CTX_set_options(context_, SSL_OP_NO_SSLv2);
- if (cert_filename.empty()) {
- LOG4CXX_WARN(logger_, "Empty certificate path");
+ set_certificate(get_settings().certificate_data());
+
+ if (get_settings().ciphers_list().empty()) {
+ LOG4CXX_WARN(logger_, "Empty ciphers list");
} else {
- LOG4CXX_INFO(logger_, "Certificate path: " << cert_filename);
- if (!SSL_CTX_use_certificate_file(context_, cert_filename.c_str(),
- SSL_FILETYPE_PEM)) {
- LOG4CXX_ERROR(logger_, "Could not use certificate " << cert_filename);
+ LOG4CXX_DEBUG(logger_, "Cipher list: " << get_settings().ciphers_list());
+ if (!SSL_CTX_set_cipher_list(context_, get_settings().ciphers_list().c_str())) {
+ LOG4CXX_ERROR(logger_, "Could not set cipher list: "
+ << get_settings().ciphers_list());
return false;
}
}
- if (key_filename.empty()) {
- LOG4CXX_WARN(logger_, "Empty key path");
- } else {
- LOG4CXX_INFO(logger_, "Key path: " << key_filename);
- if (!SSL_CTX_use_PrivateKey_file(context_, key_filename.c_str(),
- SSL_FILETYPE_PEM)) {
- LOG4CXX_ERROR(logger_, "Could not use key " << key_filename);
- return false;
- }
- if (!SSL_CTX_check_private_key(context_)) {
- LOG4CXX_ERROR(logger_, "Could not use certificate " << cert_filename);
- return false;
- }
+ if (get_settings().ca_cert_path().empty()) {
+ LOG4CXX_WARN(logger_, "Setting up empty CA certificate location");
}
- if (ciphers_list.empty()) {
- LOG4CXX_WARN(logger_, "Empty ciphers list");
- } else {
- LOG4CXX_INFO(logger_, "Cipher list: " << ciphers_list);
- if (!SSL_CTX_set_cipher_list(context_, ciphers_list.c_str())) {
- LOG4CXX_ERROR(logger_, "Could not set cipher list: " << ciphers_list);
- return false;
- }
+ LOG4CXX_DEBUG(logger_, "Setting up CA certificate location");
+ const int result = SSL_CTX_load_verify_locations(
+ context_, NULL, get_settings().ca_cert_path().c_str());
+
+ if (!result) {
+ const unsigned long error = ERR_get_error();
+ UNUSED(error);
+ LOG4CXX_WARN(
+ logger_,
+ "Wrong certificate file '" << get_settings().ca_cert_path()
+ << "', err 0x" << std::hex << error
+ << " \"" << ERR_reason_error_string(error) << '"');
}
- // TODO(EZamakhov): add loading SSL_VERIFY_FAIL_IF_NO_PEER_CERT from INI
- const int verify_mode = verify_peer
- ? SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT
- : SSL_VERIFY_NONE;
- SSL_CTX_set_verify(context_, verify_mode, NULL);
+ guard.Dismiss();
+ const int verify_mode =
+ get_settings().verify_peer() ? SSL_VERIFY_PEER |
+ SSL_VERIFY_FAIL_IF_NO_PEER_CERT
+ : SSL_VERIFY_NONE;
+ LOG4CXX_DEBUG(logger_, "Setting up peer verification in mode: " << verify_mode);
+ SSL_CTX_set_verify(context_, verify_mode, &debug_callback);
return true;
}
-void CryptoManagerImpl::Finish() {
- SSL_CTX_free(context_);
- if (atomic_post_dec(&instance_count_) == 1) {
- EVP_cleanup();
- ERR_free_strings();
+bool CryptoManagerImpl::OnCertificateUpdated(const std::string &data) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ if (!context_) {
+ LOG4CXX_WARN(logger_, "Not initialized");
+ return false;
}
+
+ return set_certificate(data);
}
SSLContext* CryptoManagerImpl::CreateSSLContext() {
@@ -179,12 +245,14 @@ SSLContext* CryptoManagerImpl::CreateSSLContext() {
if (conn == NULL)
return NULL;
- if (mode_ == SERVER) {
+ if (get_settings().security_manager_mode() == SERVER) {
SSL_set_accept_state(conn);
} else {
SSL_set_connect_state(conn);
}
- return new SSLContextImpl(conn, mode_);
+ return new SSLContextImpl(conn,
+ get_settings().security_manager_mode(),
+ get_settings().maximum_payload_size());
}
void CryptoManagerImpl::ReleaseSSLContext(SSLContext *context) {
@@ -199,4 +267,125 @@ std::string CryptoManagerImpl::LastError() const {
return std::string(reason ? reason : "");
}
+bool CryptoManagerImpl::IsCertificateUpdateRequired() const {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ const time_t now = time(NULL);
+ const time_t cert_date = mktime(&expiration_time_);
+
+ const double seconds = difftime(cert_date, now);
+ LOG4CXX_DEBUG(
+ logger_,
+ "Certificate time: " << asctime(&expiration_time_)
+ << ". Host time: " << asctime(localtime(&now))
+ << ". Seconds before expiration: " << seconds);
+ return seconds <= get_settings().update_before_hours();
+}
+
+const CryptoManagerSettings& CryptoManagerImpl::get_settings() const {
+ return *settings_;
+}
+
+
+bool CryptoManagerImpl::set_certificate(const std::string &cert_data) {
+ if (cert_data.empty()) {
+ LOG4CXX_WARN(logger_, "Empty certificate");
+ return false;
+ }
+
+ BIO* bio = BIO_new(BIO_f_base64());
+ BIO* bmem = BIO_new_mem_buf((char*)cert_data.c_str(), cert_data.length());
+ bmem = BIO_push(bio, bmem);
+
+ char* buf = new char[cert_data.length()];
+ int len = BIO_read(bmem, buf, cert_data.length());
+
+
+ BIO* bio_cert = BIO_new(BIO_s_mem());
+ if (NULL == bio_cert) {
+ LOG4CXX_WARN(logger_, "Unable to update certificate. BIO not created");
+ return false;
+ }
+
+ utils::ScopeGuard bio_guard = utils::MakeGuard(BIO_free, bio_cert);
+ UNUSED(bio_guard)
+ int k = 0;
+ if ((k = BIO_write(bio_cert, buf, len)) <= 0) {
+ LOG4CXX_WARN(logger_, "Unable to write into BIO");
+ return false;
+ }
+
+ PKCS12* p12 = d2i_PKCS12_bio(bio_cert, NULL);
+ if(NULL == p12) {
+ LOG4CXX_ERROR(logger_, "Unable to parse certificate");
+ return false;
+ }
+
+ EVP_PKEY* pkey = NULL;
+ X509* cert = NULL;
+ PKCS12_parse(p12, NULL, &pkey, &cert, NULL);
+
+ if (NULL == cert || NULL == pkey){
+ LOG4CXX_WARN(logger_, "Either certificate or key not valid.");
+ return false;
+ }
+
+ if (!SSL_CTX_use_certificate(context_, cert)) {
+ LOG4CXX_WARN(logger_, "Could not use certificate");
+ return false;
+ }
+
+ asn1_time_to_tm(X509_get_notAfter(cert));
+
+ if (!SSL_CTX_use_PrivateKey(context_, pkey)) {
+ LOG4CXX_ERROR(logger_, "Could not use key");
+ return false;
+ }
+ if (!SSL_CTX_check_private_key(context_)) {
+ LOG4CXX_ERROR(logger_, "Could not use certificate ");
+ return false;
+ }
+ return true;
+}
+
+int CryptoManagerImpl::pull_number_from_buf(char *buf, int *idx) {
+ if (!idx) { return 0; }
+ const int val = ((buf[*idx] - '0') * 10) + buf[(*idx) + 1] - '0';
+ *idx = *idx + 2;
+ return val;
+}
+
+void CryptoManagerImpl::asn1_time_to_tm(ASN1_TIME *time) {
+ char* buf = (char *)time->data;
+ int index = 0;
+ const int year = pull_number_from_buf(buf, &index);
+ if (V_ASN1_GENERALIZEDTIME == time->type) {
+ expiration_time_.tm_year = (year * 100 -1900) + pull_number_from_buf(buf, &index);
+ } else {
+ expiration_time_.tm_year = year < 50 ? year + 100 : year;
+ }
+
+ const int mon = pull_number_from_buf(buf, &index);
+ const int day = pull_number_from_buf(buf, &index);
+ const int hour = pull_number_from_buf(buf, &index);
+ const int mn = pull_number_from_buf(buf, &index);
+
+ expiration_time_.tm_mon = mon -1;
+ expiration_time_.tm_mday = day;
+ expiration_time_.tm_hour = hour;
+ expiration_time_.tm_min = mn;
+
+ if (buf[index] == 'Z') {
+ expiration_time_.tm_sec = 0;
+ }
+ if ((buf[index] == '+') || (buf[index] == '-')) {
+ const int mn = pull_number_from_buf(buf, &index);
+ const int mn1 = pull_number_from_buf(buf, &index);
+ expiration_time_.tm_sec = (mn * 3600) + (mn1 * 60);
+ } else {
+ const int sec = pull_number_from_buf(buf, &index);
+ expiration_time_.tm_sec = sec;
+ }
+}
+
} // namespace security_manager
diff --git a/src/components/security_manager/src/security_manager_impl.cc b/src/components/security_manager/src/security_manager_impl.cc
index dee1770e70..a8d247cbf1 100644
--- a/src/components/security_manager/src/security_manager_impl.cc
+++ b/src/components/security_manager/src/security_manager_impl.cc
@@ -182,23 +182,35 @@ void SecurityManagerImpl::StartHandshake(uint32_t connection_key) {
"connection is not protected");
LOG4CXX_ERROR(logger_, error_text);
SendInternalError(connection_key, ERROR_INTERNAL, error_text);
- NotifyListenersOnHandshakeDone(connection_key, false);
+ NotifyListenersOnHandshakeDone(connection_key,
+ SSLContext::Handshake_Result_Fail);
return;
}
+ if(crypto_manager_->IsCertificateUpdateRequired()) {
+ NotifyOnCertififcateUpdateRequired();
+ }
+
if (ssl_context->IsInitCompleted()) {
- NotifyListenersOnHandshakeDone(connection_key, true);
+ NotifyListenersOnHandshakeDone(connection_key,
+ SSLContext::Handshake_Result_Success);
return;
}
+
+ ssl_context->SetHandshakeContext(
+ session_observer_->GetHandshakeContext(connection_key));
+
size_t data_size = 0;
const uint8_t *data = NULL;
+
const security_manager::SSLContext::HandshakeResult result =
ssl_context->StartHandshake(&data, &data_size);
if (security_manager::SSLContext::Handshake_Result_Success != result) {
const std::string error_text("StartHandshake failed, handshake step fail");
LOG4CXX_ERROR(logger_, error_text);
SendInternalError(connection_key, ERROR_INTERNAL, error_text);
- NotifyListenersOnHandshakeDone(connection_key, false);
+ NotifyListenersOnHandshakeDone(connection_key,
+ SSLContext::Handshake_Result_Fail);
return;
}
// for client mode will be generated output data
@@ -220,12 +232,13 @@ void SecurityManagerImpl::RemoveListener(SecurityManagerListener *const listener
}
listeners_.remove(listener);
}
-void SecurityManagerImpl::NotifyListenersOnHandshakeDone(const uint32_t &connection_key,
- const bool success) {
- LOG4CXX_TRACE(logger_, "NotifyListenersOnHandshakeDone");
+void SecurityManagerImpl::NotifyListenersOnHandshakeDone(
+ const uint32_t &connection_key,
+ SSLContext::HandshakeResult error) {
+ LOG4CXX_AUTO_TRACE(logger_);
std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
while (it != listeners_.end()) {
- if ((*it)->OnHandshakeDone(connection_key, success)) {
+ if ((*it)->OnHandshakeDone(connection_key, error)) {
// On get notification remove listener
it = listeners_.erase(it);
} else {
@@ -234,6 +247,15 @@ void SecurityManagerImpl::NotifyListenersOnHandshakeDone(const uint32_t &connect
}
}
+void SecurityManagerImpl::NotifyOnCertififcateUpdateRequired() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ std::list<SecurityManagerListener*>::iterator it = listeners_.begin();
+ while (it != listeners_.end()) {
+ (*it)->OnCertificateUpdateRequired();
+ ++it;
+ }
+}
+
bool SecurityManagerImpl::ProccessHandshakeData(const SecurityMessage &inMessage) {
LOG4CXX_INFO(logger_, "SendHandshakeData processing");
DCHECK(inMessage);
@@ -260,7 +282,8 @@ bool SecurityManagerImpl::ProccessHandshakeData(const SecurityMessage &inMessage
LOG4CXX_ERROR(logger_, error_text);
SendInternalError(connection_key, ERROR_SERVICE_NOT_PROTECTED,
error_text, seqNumber);
- NotifyListenersOnHandshakeDone(connection_key, false);
+ NotifyListenersOnHandshakeDone(connection_key,
+ SSLContext::Handshake_Result_Fail);
return false;
}
size_t out_data_size;
@@ -274,18 +297,20 @@ bool SecurityManagerImpl::ProccessHandshakeData(const SecurityMessage &inMessage
LOG4CXX_ERROR(logger_, "SendHandshakeData: Handshake failed: " << erorr_text);
SendInternalError(connection_key,
ERROR_SSL_INVALID_DATA, erorr_text, seqNumber);
- NotifyListenersOnHandshakeDone(connection_key, false);
+ NotifyListenersOnHandshakeDone(connection_key,
+ SSLContext::Handshake_Result_Fail);
// no handshake data to send
return false;
}
if (sslContext->IsInitCompleted()) {
// On handshake success
LOG4CXX_DEBUG(logger_, "SSL initialization finished success.");
- NotifyListenersOnHandshakeDone(connection_key, true);
- } else if (handshake_result == SSLContext::Handshake_Result_Fail) {
+ NotifyListenersOnHandshakeDone(connection_key,
+ SSLContext::Handshake_Result_Success);
+ } else if (handshake_result != SSLContext::Handshake_Result_Success){
// On handshake fail
LOG4CXX_WARN(logger_, "SSL initialization finished with fail.");
- NotifyListenersOnHandshakeDone(connection_key, false);
+ NotifyListenersOnHandshakeDone(connection_key, handshake_result);
}
if (out_data && out_data_size) {
diff --git a/src/components/security_manager/src/ssl_context_impl.cc b/src/components/security_manager/src/ssl_context_impl.cc
index 09c2efd196..77b322cb1b 100644
--- a/src/components/security_manager/src/ssl_context_impl.cc
+++ b/src/components/security_manager/src/ssl_context_impl.cc
@@ -37,22 +37,24 @@
#include <openssl/err.h>
#include <memory.h>
#include <map>
+#include <algorithm>
#include "utils/macro.h"
namespace security_manager {
-CryptoManagerImpl::SSLContextImpl::SSLContextImpl(SSL *conn, Mode mode)
- : connection_(conn),
- bioIn_(BIO_new(BIO_s_mem())),
- bioOut_(BIO_new(BIO_s_mem())),
- bioFilter_(NULL),
- // TODO(EZamakhov): get MTU by parameter (from transport)
- // default buffer size is TCP MTU
- buffer_size_(1500),
- buffer_(new uint8_t[buffer_size_]),
- is_handshake_pending_(false),
- mode_(mode) {
+CREATE_LOGGERPTR_GLOBAL(logger_, "SecurityManager")
+
+CryptoManagerImpl::SSLContextImpl::SSLContextImpl(
+ SSL* conn, Mode mode, size_t maximum_payload_size)
+ : connection_(conn)
+ , bioIn_(BIO_new(BIO_s_mem()))
+ , bioOut_(BIO_new(BIO_s_mem()))
+ , bioFilter_(NULL)
+ , buffer_size_(maximum_payload_size)
+ , buffer_(new uint8_t[buffer_size_])
+ , is_handshake_pending_(false)
+ , mode_(mode) {
SSL_set_bio(connection_, bioIn_, bioOut_);
}
@@ -60,7 +62,7 @@ std::string CryptoManagerImpl::SSLContextImpl::LastError() const {
if (!IsInitCompleted()) {
return std::string("Initialization is not completed");
}
- const char *reason = ERR_reason_error_string(ERR_get_error());
+ const char* reason = ERR_reason_error_string(ERR_get_error());
return std::string(reason ? reason : "");
}
@@ -69,137 +71,278 @@ bool CryptoManagerImpl::SSLContextImpl::IsInitCompleted() const {
return SSL_is_init_finished(connection_);
}
-SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::
-StartHandshake(const uint8_t** const out_data, size_t *out_data_size) {
+SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::StartHandshake(
+ const uint8_t** const out_data, size_t* out_data_size) {
is_handshake_pending_ = true;
return DoHandshakeStep(NULL, 0, out_data, out_data_size);
}
namespace {
- size_t aes128_gcm_sha256_max_block_size(size_t mtu) {
- if (mtu < 29)
- return 0;
- return mtu - 29;
- }
- size_t rc4_md5_max_block_size(size_t mtu) {
- if (mtu < 21)
- return 0;
- return mtu - 21;
- }
- size_t rc4_sha_max_block_size(size_t mtu) {
- if (mtu < 25)
- return 0;
- return mtu - 25;
- }
- size_t seed_sha_max_block_size(size_t mtu) {
- if (mtu < 53)
- return 0;
- return ((mtu - 37) & 0xfffffff0) - 5;
- }
- size_t aes128_sha256_max_block_size(size_t mtu) {
- if (mtu < 69)
- return 0;
- return ((mtu - 53) & 0xfffffff0) - 1;
- }
- size_t des_cbc3_sha_max_block_size(size_t mtu) {
- if (mtu < 37)
- return 0;
- return ((mtu - 29) & 0xfffffff8) - 5;
- }
+size_t aes128_gcm_sha256_max_block_size(size_t mtu) {
+ if (mtu < 29)
+ return 0;
+ return mtu - 29;
+}
+size_t rc4_md5_max_block_size(size_t mtu) {
+ if (mtu < 21)
+ return 0;
+ return mtu - 21;
+}
+size_t rc4_sha_max_block_size(size_t mtu) {
+ if (mtu < 25)
+ return 0;
+ return mtu - 25;
+}
+size_t seed_sha_max_block_size(size_t mtu) {
+ if (mtu < 53)
+ return 0;
+ return ((mtu - 37) & 0xfffffff0) - 5;
+}
+size_t aes128_sha256_max_block_size(size_t mtu) {
+ if (mtu < 69)
+ return 0;
+ return ((mtu - 53) & 0xfffffff0) - 1;
+}
+size_t des_cbc3_sha_max_block_size(size_t mtu) {
+ if (mtu < 37)
+ return 0;
+ return ((mtu - 29) & 0xfffffff8) - 5;
+}
} // namespace
std::map<std::string, CryptoManagerImpl::SSLContextImpl::BlockSizeGetter>
CryptoManagerImpl::SSLContextImpl::create_max_block_sizes() {
std::map<std::string, CryptoManagerImpl::SSLContextImpl::BlockSizeGetter> rc;
- rc.insert(std::make_pair("AES128-GCM-SHA256", aes128_gcm_sha256_max_block_size));
- rc.insert(std::make_pair("AES128-SHA256", aes128_sha256_max_block_size));
- rc.insert(std::make_pair("AES128-SHA", seed_sha_max_block_size));
- rc.insert(std::make_pair("AES256-GCM-SHA384", aes128_gcm_sha256_max_block_size));
- rc.insert(std::make_pair("AES256-SHA256", aes128_sha256_max_block_size));
- rc.insert(std::make_pair("AES256-SHA", seed_sha_max_block_size));
- rc.insert(std::make_pair("CAMELLIA128-SHA", seed_sha_max_block_size));
- rc.insert(std::make_pair("CAMELLIA256-SHA", seed_sha_max_block_size));
- rc.insert(std::make_pair("DES-CBC3-SHA", des_cbc3_sha_max_block_size));
- rc.insert(std::make_pair("DES-CBC-SHA", des_cbc3_sha_max_block_size));
- rc.insert(std::make_pair("RC4-MD5", rc4_md5_max_block_size));
- rc.insert(std::make_pair("RC4-SHA", rc4_sha_max_block_size));
- rc.insert(std::make_pair("SEED-SHA", seed_sha_max_block_size));
+ rc.insert(
+ std::make_pair("AES128-GCM-SHA256", aes128_gcm_sha256_max_block_size));
+ rc.insert(std::make_pair("AES128-SHA256", aes128_sha256_max_block_size));
+ rc.insert(std::make_pair("AES128-SHA", seed_sha_max_block_size));
+ rc.insert(
+ std::make_pair("AES256-GCM-SHA384", aes128_gcm_sha256_max_block_size));
+ rc.insert(std::make_pair("AES256-SHA256", aes128_sha256_max_block_size));
+ rc.insert(std::make_pair("AES256-SHA", seed_sha_max_block_size));
+ rc.insert(std::make_pair("CAMELLIA128-SHA", seed_sha_max_block_size));
+ rc.insert(std::make_pair("CAMELLIA256-SHA", seed_sha_max_block_size));
+ rc.insert(std::make_pair("DES-CBC3-SHA", des_cbc3_sha_max_block_size));
+ rc.insert(std::make_pair("DES-CBC-SHA", des_cbc3_sha_max_block_size));
+ rc.insert(std::make_pair("RC4-MD5", rc4_md5_max_block_size));
+ rc.insert(std::make_pair("RC4-SHA", rc4_sha_max_block_size));
+ rc.insert(std::make_pair("SEED-SHA", seed_sha_max_block_size));
return rc;
}
std::map<std::string, CryptoManagerImpl::SSLContextImpl::BlockSizeGetter>
-CryptoManagerImpl::SSLContextImpl::max_block_sizes =
- CryptoManagerImpl::SSLContextImpl::create_max_block_sizes();
+ CryptoManagerImpl::SSLContextImpl::max_block_sizes =
+ CryptoManagerImpl::SSLContextImpl::create_max_block_sizes();
+
+void CryptoManagerImpl::SSLContextImpl::PrintCertData(
+ X509* cert, const std::string& cert_owner) {
+ if (cert) {
+ X509_NAME* subj_name = X509_get_subject_name(cert);
+ char* subj = X509_NAME_oneline(subj_name, NULL, 0);
+ if (subj) {
+ std::replace(subj, subj + strlen(subj), '/', ' ');
+ LOG4CXX_DEBUG(logger_, cert_owner << " subject:" << subj);
+ OPENSSL_free(subj);
+ }
+ char* issuer = X509_NAME_oneline(X509_get_issuer_name(cert), NULL, 0);
+ if (issuer) {
+ std::replace(issuer, issuer + strlen(issuer), '/', ' ');
+ LOG4CXX_DEBUG(logger_, cert_owner << " issuer:" << issuer);
+ OPENSSL_free(issuer);
+ }
-SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::
-DoHandshakeStep(const uint8_t* const in_data, size_t in_data_size,
- const uint8_t** const out_data, size_t* out_data_size) {
- DCHECK(out_data);
- DCHECK(out_data_size);
- *out_data = NULL;
- *out_data_size = 0;
- // TODO(Ezamakhov): add test - hanshake fail -> restart StartHandshake
- sync_primitives::AutoLock locker(bio_locker);
- if (SSL_is_init_finished(connection_)) {
- is_handshake_pending_ = false;
- return SSLContext::Handshake_Result_Success;
+ ASN1_TIME* notBefore = X509_get_notBefore(cert);
+ ASN1_TIME* notAfter = X509_get_notAfter(cert);
+
+ if (notBefore) {
+ LOG4CXX_DEBUG(logger_, " Start date: " << (char*)notBefore->data);
+ }
+ if (notAfter) {
+ LOG4CXX_DEBUG(logger_, " End date: " << (char*)notAfter->data);
+ }
}
+}
+
+void CryptoManagerImpl::SSLContextImpl::PrintCertInfo() {
+ PrintCertData(SSL_get_certificate(connection_), "HU's");
+
+ STACK_OF(X509)* peer_certs = SSL_get_peer_cert_chain(connection_);
+ while (sk_X509_num(peer_certs) > 0) {
+ X509* cert = sk_X509_pop(peer_certs);
+ PrintCertData(cert, "SERVERS");
+ }
+}
+
+SSLContext::HandshakeResult
+CryptoManagerImpl::SSLContextImpl::CheckCertContext() {
+ X509* cert = SSL_get_peer_certificate(connection_);
+ if (!cert) {
+ // According to the openssl documentation the peer certificate
+ // might be ommitted for the SERVER but required for the cient.
+ return CLIENT == mode_ ? Handshake_Result_Fail : Handshake_Result_Success;
+ }
+
+ X509_NAME* subj_name = X509_get_subject_name(cert);
+
+ const std::string& cn = GetTextBy(subj_name, NID_commonName);
+ const std::string& sn = GetTextBy(subj_name, NID_serialNumber);
+
+ if (!(hsh_context_.expected_cn.CompareIgnoreCase(cn.c_str()))) {
+ LOG4CXX_ERROR(logger_,
+ "Trying to run handshake with wrong app name: "
+ << cn
+ << ". Expected app name: "
+ << hsh_context_.expected_cn.AsMBString());
+ return Handshake_Result_AppNameMismatch;
+ }
+
+ if (!(hsh_context_.expected_sn.CompareIgnoreCase(sn.c_str()))) {
+ LOG4CXX_ERROR(logger_,
+ "Trying to run handshake with wrong app id: "
+ << sn
+ << ". Expected app id: "
+ << hsh_context_.expected_sn.AsMBString());
+ return Handshake_Result_AppIDMismatch;
+ }
+ return Handshake_Result_Success;
+}
+
+bool CryptoManagerImpl::SSLContextImpl::ReadHandshakeData(
+ const uint8_t** const out_data, size_t* out_data_size) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const size_t pend = BIO_ctrl_pending(bioOut_);
+ LOG4CXX_DEBUG(logger_, "Available " << pend << " bytes for handshake");
+
+ if (pend > 0) {
+ LOG4CXX_DEBUG(logger_, "Reading handshake data");
+ EnsureBufferSizeEnough(pend);
+
+ const int read_count = BIO_read(bioOut_, buffer_, pend);
+ if (read_count == static_cast<int>(pend)) {
+ *out_data_size = read_count;
+ *out_data = buffer_;
+ } else {
+ LOG4CXX_WARN(logger_, "BIO read fail");
+ is_handshake_pending_ = false;
+ ResetConnection();
+ return false;
+ }
+ }
+
+ return true;
+}
+bool CryptoManagerImpl::SSLContextImpl::WriteHandshakeData(
+ const uint8_t* const in_data, size_t in_data_size) {
+ LOG4CXX_AUTO_TRACE(logger_);
if (in_data && in_data_size) {
const int ret = BIO_write(bioIn_, in_data, in_data_size);
if (ret <= 0) {
is_handshake_pending_ = false;
- SSL_clear(connection_);
- return SSLContext::Handshake_Result_AbnormalFail;
+ ResetConnection();
+ return Handshake_Result_AbnormalFail;
}
}
+ return true;
+}
+SSLContext::HandshakeResult
+CryptoManagerImpl::SSLContextImpl::PerformHandshake() {
const int handshake_result = SSL_do_handshake(connection_);
if (handshake_result == 1) {
+ const HandshakeResult result = CheckCertContext();
+ if (result != Handshake_Result_Success) {
+ ResetConnection();
+ is_handshake_pending_ = false;
+ return result;
+ }
+
+ LOG4CXX_DEBUG(logger_, "SSL handshake successfully finished");
// Handshake is successful
bioFilter_ = BIO_new(BIO_f_ssl());
BIO_set_ssl(bioFilter_, connection_, BIO_NOCLOSE);
- const SSL_CIPHER *cipher = SSL_get_current_cipher(connection_);
+ const SSL_CIPHER* cipher = SSL_get_current_cipher(connection_);
max_block_size_ = max_block_sizes[SSL_CIPHER_get_name(cipher)];
is_handshake_pending_ = false;
+
} else if (handshake_result == 0) {
SSL_clear(connection_);
is_handshake_pending_ = false;
- return SSLContext::Handshake_Result_Fail;
- } else if (SSL_get_error(connection_, handshake_result) != SSL_ERROR_WANT_READ) {
- SSL_clear(connection_);
- is_handshake_pending_ = false;
- return SSLContext::Handshake_Result_AbnormalFail;
+ return Handshake_Result_Fail;
+ } else {
+ const int error = SSL_get_error(connection_, handshake_result);
+ if (error != SSL_ERROR_WANT_READ) {
+ const long error = SSL_get_verify_result(connection_);
+ SetHandshakeError(error);
+ LOG4CXX_WARN(logger_,
+ "Handshake failed with error "
+ << " -> "
+ << SSL_get_error(connection_, error)
+ << " \""
+ << LastError()
+ << '"');
+ ResetConnection();
+ is_handshake_pending_ = false;
+
+ // In case error happened but ssl verification shows OK
+ // method will return AbnormalFail.
+ if (X509_V_OK == error) {
+ return Handshake_Result_AbnormalFail;
+ }
+ return openssl_error_convert_to_internal(error);
+ }
}
+ return Handshake_Result_Success;
+}
- const size_t pend = BIO_ctrl_pending(bioOut_);
+SSLContext::HandshakeResult CryptoManagerImpl::SSLContextImpl::DoHandshakeStep(
+ const uint8_t* const in_data,
+ size_t in_data_size,
+ const uint8_t** const out_data,
+ size_t* out_data_size) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(out_data);
+ DCHECK(out_data_size);
+ *out_data = NULL;
+ *out_data_size = 0;
- if (pend) {
- EnsureBufferSizeEnough(pend);
+ // TODO(Ezamakhov): add test - hanshake fail -> restart StartHandshake
+ {
+ sync_primitives::AutoLock locker(bio_locker);
- const int read_count = BIO_read(bioOut_, buffer_, pend);
- if (read_count == static_cast<int>(pend)) {
- *out_data_size = read_count;
- *out_data = buffer_;
- } else {
+ if (SSL_is_init_finished(connection_)) {
+ LOG4CXX_DEBUG(logger_, "SSL initilization is finished");
is_handshake_pending_ = false;
- SSL_clear(connection_);
- return SSLContext::Handshake_Result_AbnormalFail;
+ return Handshake_Result_Success;
}
}
- return SSLContext::Handshake_Result_Success;
-}
+ if (!WriteHandshakeData(in_data, in_data_size)) {
+ return Handshake_Result_AbnormalFail;
+ }
-bool CryptoManagerImpl::SSLContextImpl::Encrypt(
- const uint8_t * const in_data, size_t in_data_size,
- const uint8_t ** const out_data, size_t *out_data_size) {
+ PrintCertInfo();
+ const HandshakeResult res = PerformHandshake();
+ if (res != Handshake_Result_Success) {
+ return res;
+ }
+
+ if (!ReadHandshakeData(out_data, out_data_size)) {
+ return Handshake_Result_AbnormalFail;
+ }
+
+ return res;
+}
+
+bool CryptoManagerImpl::SSLContextImpl::Encrypt(const uint8_t* const in_data,
+ size_t in_data_size,
+ const uint8_t** const out_data,
+ size_t* out_data_size) {
sync_primitives::AutoLock locker(bio_locker);
- if (!SSL_is_init_finished(connection_) ||
- !in_data ||
- !in_data_size) {
+ if (!SSL_is_init_finished(connection_) || !in_data || !in_data_size) {
return false;
}
@@ -220,10 +363,10 @@ bool CryptoManagerImpl::SSLContextImpl::Encrypt(
return true;
}
-bool CryptoManagerImpl::SSLContextImpl::Decrypt(
- const uint8_t * const in_data, size_t in_data_size,
- const uint8_t ** const out_data, size_t *out_data_size) {
-
+bool CryptoManagerImpl::SSLContextImpl::Decrypt(const uint8_t* const in_data,
+ size_t in_data_size,
+ const uint8_t** const out_data,
+ size_t* out_data_size) {
sync_primitives::AutoLock locker(bio_locker);
if (!SSL_is_init_finished(connection_)) {
return false;
@@ -274,14 +417,94 @@ CryptoManagerImpl::SSLContextImpl::~SSLContextImpl() {
delete[] buffer_;
}
+void CryptoManagerImpl::SSLContextImpl::SetHandshakeError(const int error) {
+ const char* error_str = X509_verify_cert_error_string(error);
+ if (error_str) {
+ last_error_ = error_str;
+ } else {
+ // Error will be updated with the next LastError call
+ last_error_.clear();
+ }
+}
+
+void CryptoManagerImpl::SSLContextImpl::ResetConnection() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const int shutdown_result = SSL_shutdown(connection_);
+ if (shutdown_result != 1) {
+ const size_t pend = BIO_ctrl_pending(bioOut_);
+ LOG4CXX_DEBUG(logger_, "Available " << pend << " bytes for shutdown");
+ if (pend > 0) {
+ LOG4CXX_DEBUG(logger_, "Reading shutdown data");
+ EnsureBufferSizeEnough(pend);
+ BIO_read(bioOut_, buffer_, pend);
+ }
+ SSL_shutdown(connection_);
+ }
+ LOG4CXX_DEBUG(logger_, "SSL connection recreation");
+ SSL_CTX* ssl_context = connection_->ctx;
+ SSL_free(connection_);
+ connection_ = SSL_new(ssl_context);
+ if (mode_ == SERVER) {
+ SSL_set_accept_state(connection_);
+ } else {
+ SSL_set_connect_state(connection_);
+ }
+ bioIn_ = BIO_new(BIO_s_mem());
+ bioOut_ = BIO_new(BIO_s_mem());
+ SSL_set_bio(connection_, bioIn_, bioOut_);
+}
+
+void CryptoManagerImpl::SSLContextImpl::SetHandshakeContext(
+ const SSLContext::HandshakeContext& hsh_ctx) {
+ hsh_context_ = hsh_ctx;
+}
+
void CryptoManagerImpl::SSLContextImpl::EnsureBufferSizeEnough(size_t size) {
if (buffer_size_ < size) {
delete[] buffer_;
- buffer_ = new(std::nothrow) uint8_t[size];
+ buffer_ = new (std::nothrow) uint8_t[size];
if (buffer_) {
buffer_size_ = size;
}
}
}
+SSLContext::HandshakeResult
+CryptoManagerImpl::SSLContextImpl::openssl_error_convert_to_internal(
+ const long error) {
+ switch (error) {
+ case X509_V_ERR_CERT_HAS_EXPIRED:
+ return Handshake_Result_CertExpired;
+ case X509_V_ERR_CERT_NOT_YET_VALID:
+ return Handshake_Result_NotYetValid;
+ case X509_V_ERR_SUBJECT_ISSUER_MISMATCH:
+ case X509_V_ERR_CERT_SIGNATURE_FAILURE:
+ case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT:
+ case X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT:
+ return Handshake_Result_CertNotSigned;
+ default:
+ return Handshake_Result_Fail;
+ }
+}
+
+std::string CryptoManagerImpl::SSLContextImpl::GetTextBy(X509_NAME* name,
+ int object) const {
+ const int req_len = X509_NAME_get_text_by_NID(name, object, NULL, 0);
+
+ if (-1 == req_len) {
+ LOG4CXX_WARN(logger_,
+ "Unable to obtain object: " << object << " from certificate");
+ return std::string();
+ }
+
+ std::vector<char> data;
+ data.resize(req_len + 1);
+ X509_NAME_get_text_by_NID(name, object, &data.front(), data.size());
+
+ std::string str(data.begin(), data.end() - 1);
+
+ std::transform(str.begin(), str.end(), str.begin(), ::tolower);
+ return str;
+}
+
} // namespace security_manager
diff --git a/src/components/security_manager/test/CMakeLists.txt b/src/components/security_manager/test/CMakeLists.txt
index 6554bb797f..7b2f795ce9 100644
--- a/src/components/security_manager/test/CMakeLists.txt
+++ b/src/components/security_manager/test/CMakeLists.txt
@@ -35,14 +35,15 @@ include_directories(
${COMPONENTS_DIR}/protocol_handler/test/include
${COMPONENTS_DIR}/transport_manager/test/include
${COMPONENTS_DIR}/security_manager/include
- include
)
set(SOURCES
- #${COMPONENTS_DIR}/security_manager/test/crypto_manager_impl_test.cc
- #${COMPONENTS_DIR}/security_manager/test/security_manager_test.cc
- #${COMPONENTS_DIR}/security_manager/test/security_query_test.cc
+ ${COMPONENTS_DIR}/security_manager/test/crypto_manager_impl_test.cc
+ ${COMPONENTS_DIR}/security_manager/test/security_manager_test.cc
+ ${COMPONENTS_DIR}/security_manager/test/security_query_test.cc
${COMPONENTS_DIR}/security_manager/test/security_query_matcher.cc
+ ${COMPONENTS_DIR}/security_manager/test/ssl_context_test.cc
+ ${COMPONENTS_DIR}/security_manager/test/ssl_certificate_handshake_test.cc
)
set(LIBRARIES
@@ -55,12 +56,17 @@ set(CERT_LIST
${CMAKE_SOURCE_DIR}/mykey.pem
)
+add_custom_target(generate_certificates
+ COMMAND ${CMAKE_SOURCE_DIR}/tools/Utils/generate_test_certificates.py
+ -d=${CMAKE_CURRENT_BINARY_DIR} -s
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+)
+
foreach( file_i ${CERT_LIST})
file(COPY ${file_i} DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
endforeach( file_i )
-add_library (test_security_manager ${SOURCES})
-target_link_libraries (test_security_manager ${LIBRARIES} )
create_test (security_manager_test "${SOURCES}" "${LIBRARIES}")
+add_dependencies(security_manager_test generate_certificates)
endif ()
diff --git a/src/components/security_manager/test/crypto_manager_impl_test.cc b/src/components/security_manager/test/crypto_manager_impl_test.cc
index 52ac42b418..93b1ef49fc 100644
--- a/src/components/security_manager/test/crypto_manager_impl_test.cc
+++ b/src/components/security_manager/test/crypto_manager_impl_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,433 +30,248 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-#include "security_manager/crypto_manager.h"
-#include "security_manager/crypto_manager_impl.h"
-#include "security_manager/ssl_context.h"
-
#ifdef __QNXNTO__
#include <openssl/ssl3.h>
#else
-#include <openssl/tls1.h>
-#endif
+#include <openssl/ssl.h>
+#endif //__QNXNTO__
+#include <limits>
+#include <fstream>
+#include <sstream>
+
+#include "gtest/gtest.h"
+#include "security_manager/crypto_manager_impl.h"
+#include "security_manager/mock_security_manager_settings.h"
+
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::NiceMock;
+
+namespace {
+const size_t kUpdatesBeforeHour = 24;
+const std::string kAllCiphers = "ALL";
+const std::string kCaCertPath = "";
#ifdef __QNXNTO__
-#define FORD_CIPHER SSL3_TXT_RSA_DES_192_CBC3_SHA
+const std::string kFordCipher = SSL3_TXT_RSA_DES_192_CBC3_SHA;
#else
// Used cipher from ford protocol requirement
-#define FORD_CIPHER TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384
+const std::string kFordCipher = TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384;
#endif
-#define ALL_CIPHERS "ALL"
+}
namespace test {
namespace components {
-namespace security_manager_test {
+namespace crypto_manager_test {
-namespace {
-bool isErrorFatal(SSL *connection, int res) {
- const int error = SSL_get_error(connection, res);
- return (error != SSL_ERROR_WANT_READ && error != SSL_ERROR_WANT_WRITE);
-}
-}
-// TODO(EZamakhov): May be split to SSLContext and Cryptomanager tests (separate files)
-// TODO(EZamakhov): add test for EnsureBufferSizeEnough
-class SSLTest : public testing::Test {
+class CryptoManagerTest : public testing::Test {
protected:
static void SetUpTestCase() {
- crypto_manager = new security_manager::CryptoManagerImpl();
- const bool crypto_manager_initialization = crypto_manager->Init(
- security_manager::SERVER, security_manager::TLSv1_2, "mycert.pem",
- "mykey.pem", FORD_CIPHER, false);
- EXPECT_TRUE(crypto_manager_initialization);
-
- client_manager = new security_manager::CryptoManagerImpl();
- const bool client_manager_initialization = client_manager->Init(
- security_manager::CLIENT, security_manager::TLSv1_2, "", "",
- FORD_CIPHER,
- false);
- EXPECT_TRUE(client_manager_initialization);
+ std::ifstream certificate_file("server/spt_credential.p12.enc");
+ ASSERT_TRUE(certificate_file.is_open())
+ << "Could not open certificate data file";
+
+ const std::string certificate(
+ (std::istreambuf_iterator<char>(certificate_file)),
+ std::istreambuf_iterator<char>());
+ ASSERT_FALSE(certificate.empty()) << "Certificate data file is empty";
+ certificate_data_base64_ = certificate;
}
- static void TearDownTestCase() {
- crypto_manager->Finish();
- client_manager->Finish();
- delete crypto_manager;
- delete client_manager;
+ void SetUp() OVERRIDE {
+ ASSERT_FALSE(certificate_data_base64_.empty());
+ mock_security_manager_settings_ =
+ new NiceMock<security_manager_test::MockCryptoManagerSettings>();
+ utils::SharedPtr<security_manager::CryptoManagerSettings> scrypto =
+ utils::SharedPtr<security_manager::CryptoManagerSettings>::
+ static_pointer_cast<security_manager::CryptoManagerSettings>(
+ mock_security_manager_settings_);
+ crypto_manager_ = new security_manager::CryptoManagerImpl(scrypto);
}
- virtual void SetUp() {
- server_ctx = crypto_manager->CreateSSLContext();
- client_ctx = client_manager->CreateSSLContext();
+ void TearDown() OVERRIDE {
+ delete mock_security_manager_settings_;
+ testing::Mock::AsyncVerifyAndClearExpectations(1000);
}
- virtual void TearDown() {
- crypto_manager->ReleaseSSLContext(server_ctx);
- client_manager->ReleaseSSLContext(client_ctx);
+ void InitSecurityManager() {
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_2,
+ kAllCiphers);
+ const bool crypto_manager_initialization = crypto_manager_->Init();
+ ASSERT_TRUE(crypto_manager_initialization);
}
- static security_manager::CryptoManager* crypto_manager;
- static security_manager::CryptoManager* client_manager;
- security_manager::SSLContext *server_ctx;
- security_manager::SSLContext *client_ctx;
-};
+ void SetInitialValues(security_manager::Mode mode,
+ security_manager::Protocol protocol,
+ const std::string& cipher) {
+ ON_CALL(*mock_security_manager_settings_, security_manager_mode())
+ .WillByDefault(Return(mode));
+ ON_CALL(*mock_security_manager_settings_,
+ security_manager_protocol_name()).WillByDefault(Return(protocol));
+ ON_CALL(*mock_security_manager_settings_, certificate_data())
+ .WillByDefault(ReturnRef(certificate_data_base64_));
+ ON_CALL(*mock_security_manager_settings_, ciphers_list())
+ .WillByDefault(ReturnRef(cipher));
+ ON_CALL(*mock_security_manager_settings_, ca_cert_path())
+ .WillByDefault(ReturnRef(kCaCertPath));
+ ON_CALL(*mock_security_manager_settings_, verify_peer())
+ .WillByDefault(Return(false));
+ }
-security_manager::CryptoManager* SSLTest::crypto_manager;
-security_manager::CryptoManager* SSLTest::client_manager;
+ security_manager::CryptoManager* crypto_manager_;
+ static std::string certificate_data_base64_;
-TEST(CryptoManagerTest, UsingBeforeInit) {
- security_manager::CryptoManager *crypto_manager = new security_manager::CryptoManagerImpl();
- EXPECT_TRUE(crypto_manager->CreateSSLContext() == NULL);
- EXPECT_EQ(crypto_manager->LastError(), std::string ("Initialization is not completed"));
- delete crypto_manager;
+ NiceMock<security_manager_test::MockCryptoManagerSettings>*
+ mock_security_manager_settings_;
+};
+std::string CryptoManagerTest::certificate_data_base64_;
+
+TEST_F(CryptoManagerTest, UsingBeforeInit) {
+ EXPECT_TRUE(crypto_manager_->CreateSSLContext() == NULL);
+ EXPECT_EQ(std::string("Initialization is not completed"),
+ crypto_manager_->LastError());
}
-TEST(CryptoManagerTest, WrongInit) {
- security_manager::CryptoManager *crypto_manager = new security_manager::CryptoManagerImpl();
+TEST_F(CryptoManagerTest, WrongInit) {
+ // We have to cast (-1) to security_manager::Protocol Enum to be accepted by
+ // crypto_manager_->Init(...)
+ // Unknown protocol version
+ security_manager::Protocol UNKNOWN =
+ static_cast<security_manager::Protocol>(-1);
- //We have to cast (-1) to security_manager::Protocol Enum to be accepted by crypto_manager->Init(...)
- security_manager::Protocol UNKNOWN = static_cast<security_manager::Protocol>(-1);
+ EXPECT_CALL(*mock_security_manager_settings_, security_manager_mode())
+ .WillRepeatedly(Return(security_manager::SERVER));
+ EXPECT_CALL(*mock_security_manager_settings_, security_manager_protocol_name())
+ .WillOnce(Return(UNKNOWN));
+ EXPECT_FALSE(crypto_manager_->Init());
- // Unknown protocol version
- EXPECT_FALSE(crypto_manager->Init(security_manager::SERVER, UNKNOWN,
- "mycert.pem", "mykey.pem", FORD_CIPHER, false));
-
- EXPECT_FALSE(crypto_manager->LastError().empty());
- // Unexistent cert file
- EXPECT_FALSE(crypto_manager->Init(security_manager::SERVER, security_manager::TLSv1_2,
- "unexists_file.pem", "mykey.pem", FORD_CIPHER, false));
- EXPECT_FALSE(crypto_manager->LastError().empty());
- // Unexistent key file
- EXPECT_FALSE(crypto_manager->Init(security_manager::SERVER, security_manager::TLSv1_2,
- "mycert.pem", "unexists_file.pem", FORD_CIPHER, false));
- EXPECT_FALSE(crypto_manager->LastError().empty());
+ EXPECT_NE( std::string(),crypto_manager_->LastError());
// Unexistent cipher value
- EXPECT_FALSE(crypto_manager->Init(security_manager::SERVER, security_manager::TLSv1_2,
- "mycert.pem", "mykey.pem", "INVALID_UNKNOWN_CIPHER", false));
- EXPECT_FALSE(crypto_manager->LastError().empty());
+ const std::string invalid_cipher = "INVALID_UNKNOWN_CIPHER";
+ EXPECT_CALL(*mock_security_manager_settings_, security_manager_protocol_name())
+ .WillOnce(Return(security_manager::TLSv1_2));
+ EXPECT_CALL(*mock_security_manager_settings_, certificate_data())
+ .WillOnce(ReturnRef(certificate_data_base64_));
+ EXPECT_CALL(*mock_security_manager_settings_, ciphers_list())
+ .WillRepeatedly(ReturnRef(invalid_cipher));
+ EXPECT_FALSE(crypto_manager_->Init());
+
+ EXPECT_NE(std::string(), crypto_manager_->LastError());
+}
- delete crypto_manager;
+// #ifndef __QNXNTO__
+TEST_F(CryptoManagerTest, CorrectInit) {
+ // Empty cert and key values for SERVER
+ SetInitialValues(security_manager::SERVER,
+ security_manager::TLSv1_2,
+ kFordCipher);
+ EXPECT_TRUE(crypto_manager_->Init());
+
+ // Recall init
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_2,
+ kFordCipher);
+ EXPECT_TRUE(crypto_manager_->Init());
+
+ // Recall init with other protocols
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_2,
+ kFordCipher);
+ EXPECT_TRUE(crypto_manager_->Init());
+
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_1,
+ kFordCipher);
+ EXPECT_TRUE(crypto_manager_->Init());
+
+ // Cipher value
+ SetInitialValues(security_manager::SERVER,
+ security_manager::TLSv1_2,
+ kAllCiphers);
+ EXPECT_TRUE(crypto_manager_->Init());
}
+// #endif // __QNX__
-//TEST(CryptoManagerTest, CorrectInit) {
-// security_manager::CryptoManager *crypto_manager = new security_manager::CryptoManagerImpl();
-// // Empty cert and key values for SERVER
-// EXPECT_TRUE(crypto_manager->Init(security_manager::SERVER, security_manager::TLSv1_2,
-// "", "", FORD_CIPHER, false));
-// EXPECT_TRUE(crypto_manager->LastError().empty());
-// // Recall init
-// EXPECT_TRUE(crypto_manager->Init(security_manager::CLIENT, security_manager::TLSv1_2,
-// "", "", FORD_CIPHER, false));
-// EXPECT_TRUE(crypto_manager->LastError().empty());
-// // Recall init with other protocols
-// EXPECT_TRUE(crypto_manager->Init(security_manager::CLIENT, security_manager::TLSv1_1,
-// "", "", FORD_CIPHER, false));
-// EXPECT_TRUE(crypto_manager->LastError().empty());
-// EXPECT_TRUE(crypto_manager->Init(security_manager::CLIENT, security_manager::TLSv1,
-// "", "", FORD_CIPHER, false));
-// EXPECT_TRUE(crypto_manager->LastError().empty());
-
-// // Cipher value
-// EXPECT_TRUE(crypto_manager->Init(security_manager::SERVER, security_manager::TLSv1_2,
-// "mycert.pem", "mykey.pem", ALL_CIPHERS, false));
-// EXPECT_TRUE(crypto_manager->LastError().empty());
-// delete crypto_manager;
-//}
-
-TEST(CryptoManagerTest, ReleaseNull) {
- using security_manager::CryptoManager;
- using security_manager::CryptoManagerImpl;
-
- CryptoManager *cm = new CryptoManagerImpl();
- EXPECT_NO_THROW(cm->ReleaseSSLContext(NULL));
- delete cm;
+TEST_F(CryptoManagerTest, ReleaseSSLContext_Null) {
+ EXPECT_NO_THROW(crypto_manager_->ReleaseSSLContext(NULL));
}
-TEST_F(SSLTest, BrokenHandshake) {
- const uint8_t *server_buf;
- const uint8_t *client_buf;
- size_t server_buf_len;
- size_t client_buf_len;
- ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
- client_ctx->StartHandshake(&client_buf,
- &client_buf_len));
- ASSERT_FALSE(client_buf == NULL);
- ASSERT_GT(client_buf_len, 0u);
- // Broke 3 bytes for get abnormal fail of handshake
- const_cast<uint8_t*>(client_buf)[0] ^= 0xFF;
- const_cast<uint8_t*>(client_buf)[client_buf_len / 2] ^= 0xFF;
- const_cast<uint8_t*>(client_buf)[client_buf_len - 1] ^= 0xFF;
- ASSERT_EQ(security_manager::SSLContext::Handshake_Result_AbnormalFail,
- server_ctx->DoHandshakeStep(client_buf,
- client_buf_len,
- &server_buf,
- &server_buf_len));
+TEST_F(CryptoManagerTest, CreateReleaseSSLContext) {
+ const size_t max_payload_size = 1000u;
+ SetInitialValues(security_manager::CLIENT, security_manager::TLSv1_2,
+ kAllCiphers);
+ EXPECT_TRUE(crypto_manager_->Init());
+ EXPECT_CALL(*mock_security_manager_settings_, security_manager_mode())
+ .Times(2)
+ .WillRepeatedly(Return(security_manager::CLIENT));
+ EXPECT_CALL(*mock_security_manager_settings_, maximum_payload_size())
+ .Times(1)
+ .WillRepeatedly(Return(max_payload_size));
+
+ security_manager::SSLContext* context = crypto_manager_->CreateSSLContext();
+ EXPECT_TRUE(context);
+ EXPECT_NO_THROW(crypto_manager_->ReleaseSSLContext(context));
}
-// TODO(EZamakhov): split to SSL/TLS1/1.1/1.2 tests
-// TODO{ALeshin}: APPLINK-10846
-//TEST_F(SSLTest, Positive) {
-
-// const uint8_t *server_buf;
-// const uint8_t *client_buf;
-// size_t server_buf_len;
-// size_t client_buf_len;
-// ASSERT_EQ(client_ctx->StartHandshake(&client_buf,
-// &client_buf_len),
-// security_manager::SSLContext::Handshake_Result_Success);
-// ASSERT_FALSE(client_buf == NULL);
-// ASSERT_GT(client_buf_len, 0u);
-
-// for (;;) {
-// ASSERT_EQ(server_ctx->DoHandshakeStep(client_buf,
-// client_buf_len,
-// &server_buf,
-// &server_buf_len),
-// security_manager::SSLContext::Handshake_Result_Success);
-// ASSERT_FALSE(server_buf == NULL);
-// ASSERT_GT(server_buf_len, 0u);
-
-// ASSERT_EQ(client_ctx->DoHandshakeStep(server_buf,
-// server_buf_len,
-// &client_buf,
-// &client_buf_len),
-// security_manager::SSLContext::Handshake_Result_Success);
-// if (server_ctx->IsInitCompleted()) {
-// break;
-// }
-
-// ASSERT_FALSE(client_buf == NULL);
-// ASSERT_GT(client_buf_len, 0u);
-// }
-// // expect empty buffers after init complete
-// ASSERT_TRUE(client_buf == NULL);
-// ASSERT_EQ(client_buf_len, 0u);
-// // expect both side initialization complete
-// EXPECT_TRUE(client_ctx->IsInitCompleted());
-// EXPECT_TRUE(server_ctx->IsInitCompleted());
-
-// // Encrypt text on client side
-// const uint8_t *text = reinterpret_cast<const uint8_t*>("abra");
-// const uint8_t *encrypted_text = 0;
-// size_t text_len = 4;
-// size_t encrypted_text_len;
-// EXPECT_TRUE(client_ctx->Encrypt(text, text_len, &encrypted_text, &encrypted_text_len));
-
-// ASSERT_NE(encrypted_text, (void*)NULL);
-// ASSERT_GT(encrypted_text_len, 0u);
-
-// // Decrypt text on server side
-// EXPECT_TRUE(server_ctx->Decrypt(encrypted_text, encrypted_text_len, &text, &text_len));
-// ASSERT_NE(text, (void*)NULL);
-// ASSERT_GT(text_len, 0u);
-
-// ASSERT_EQ(strncmp(reinterpret_cast<const char*>(text),
-// "abra",
-// 4), 0);
-//}
-
-//TODO{Aleshin}: APPLINK-10846
-//TEST_F(SSLTest, EcncryptionFail) {
-
-// const uint8_t *server_buf;
-// const uint8_t *client_buf;
-// size_t server_buf_len;
-// size_t client_buf_len;
-// ASSERT_EQ(client_ctx->StartHandshake(&client_buf,
-// &client_buf_len),
-// security_manager::SSLContext::Handshake_Result_Success);
-
-// while (!server_ctx->IsInitCompleted()) {
-// ASSERT_FALSE(client_buf == NULL);
-// ASSERT_GT(client_buf_len, 0u);
-// ASSERT_EQ(server_ctx->DoHandshakeStep(client_buf, client_buf_len,
-// &server_buf, &server_buf_len),
-// security_manager::SSLContext::Handshake_Result_Success);
-// ASSERT_FALSE(server_buf == NULL);
-// ASSERT_GT(server_buf_len, 0u);
-
-// ASSERT_EQ(client_ctx->DoHandshakeStep(server_buf, server_buf_len,
-// &client_buf, &client_buf_len),
-// security_manager::SSLContext::Handshake_Result_Success);
-// }
-// // expect empty buffers after init complete
-// ASSERT_TRUE(client_buf == NULL);
-// ASSERT_EQ(client_buf_len, 0u);
-// // expect both side initialization complete
-// EXPECT_TRUE(client_ctx->IsInitCompleted());
-// EXPECT_TRUE(server_ctx->IsInitCompleted());
-
-// // Encrypt text on client side
-// const uint8_t *text = reinterpret_cast<const uint8_t*>("abra");
-// const uint8_t *encrypted_text = 0;
-// size_t text_len = 4;
-// size_t encrypted_text_len;
-// EXPECT_TRUE(client_ctx->Encrypt(text, text_len, &encrypted_text, &encrypted_text_len));
-// ASSERT_NE(encrypted_text, (void*)NULL);
-// ASSERT_GT(encrypted_text_len, 0u);
-
-// std::vector<uint8_t> broken(encrypted_text, encrypted_text + encrypted_text_len);
-// // Broke message
-// broken[encrypted_text_len / 2] ^= 0xFF;
-
-// const uint8_t *out_text;
-// size_t out_text_size;
-// // Decrypt broken text on server side
-// EXPECT_FALSE(server_ctx->Decrypt(&broken[0], broken.size(), &out_text, &out_text_size));
-
-// // Check after broken message that server encryption and decryption fail
-// // Encrypte message on server side
-// EXPECT_FALSE(server_ctx->Decrypt(encrypted_text, encrypted_text_len, &out_text, &out_text_size));
-// EXPECT_FALSE(server_ctx->Encrypt(text, text_len, &encrypted_text, &encrypted_text_len));
-//}
+TEST_F(CryptoManagerTest, OnCertificateUpdated) {
+ InitSecurityManager();
+ EXPECT_TRUE(crypto_manager_->OnCertificateUpdated(certificate_data_base64_));
+}
-/*
- TEST_F(SSLTest, DISABLED_BadData) {
- using security_manager::LastError;
- int res = 0;
-
- uint8_t *outBuf = new uint8_t[1024 * 1024];
- const uint8_t *inBuf;
-
- for(;;) {
- res = SSL_do_handshake(connection);
- if (res >= 0) {
- break;
- }
-
- if (isErrorFatal(connection, res)) {
- break;
- }
-
- size_t outLen = BIO_ctrl_pending(bioOut);
- if (outLen) {
- BIO_read(bioOut, outBuf, outLen);
- }
- size_t inLen;
- server_ctx->DoHandshakeStep(outBuf, outLen, &inBuf, &inLen);
- EXPECT_TRUE(inBuf != NULL);
-
- if (inLen) {
- BIO_write(bioIn, inBuf, inLen);
- }
- }
- delete[] outBuf;
-
- EXPECT_EQ(res, 1);
-
- BIO *bioF = BIO_new(BIO_f_ssl());
- BIO_set_ssl(bioF, connection, BIO_NOCLOSE);
-
- const char *text = "Hello, it's the text to be encrypted";
- uint8_t *encryptedText = new uint8_t[1024];
- const uint8_t *decryptedText;
- size_t text_len;
-
- // Encrypt text on client side
- BIO_write(bioF, text, sizeof(text));
- text_len = BIO_ctrl_pending(bioOut);
- size_t len = BIO_read(bioOut, encryptedText, text_len);
-
- // Make improvements
- encryptedText[len / 3] ^= 0x80;
-
- // Decrypt text on server
- server_ctx->Decrypt(encryptedText, len, &decryptedText, &text_len);
-
- delete[] encryptedText;
-
- EXPECT_FALSE(decryptedText == NULL);
- EXPECT_GT(LastError().length(), 0u);
- delete[] encryptedText;
- }
-
-
-
- TEST_F(SSLTest, Positive2) {
- using security_manager::LastError;
- int res = 0;
-
- uint8_t *outBuf = new uint8_t[1024 * 1024];
- const uint8_t *inBuf;
-
- for(;;) {
- res = SSL_do_handshake(connection);
- if (res >= 0) {
- break;
- }
-
- if (isErrorFatal(connection, res)) {
- break;
- }
-
- size_t outLen = BIO_ctrl_pending(bioOut);
- if (outLen) {
- BIO_read(bioOut, outBuf, outLen);
- }
- size_t inLen;
- server_ctx->DoHandshakeStep(outBuf, outLen, &inBuf, &inLen);
- EXPECT_TRUE(inBuf != NULL);
-
- if (inLen) {
- BIO_write(bioIn, inBuf, inLen);
- }
- }
- delete[] outBuf;
-
- EXPECT_EQ(res, 1);
-
- EXPECT_NE(SSL_is_init_finished(connection), 0u);
-
- BIO *bioF = BIO_new(BIO_f_ssl());
- BIO_set_ssl(bioF, connection, BIO_NOCLOSE);
-
- const int N =1000;
- int last_max = 0;
- int min_oh = N , max_oh = 0;
- for (int l = 1; l < N; ++l) {
- char *text = new char[l+1];
- text[l]='\0';
- uint8_t *encryptedText = new uint8_t[1024*N];
- const uint8_t *decryptedText;
- size_t text_len;
- // Encrypt text on client side
- BIO_write(bioF, text, l);
- text_len = BIO_ctrl_pending(bioOut);
- size_t len = BIO_read(bioOut, encryptedText, text_len);
- const int temp = len - l;
- min_oh = temp < min_oh ? temp : min_oh;
- max_oh = temp > max_oh ? temp : max_oh;
- if (last_max < len) {
- std::cout << l << "->" << len;
- if (l > 1) {
- std::cout << ", last overhead = " << last_max << "-" << l-1
- << " = " << last_max - (l - 1) << "bytes || ";
- std::cout << " overhead = " << len << "-" << l
- << " = " << len - l << "bytes";
- }
- std::cout << std::endl;
- last_max = len;
-
- // Decrypt text on server
- server_ctx->Decrypt(encryptedText, len, &decryptedText, &text_len);
- const_cast<uint8_t*>(decryptedText)[text_len] = 0;
-
- EXPECT_TRUE(decryptedText != NULL);
- EXPECT_EQ(strcmp(reinterpret_cast<const char*>(decryptedText), text), 0u);
- delete[] text;
- }
- std::cout << " min = " << min_oh << ", max = " << max_oh << std::endl;
- }
- //*/
+TEST_F(CryptoManagerTest, OnCertificateUpdated_UpdateNotRequired) {
+ size_t updates_before = 0;
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_2,
+ kAllCiphers);
+ ASSERT_TRUE(crypto_manager_->Init());
+
+ EXPECT_CALL(*mock_security_manager_settings_, update_before_hours())
+ .WillOnce(Return(updates_before));
+
+ EXPECT_FALSE(crypto_manager_->IsCertificateUpdateRequired());
+ size_t max_updates_ = std::numeric_limits<size_t>::max();
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_2,
+ kAllCiphers);
+ EXPECT_CALL(*mock_security_manager_settings_, update_before_hours())
+ .WillOnce(Return(max_updates_));
+ ASSERT_TRUE(crypto_manager_->Init());
+
+ EXPECT_TRUE(crypto_manager_->IsCertificateUpdateRequired());
}
- // namespace crypto_manager_test
-} // namespace components
-} // namespace test
+TEST_F(CryptoManagerTest, OnCertificateUpdated_NotInitialized) {
+ EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(certificate_data_base64_));
+}
+
+TEST_F(CryptoManagerTest, OnCertificateUpdated_NullString) {
+ InitSecurityManager();
+ EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(std::string()));
+}
+
+TEST_F(CryptoManagerTest, OnCertificateUpdated_MalformedSign) {
+ InitSecurityManager();
+ // Corrupt the middle symbol
+ certificate_data_base64_[certificate_data_base64_.size() / 2] = '?';
+
+ EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(certificate_data_base64_));
+}
+
+TEST_F(CryptoManagerTest, OnCertificateUpdated_WrongInitFolder) {
+ SetInitialValues(security_manager::CLIENT,
+ security_manager::TLSv1_2,
+ kAllCiphers);
+ ASSERT_TRUE(crypto_manager_->Init());
+
+ const std::string certificate = "wrong_data";
+ ASSERT_FALSE(certificate.empty());
+
+ EXPECT_FALSE(crypto_manager_->OnCertificateUpdated(certificate));
+}
+
+} // namespace crypto_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/security_manager/test/include/security_manager_mock.h b/src/components/security_manager/test/include/security_manager_mock.h
deleted file mode 100644
index 886b022c37..0000000000
--- a/src/components/security_manager/test/include/security_manager_mock.h
+++ /dev/null
@@ -1,311 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef TEST_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_MOCK_H_
-#define TEST_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_MOCK_H_
-
-#include <gmock/gmock.h>
-#include <string>
-#include <list>
-#include "utils/byte_order.h"
-#include "security_manager/security_manager.h"
-#include "security_manager/ssl_context.h"
-#include "security_manager/security_query.h"
-
-namespace test {
-namespace components {
-namespace security_manager_test {
-
-/*
- * MOCK implementation of ::security_manager::SecurityManager
- */
-class SecurityManagerMock : public ::security_manager::SecurityManager {
- public:
- MOCK_METHOD1(set_session_observer,
- void(::protocol_handler::SessionObserver *));
- MOCK_METHOD1(set_protocol_handler,
- void(::protocol_handler::ProtocolHandler *));
- MOCK_METHOD1(set_crypto_manager,
- void(::security_manager::CryptoManager *));
- MOCK_METHOD4(SendInternalError,
- void(const uint32_t ,
- const uint8_t &,
- const std::string &,
- const uint32_t));
- MOCK_METHOD1(CreateSSLContext,
- ::security_manager::SSLContext * (const uint32_t &));
- MOCK_METHOD1(StartHandshake,
- void(uint32_t));
- MOCK_METHOD1(AddListener,
- void(::security_manager::SecurityManagerListener *));
- MOCK_METHOD1(RemoveListener,
- void(::security_manager::SecurityManagerListener *));
- // protocol_handler::ProtocolObserver part
- MOCK_METHOD1(OnMessageReceived,
- void(const ::protocol_handler::RawMessagePtr));
- MOCK_METHOD1(OnMobileMessageSent,
- void(const ::protocol_handler::RawMessagePtr));
-};
-
-/*
- * MOCK implementation of protocol_handler::SessionObserver interface
- */
-class SessionObserverMock : public protocol_handler::SessionObserver {
- public:
- MOCK_METHOD2(SetSSLContext,
- int (const uint32_t& key,
- security_manager::SSLContext* context));
- MOCK_METHOD2(GetSSLContext,
- security_manager::SSLContext* (
- const uint32_t& key,
- const protocol_handler::ServiceType& service_type));
- MOCK_METHOD2(SetProtectionFlag,
- void(
- const uint32_t& key,
- const protocol_handler::ServiceType& service_type));
- MOCK_METHOD5(OnSessionStartedCallback,
-
- uint32_t(
- const transport_manager::ConnectionUID &connection_handle,
- const uint8_t session_id,
- const ::protocol_handler::ServiceType &service_type,
- const bool is_protected, uint32_t* hash_id));
-
- MOCK_METHOD4(OnSessionEndedCallback,
- uint32_t(
- const transport_manager::ConnectionUID& connection_handle,
- const uint8_t sessionId,
- const uint32_t& hashCode,
- const protocol_handler::ServiceType& service_type));
-
- MOCK_METHOD1(OnApplicationFloodCallBack,
- void(const uint32_t&));
-
- MOCK_METHOD1(OnMalformedMessageCallback,
- void(const uint32_t&));
-
- MOCK_METHOD2(KeyFromPair,
- uint32_t(
- transport_manager::ConnectionUID connection_handle,
- uint8_t sessionId));
- MOCK_METHOD3(PairFromKey,
- void(
- uint32_t key,
- transport_manager::ConnectionUID* connection_handle,
- uint8_t* sessionId));
- MOCK_METHOD4(GetDataOnSessionKey,
- int32_t(uint32_t key,
- uint32_t* app_id,
- std::list<int32_t>* sessions_list,
- uint32_t* device_id));
-
- MOCK_METHOD4(GetDataOnDeviceID,
- int32_t(
- uint32_t device_handle,
- std::string* device_name,
- std::list<uint32_t>* applications_list,
- std::string* mac_address));
-
- MOCK_METHOD5(GetDataOnDeviceID,
- int32_t(
- uint32_t device_handle,
- std::string *device_name,
- std::list<uint32_t> *applications_list,
- std::string *mac_address,
- std::string *connection_type));
-
- MOCK_METHOD2(IsHeartBeatSupported,
- bool( transport_manager::ConnectionUID connection_handle,
- uint8_t session_id));
-
- MOCK_METHOD3(ProtocolVersionUsed,
- bool(uint32_t connection_id, uint8_t session_id,
- uint8_t& protocol_version));
-};
-/*
- * MOCK implementation of protocol_handler::ProtocolObserver interface
- */
-class ProtocoloObserverMock : public protocol_handler::ProtocolHandler {
- public:
- MOCK_METHOD2(SendMessageToMobileApp,
- void(const protocol_handler::RawMessagePtr message,
- bool final_message));
- MOCK_METHOD1(AddProtocolObserver,
- void(protocol_handler::ProtocolObserver* observer));
- MOCK_METHOD1(RemoveProtocolObserver,
- void(protocol_handler::ProtocolObserver* observer));
- MOCK_METHOD2(SendFramesNumber,
- void(uint32_t connection_key, int32_t number_of_frames));
- MOCK_METHOD2(SendHeartBeat,
- void(int32_t connection_id, uint8_t session_id));
- MOCK_METHOD2(SendEndSession,
- void(int32_t connection_id, uint8_t session_id));
-};
-/*
- * MOCK implementation of security_manager::SSLContext interface
- */
-class CryptoManagerMock : public security_manager::CryptoManager {
- public:
- MOCK_METHOD6(Init,
- bool (security_manager::Mode mode,
- security_manager::Protocol protocol,
- const std::string& cert_filename,
- const std::string& key_filename,
- const std::string& ciphers_list,
- bool verify_peer));
- MOCK_METHOD0(Finish,
- void ());
- MOCK_METHOD0(CreateSSLContext,
- security_manager::SSLContext* ());
- MOCK_METHOD1(ReleaseSSLContext,
- void(security_manager::SSLContext*));
- MOCK_CONST_METHOD0(LastError,
- std::string());
-};
-/*
- * MOCK implementation of security_manager::SSLContext interface
- */
-class SSLContextMock : public security_manager::SSLContext {
- public:
- MOCK_CONST_METHOD0(mode, int ());
- MOCK_METHOD2(StartHandshake,
- security_manager::SSLContext::HandshakeResult (
- const uint8_t** const, size_t*));
- MOCK_METHOD4(DoHandshakeStep,
- security_manager::SSLContext::HandshakeResult (
- const uint8_t* const, size_t,
- const uint8_t** const, size_t*));
- MOCK_METHOD4(Encrypt,
- bool (const uint8_t* const, size_t,
- const uint8_t** const, size_t*));
- MOCK_METHOD4(Decrypt,
- bool (const uint8_t* const, size_t,
- const uint8_t** const, size_t*));
- MOCK_CONST_METHOD1(get_max_block_size, size_t (size_t));
- MOCK_CONST_METHOD0(IsInitCompleted, bool());
- MOCK_CONST_METHOD0(IsHandshakePending, bool());
- MOCK_CONST_METHOD0(LastError,
- std::string());
-};
-/*
- * MOCK implementation of security_manager::SecurityManagerListener
- */
-class SMListenerMock : public security_manager::SecurityManagerListener {
- public:
- MOCK_METHOD2(OnHandshakeDone,
- bool(uint32_t connection_key,
- bool success));
-};
-
-/*
- * Matcher for RawMessages
- * Check binary data of RawMessages
- */
-MATCHER_P2(RawMessageEq, exp_data, exp_data_size,
- std::string(negation ? "is not" : "is") + " RawMessages "){
- const size_t arg_data_size = arg->data_size();
- if (arg_data_size != exp_data_size) {
- *result_listener << "Got " << arg_data_size << " bytes "
- << " expected " << exp_data_size << " bytes";
- return false;
- }
- const uint8_t *arg_data = arg->data();
- for (int i = 0; i < arg_data_size; ++i) {
- if (arg_data[i] != exp_data[i]) {
- *result_listener << "Fail in " << i << " byte";
- return false;
- }
- }
- return true;
-}
-
-/*
- * Matcher for checking RawMessage with InternalError Query
- * Check error id
- */
-MATCHER_P(InternalErrorWithErrId, expectedErrorId,
- std::string(negation ? "is not" : "is")
- + " InternalError with selected error" ){
- const size_t header_size = sizeof(security_manager::SecurityQuery::QueryHeader);
- if (arg->data_size() <= header_size) {
- *result_listener << "Size " << arg->data_size()
- << " bytes less or equal sizeof(QueryHeader)="
- << header_size;
- return false;
- }
- const uint8_t *data = arg->data();
- const uint8_t query_type = data[0];
- if (security_manager::SecurityQuery::NOTIFICATION != query_type) {
- *result_listener << "RawMessage is not notification, type=0x"
- << std::hex << static_cast<int>(query_type);
- return false;
- }
- // Read Big-Endian number
- const uint32_t query_id = data[1] << 16 |
- data[2] << 8 |
- data[3];
- if (security_manager::SecurityQuery::SEND_INTERNAL_ERROR != query_id) {
- *result_listener << "Notification is not InternalError, id=0x"
- << std::hex << query_id;
- return false;
- }
- const uint32_t json_size = data[8] << 24 |
- data[9] << 16 |
- data[10] << 8 |
- data[11];
- if (header_size + json_size >= arg->data_size()) {
- *result_listener << "InternalError contains only JSON data.";
- return false;
- }
- // Read err_id as bin data number
- const uint8_t* err_id =
- reinterpret_cast<const uint8_t*>(data + header_size + json_size);
- if (expectedErrorId != *err_id) {
- *result_listener << "InternalError id " << static_cast<int>(*err_id)
- << " and not equal error " << expectedErrorId;
- return false;
- }
- return true;
-}
-
-} // namespace security_manager_test
-} // namespace components
-} // namespace test
-/*
- * Matcher for checking QueryHeader equal in GTests
- */
-::testing::AssertionResult QueryHeader_EQ(
- const char* m_expr, const char* n_expr,
- const ::security_manager::SecurityQuery::QueryHeader& q1,
- const ::security_manager::SecurityQuery::QueryHeader& q2);
-
-#endif // TEST_COMPONENTS_SECURITY_MANAGER_INCLUDE_SECURITY_MANAGER_SECURITY_MANAGER_MOCK_H_
diff --git a/src/components/security_manager/test/mycert.pem b/src/components/security_manager/test/mycert.pem
new file mode 100644
index 0000000000..fe8be6970e
--- /dev/null
+++ b/src/components/security_manager/test/mycert.pem
@@ -0,0 +1,22 @@
+-----BEGIN CERTIFICATE-----
+MIIDlDCCAnwCCQDIe7AwFpWRlDANBgkqhkiG9w0BAQUFADCBizELMAkGA1UEBhMC
+UlUxEzARBgNVBAgMClNvbWUtU3RhdGUxGTAXBgNVBAcMEFNhaW50LVBldGVyc2J1
+cmcxDzANBgNVBAoMBkx1eG9mdDEXMBUGA1UEAwwORG1pdHJ5IENobWVyZXYxIjAg
+BgkqhkiG9w0BCQEWE2RjaG1lcmV2QGx1eG9mdC5jb20wHhcNMTQwMjI1MDkxODUz
+WhcNMTYxMTIyMDkxODUzWjCBizELMAkGA1UEBhMCUlUxEzARBgNVBAgMClNvbWUt
+U3RhdGUxGTAXBgNVBAcMEFNhaW50LVBldGVyc2J1cmcxDzANBgNVBAoMBkx1eG9m
+dDEXMBUGA1UEAwwORG1pdHJ5IENobWVyZXYxIjAgBgkqhkiG9w0BCQEWE2RjaG1l
+cmV2QGx1eG9mdC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCn
+Mu9wNmXKaKOnefSv5iT8G2ESLjq+eYlxys/XAnDfkmnlgGYAcPno+XMhRj/lNV/c
+3A0L/R4631GFJA8vaM8m9Bn47FrPP4AXIHEQh9acA4qXiLfhhA8+9PPt4xVkjQYj
+bmexBLqDvRgT3MJwwFecUn/UABBlVZRCspn+6DkjiodbgmBOqyi1p0ng8BFeUbEH
++fLQVILCX3pjnMiP2bBtvq/7njgZT2luVtAAcOdRwRTuZT0YbgaXrHYsOa6VYDl1
+I0uOcdD8qENBXtBnykEqH+jZtKu6Rej1DsGOYWqz3AAaGiR1GJauNBxh+4v+i/eB
+0aCIA8T8qUqyuVVg48S/AgMBAAEwDQYJKoZIhvcNAQEFBQADggEBACliraOJYijK
+yS+Sl6S6pFRqdF/evPdYF6zDJlM3P+/9qHoEy751vbBTzRkVbC/azyiZLwQMuyED
+6oCpkI7MqnrRip1ZelGx9K7ChaHOpX/QRN+3eqiDhzvMTGd2nPJf9np4xi8SJpGP
+UUROYI5fToIY5MaOKuOIR2a6c8xIuLWMG1XKJxXrRetLJZDgBqQPkuqaZIjYCY+q
+HQRjNUFNX4Mc453tKd90gFLGI3fxs1fJDIRSGfKJsj0qc+amSz4Sgiz4QUBcUQKd
+hJxUpStYhliZGZchEopLsShtIGfKKFaaPCIOTpVAwSr1oIDm9lpkdxeuQfedKT5f
+ZZmkez2pAF8=
+-----END CERTIFICATE-----
diff --git a/src/components/security_manager/test/mykey.pem b/src/components/security_manager/test/mykey.pem
new file mode 100644
index 0000000000..20c89546b4
--- /dev/null
+++ b/src/components/security_manager/test/mykey.pem
@@ -0,0 +1,27 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIEowIBAAKCAQEApzLvcDZlymijp3n0r+Yk/BthEi46vnmJccrP1wJw35Jp5YBm
+AHD56PlzIUY/5TVf3NwNC/0eOt9RhSQPL2jPJvQZ+Oxazz+AFyBxEIfWnAOKl4i3
+4YQPPvTz7eMVZI0GI25nsQS6g70YE9zCcMBXnFJ/1AAQZVWUQrKZ/ug5I4qHW4Jg
+TqsotadJ4PARXlGxB/ny0FSCwl96Y5zIj9mwbb6v+544GU9pblbQAHDnUcEU7mU9
+GG4Gl6x2LDmulWA5dSNLjnHQ/KhDQV7QZ8pBKh/o2bSrukXo9Q7BjmFqs9wAGhok
+dRiWrjQcYfuL/ov3gdGgiAPE/KlKsrlVYOPEvwIDAQABAoIBAQCAjkNXzhuZ87bR
+UI34qUYKqaqLZgw45A3v9naz5OaQoGzXz0+eSz98CECjdvYt8EoS8Qb/DtGthoOR
+kVYzp6yPUOSfZmu0Kij8ny8P/MHgF0D6nl50ASwPxhu/7vhF5cCwgXUswGwAWuYm
+b3j5ZIp4YV5zzNDOeWyTk+uf+UHltqFD7Ae4M9z58r17/OWhva5mtusTuuEYjzC6
+AE/fsOC0gLNSM4+SfclfCkHpH+GikzNMSQ2H0hlXllPmR73BoC6N6aoY5hQWBLV7
+LxtYbJqx7TAqRyypBQekjJe36roRetXtzy3i6V/y69045td5kk70cVjmFhl79475
+82rnRLHBAoGBANgq4axr5OotTUmPkGd0afoaWSRPJfiTTdNeMkqTzM6zIcVLSKhB
+78ERwdDD9FOu+Bgivg4DlpmH7ArWn8QNDtdkhmPfKYfTqX6qH7AK4cybvYICMlct
+EdW4TvKm/ZB3mrVOP9JVPjdyFMp+Je6N+qp1w+ui9mxX8pWnrC/+DfTvAoGBAMYC
+GFjnw/O9hjF2Mb00qUarmM+reJZMXv/pVik+cm0eAiYvgGvKbAYkIXwdb7rLBw9k
+baJmxP0PrAoXy5TpPdfROqPwrRCyReKymKkEZeTpONgD0s8MbX167ovZu1OQVKQo
+IyJeUzWa0kpglnbL2lLVu49x8jWHDJdYhmkDNE0xAoGAR4ux07qGMoe5693rYoJi
+TRgJZv4XSDWg7ZNgu9Q9VjBtvfoT2zSvoMw6xNkGdegUTxC4rLS9VKVrF48/o8ja
+n6my3T1QZpdEoxq1kDOZ1nm5eF03wii1nXH6F0/z3qvndZingPsbs4g7n2WvMkyl
+qWN+6++s9eEJ9kRftia1AdsCgYAUnU05nE97RcT9y0dcYmopMF5FaJ2yUBsn23wb
+6SNylsg0f4eIMVfTv9k4mbvzH4YJpTQAz2A81G/d0SJhy3Kj0GWhgcIS1eyOsHdS
+SWHuVhWT77n30lxnzu+c4bst9P3K5V7bCiTxlL/F/I5NqeV98ECJq5xC1F+MNiww
+LKQ6UQKBgC2zL59Vf8QnRkRN0gOUfs3ejrLcxFRzTXvcKqcHtbaqzCs3qSNC6UvV
+wjBazEwQCo1wnM81X8uT5fLhnjXebWtnYexQo5P38PiaqTQDgrbAdhP5P8NwRCXM
+G3SNEz0XeL27jmWjf0VJdwD0LuHXYhcwAWq4alhJ024rjgVHwOze
+-----END RSA PRIVATE KEY-----
diff --git a/src/components/security_manager/test/security_manager_test.cc b/src/components/security_manager/test/security_manager_test.cc
index 30f81ee62e..93bdd3f7d0 100644
--- a/src/components/security_manager/test/security_manager_test.cc
+++ b/src/components/security_manager/test/security_manager_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,21 +30,20 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
#include <string>
+#include "gtest/gtest.h"
#include "utils/byte_order.h"
#include "protocol/common.h"
#include "security_manager/security_manager_impl.h"
-#include "protocol_handler_mock.h"
-#include "protocol_observer_mock.h"
-#include "include/security_manager_mock.h"
-#include "transport_manager_mock.h"
-
-// TODO(EZamakhov): add test on get correct/wrong InternalError
-// TODO(EZamakhov): check connection_key the same and seq_number
-// TODO(EZamakhov): check ::SendData with correct query_id and query_type
+#include "protocol_handler/mock_protocol_handler.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "transport_manager/transport_manager_mock.h"
+#include "security_manager/mock_security_manager.h"
+#include "security_manager/mock_ssl_context.h"
+#include "security_manager/mock_crypto_manager.h"
+#include "security_manager/mock_security_manager_listener.h"
namespace test {
namespace components {
@@ -62,14 +61,14 @@ const ServiceType secureServiceType = kControl;
const uint32_t protocolVersion = PROTOCOL_VERSION_2;
const bool is_final = false;
-const uint8_t handshake_data[] = { 0x1, 0x2, 0x3, 0x4, 0x5 };
-const size_t handshake_data_size = sizeof(handshake_data)
- / sizeof(handshake_data[0]);
+const uint8_t handshake_data[] = {0x1, 0x2, 0x3, 0x4, 0x5};
+const size_t handshake_data_size =
+ sizeof(handshake_data) / sizeof(handshake_data[0]);
-uint8_t handshake_data_out[] = { 0x6, 0x7, 0x8 };
-uint8_t *handshake_data_out_pointer = handshake_data_out;
-const size_t handshake_data_out_size = sizeof(handshake_data_out)
- / sizeof(handshake_data_out[0]);
+uint8_t handshake_data_out[] = {0x6, 0x7, 0x8};
+uint8_t* handshake_data_out_pointer = handshake_data_out;
+const size_t handshake_data_out_size =
+ sizeof(handshake_data_out) / sizeof(handshake_data_out[0]);
using ::security_manager::SecurityQuery;
using security_manager_test::InternalErrorWithErrId;
@@ -91,10 +90,12 @@ class SecurityManagerTest : public ::testing::Test {
}
void TearDown() OVERRIDE {
// Wait call methods in thread
- usleep(100000);
+ testing::Mock::AsyncVerifyAndClearExpectations(1000);
}
- void SetMockCryptoManger() {
+ void SetMockCryptoManager() {
+ EXPECT_CALL(mock_crypto_manager, IsCertificateUpdateRequired())
+ .WillRepeatedly(Return(false));
security_manager_->set_crypto_manager(&mock_crypto_manager);
}
/*
@@ -130,7 +131,7 @@ class SecurityManagerTest : public ::testing::Test {
/*
* Wrapper for fast emulate recieve Handshake
*/
- void EmulateMobileMessageHandShake(const uint8_t* const data,
+ void EmulateMobileMessageHandshake(const uint8_t* const data,
const uint32_t data_size,
const int repeat_count = 1) {
const SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION,
@@ -142,12 +143,18 @@ class SecurityManagerTest : public ::testing::Test {
}
::utils::SharedPtr<SecurityManagerImpl> security_manager_;
// Strict mocks (same as all methods EXPECT_CALL().Times(0))
- testing::StrictMock<protocol_handler_test::SessionObserverMock> mock_session_observer;
- testing::StrictMock<protocol_handler_test::ProtocolHandlerMock> mock_protocol_handler;
- testing::StrictMock<security_manager_test::CryptoManagerMock> mock_crypto_manager;
- testing::StrictMock<security_manager_test::SSLContextMock> mock_ssl_context_new;
- testing::StrictMock<security_manager_test::SSLContextMock> mock_ssl_context_exists;
- testing::StrictMock<security_manager_test::SMListenerMock> mock_sm_listener;
+ testing::StrictMock<protocol_handler_test::MockSessionObserver>
+ mock_session_observer;
+ testing::StrictMock<protocol_handler_test::MockProtocolHandler>
+ mock_protocol_handler;
+ testing::StrictMock<security_manager_test::MockCryptoManager>
+ mock_crypto_manager;
+ testing::StrictMock<security_manager_test::MockSSLContext>
+ mock_ssl_context_new;
+ testing::StrictMock<security_manager_test::MockSSLContext>
+ mock_ssl_context_exists;
+ testing::StrictMock<security_manager_test::MockSecurityManagerListener>
+ mock_sm_listener;
};
// Test Bodies
@@ -186,12 +193,14 @@ TEST_F(SecurityManagerTest, Listeners_NoListeners) {
security_manager_->RemoveListener(&mock_sm_listener);
// Expect no calls
- testing::StrictMock<SMListenerMock> mock_listener2;
+ testing::StrictMock<MockSecurityManagerListener> mock_listener2;
security_manager_->AddListener(&mock_listener2);
security_manager_->RemoveListener(&mock_listener2);
- security_manager_->NotifyListenersOnHandshakeDone(key, true);
- security_manager_->NotifyListenersOnHandshakeDone(key, false);
+ security_manager_->NotifyListenersOnHandshakeDone(
+ key, SSLContext::Handshake_Result_Success);
+ security_manager_->NotifyListenersOnHandshakeDone(
+ key, SSLContext::Handshake_Result_Fail);
}
/*
* Notifying two listeners
@@ -200,23 +209,32 @@ TEST_F(SecurityManagerTest, Listeners_Notifying) {
// Check correct removing listener
security_manager_->RemoveListener(&mock_sm_listener);
- testing::StrictMock<SMListenerMock> mock_listener1;
- testing::StrictMock<SMListenerMock> mock_listener2;
+ testing::StrictMock<MockSecurityManagerListener> mock_listener1;
+ testing::StrictMock<MockSecurityManagerListener> mock_listener2;
- const bool first_call_value = true;
+ const SSLContext::HandshakeResult first_call_value =
+ SSLContext::Handshake_Result_Success;
// Expect call both listeners on 1st call
- EXPECT_CALL(mock_listener1, OnHandshakeDone(key, first_call_value)).
- // Emulate false (reject) result
- WillOnce(Return(false));
- EXPECT_CALL(mock_listener2, OnHandshakeDone(key, first_call_value)).
- // Emulate true (accept) result
- WillOnce(Return(true));
-
- const bool second_call_value = false;
+ EXPECT_CALL(mock_listener1, OnHandshakeDone(key, first_call_value))
+ .
+ // Emulate false (reject) result
+ WillOnce(Return(false));
+ EXPECT_CALL(mock_listener2, OnHandshakeDone(key, first_call_value))
+ .
+ // Emulate true (accept) result
+ WillOnce(Return(true));
+
+ // First listener was not removed from listener list
+ // So this callback wil lbe either call.
+ EXPECT_CALL(mock_listener1, OnCertificateUpdateRequired());
+
+ const SSLContext::HandshakeResult second_call_value =
+ SSLContext::Handshake_Result_Fail;
// Expect call last listener on 2d call
- EXPECT_CALL(mock_listener1, OnHandshakeDone(key, second_call_value)).
- // Emulate false (reject) result
- WillOnce(Return(true));
+ EXPECT_CALL(mock_listener1, OnHandshakeDone(key, second_call_value))
+ .
+ // Emulate false (reject) result
+ WillOnce(Return(true));
// Expect no call 3d call
@@ -224,11 +242,16 @@ TEST_F(SecurityManagerTest, Listeners_Notifying) {
security_manager_->AddListener(&mock_listener2);
// 1st call
security_manager_->NotifyListenersOnHandshakeDone(key, first_call_value);
+ security_manager_->NotifyOnCertififcateUpdateRequired();
// 2nd call
security_manager_->NotifyListenersOnHandshakeDone(key, second_call_value);
+ security_manager_->NotifyOnCertififcateUpdateRequired();
// 3nd call
- security_manager_->NotifyListenersOnHandshakeDone(key, false);
+ security_manager_->NotifyListenersOnHandshakeDone(
+ key, SSLContext::Handshake_Result_Fail);
+ security_manager_->NotifyOnCertififcateUpdateRequired();
}
+
/*
* SecurityManager with NULL CryptoManager shall send
* InternallError (ERROR_NOT_SUPPORTED) on any Query
@@ -237,14 +260,16 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
// Expect InternalError with ERROR_ID
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_NOT_SUPPORTED), is_final));
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_NOT_SUPPORTED),
+ is_final));
const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
// It could be any query id
SecurityQuery::INVALID_QUERY_ID);
@@ -256,7 +281,7 @@ TEST_F(SecurityManagerTest, SecurityManager_NULLCryptoManager) {
*/
TEST_F(SecurityManagerTest, OnMobileMessageSent) {
const ::protocol_handler::RawMessagePtr rawMessagePtr(
- new ::protocol_handler::RawMessage(key, protocolVersion, NULL, 0));
+ new ::protocol_handler::RawMessage(key, protocolVersion, NULL, 0));
security_manager_->OnMobileMessageSent(rawMessagePtr);
}
/*
@@ -276,14 +301,17 @@ TEST_F(SecurityManagerTest, GetWrongServiceType) {
TEST_F(SecurityManagerTest, GetEmptyQuery) {
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
- EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INVALID_QUERY_SIZE), is_final));
+ EXPECT_CALL(
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ is_final));
// Call with NULL data
call_OnMessageReceived(NULL, 0, secureServiceType);
}
@@ -291,20 +319,22 @@ TEST_F(SecurityManagerTest, GetEmptyQuery) {
* Shall send InternallError on null data recieved
*/
TEST_F(SecurityManagerTest, GetWrongJSONSize) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
// Expect InternalError with ERROR_ID
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INVALID_QUERY_SIZE), is_final));
- SecurityQuery::QueryHeader header(
- SecurityQuery::REQUEST,
- SecurityQuery::INVALID_QUERY_ID);
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ is_final));
+ SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
+ SecurityQuery::INVALID_QUERY_ID);
header.json_size = 0x0FFFFFFF;
EmulateMobileMessage(header, NULL, 0);
}
@@ -312,20 +342,22 @@ TEST_F(SecurityManagerTest, GetWrongJSONSize) {
* Shall send InternallError on INVALID_QUERY_ID
*/
TEST_F(SecurityManagerTest, GetInvalidQueryId) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
// Expect InternalError with ERROR_ID
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INVALID_QUERY_ID), is_final));
- const SecurityQuery::QueryHeader header(
- SecurityQuery::REQUEST,
- SecurityQuery::INVALID_QUERY_ID);
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_ID),
+ is_final));
+ const SecurityQuery::QueryHeader header(SecurityQuery::REQUEST,
+ SecurityQuery::INVALID_QUERY_ID);
const uint8_t data = 0;
EmulateMobileMessage(header, &data, 1);
}
@@ -334,111 +366,125 @@ TEST_F(SecurityManagerTest, GetInvalidQueryId) {
* CreateSSLContext for already protected connections
*/
TEST_F(SecurityManagerTest, CreateSSLContext_ServiceAlreadyProtected) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Return mock SSLContext
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(Return(&mock_ssl_context_new));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(Return(&mock_ssl_context_new));
- const security_manager::SSLContext* rezult = security_manager_->CreateSSLContext(key);
+ const security_manager::SSLContext* rezult =
+ security_manager_->CreateSSLContext(key);
EXPECT_EQ(rezult, &mock_ssl_context_new);
}
/*
* Shall send Internall Error on error create SSL
*/
TEST_F(SecurityManagerTest, CreateSSLContext_ErrorCreateSSL) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Expect InternalError with ERROR_ID
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INTERNAL), is_final));
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), is_final));
// Emulate SessionObserver and CryptoManager result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(ReturnNull());
- EXPECT_CALL(mock_crypto_manager, CreateSSLContext()).
- WillOnce(ReturnNull());
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(ReturnNull());
+ EXPECT_CALL(mock_crypto_manager, CreateSSLContext()).WillOnce(ReturnNull());
- const bool rezult = security_manager_->CreateSSLContext(key);
- EXPECT_FALSE(rezult);
+ const security_manager::SSLContext* rezult =
+ security_manager_->CreateSSLContext(key);
+ EXPECT_EQ(NULL, rezult);
}
/*
* Shall send InternalError with SERVICE_NOT_FOUND
* on getting any Error with call SetSSLContext
*/
TEST_F(SecurityManagerTest, CreateSSLContext_SetSSLContextError) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Expect InternalError with ERROR_ID
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_UNKWOWN_INTERNAL_ERROR), is_final));
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_UNKNOWN_INTERNAL_ERROR),
+ is_final));
// Emulate SessionObserver and CryptoManager result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(ReturnNull());
- EXPECT_CALL(mock_crypto_manager, CreateSSLContext()).
- WillOnce(Return(&mock_ssl_context_new));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(ReturnNull());
+ EXPECT_CALL(mock_crypto_manager, CreateSSLContext())
+ .WillOnce(Return(&mock_ssl_context_new));
EXPECT_CALL(mock_crypto_manager, ReleaseSSLContext(&mock_ssl_context_new));
- EXPECT_CALL(mock_session_observer, SetSSLContext(key, &mock_ssl_context_new)).
- WillOnce(Return(SecurityManager::ERROR_UNKWOWN_INTERNAL_ERROR));
+ EXPECT_CALL(mock_session_observer, SetSSLContext(key, &mock_ssl_context_new))
+ .WillOnce(Return(SecurityManager::ERROR_UNKNOWN_INTERNAL_ERROR));
- const bool rezult = security_manager_->CreateSSLContext(key);
- EXPECT_FALSE(rezult);
+ const security_manager::SSLContext* rezult =
+ security_manager_->CreateSSLContext(key);
+ EXPECT_EQ(NULL, rezult);
}
/*
* Shall protect connection on correct call CreateSSLContext
*/
TEST_F(SecurityManagerTest, CreateSSLContext_Success) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Expect no Errors
// Expect no notifying listeners - it will be done after handshake
// Emulate SessionObserver and CryptoManager result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(ReturnNull()).
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(ReturnNull())
+ .
// additional check for debug code
WillOnce(Return(&mock_ssl_context_exists));
- EXPECT_CALL(mock_crypto_manager, CreateSSLContext()).
- WillOnce(Return(&mock_ssl_context_new));
- EXPECT_CALL(mock_session_observer, SetSSLContext(key, &mock_ssl_context_new)).
- WillOnce(Return(SecurityManager::ERROR_SUCCESS));
+ EXPECT_CALL(mock_crypto_manager, CreateSSLContext())
+ .WillOnce(Return(&mock_ssl_context_new));
+ EXPECT_CALL(mock_session_observer, SetSSLContext(key, &mock_ssl_context_new))
+ .WillOnce(Return(SecurityManager::ERROR_SUCCESS));
- const bool rezult = security_manager_->CreateSSLContext(key);
- EXPECT_TRUE(rezult);
+ const security_manager::SSLContext* rezult =
+ security_manager_->CreateSSLContext(key);
+ EXPECT_EQ(rezult, &mock_ssl_context_new);
}
/*
* Shall send InternallError on call StartHandshake for uprotected service
*/
TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
// Expect InternalError with ERROR_INTERNAL
- EXPECT_CALL(mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INTERNAL), is_final));
+ EXPECT_CALL(
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), is_final));
// Expect notifying listeners (unsuccess)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, false)).WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Fail))
+ .WillOnce(Return(true));
// Emulate SessionObserver result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(ReturnNull());
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(ReturnNull());
security_manager_->StartHandshake(key);
}
@@ -446,32 +492,39 @@ TEST_F(SecurityManagerTest, StartHandshake_ServiceStillUnprotected) {
* Shall send InternallError on SSL error and notify listeners
*/
TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer, GetHandshakeContext(key))
+ .WillOnce(Return(security_manager::SSLContext::HandshakeContext()));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
// Expect InternalError with ERROR_ID
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INTERNAL), is_final));
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INTERNAL), is_final));
// Expect notifying listeners (unsuccess)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, false)).WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Fail))
+ .WillOnce(Return(true));
// Emulate SessionObserver result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(Return(&mock_ssl_context_exists));
- EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted()).
- WillOnce(Return(false));
- EXPECT_CALL(mock_ssl_context_exists, StartHandshake(_, _)).
- WillOnce(DoAll(SetArgPointee<0>(handshake_data_out_pointer),
- SetArgPointee<1>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Fail)));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(Return(&mock_ssl_context_exists));
+ EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
+ .WillOnce(Return(false));
+ EXPECT_CALL(mock_ssl_context_exists, SetHandshakeContext(_));
+ EXPECT_CALL(mock_ssl_context_exists, StartHandshake(_, _))
+ .WillOnce(
+ DoAll(SetArgPointee<0>(handshake_data_out_pointer),
+ SetArgPointee<1>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Fail)));
security_manager_->StartHandshake(key);
}
@@ -479,59 +532,69 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInternalError) {
* Shall send data on call StartHandshake
*/
TEST_F(SecurityManagerTest, StartHandshake_SSLInitIsNotComplete) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer, GetHandshakeContext(key))
+ .Times(3)
+ .WillRepeatedly(Return(security_manager::SSLContext::HandshakeContext()));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
// Expect send one message (with correct pointer and size data)
EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, is_final));
// Return mock SSLContext
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).Times(3).
- WillRepeatedly(Return(&mock_ssl_context_exists));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .Times(3)
+ .WillRepeatedly(Return(&mock_ssl_context_exists));
// Expect initialization check on each call StartHandshake
- EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted()).Times(3).
- WillRepeatedly(Return(false));
+ EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
+ .Times(3)
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(mock_ssl_context_exists, SetHandshakeContext(_)).Times(3);
// Emulate SSLContext::StartHandshake with different parameters
// Only on both correct - data and size shall be send message to mobile app
- EXPECT_CALL(mock_ssl_context_exists, StartHandshake(_, _)).
- WillOnce(DoAll(SetArgPointee<0>(handshake_data_out_pointer),
- SetArgPointee<1>(0),
- Return(security_manager::SSLContext::
- Handshake_Result_Success))).
- WillOnce(DoAll(SetArgPointee<0>((uint8_t*)NULL),
- SetArgPointee<1>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Success))).
- WillOnce(DoAll(SetArgPointee<0>(handshake_data_out_pointer),
- SetArgPointee<1>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Success)));
+ EXPECT_CALL(mock_ssl_context_exists, StartHandshake(_, _))
+ .WillOnce(DoAll(
+ SetArgPointee<0>(handshake_data_out_pointer), SetArgPointee<1>(0),
+ Return(security_manager::SSLContext::Handshake_Result_Success)))
+ .WillOnce(DoAll(
+ SetArgPointee<0>((uint8_t*)NULL),
+ SetArgPointee<1>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Success)))
+ .WillOnce(DoAll(
+ SetArgPointee<0>(handshake_data_out_pointer),
+ SetArgPointee<1>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Success)));
security_manager_->StartHandshake(key);
security_manager_->StartHandshake(key);
security_manager_->StartHandshake(key);
}
/*
- * Shall notify listeners on call StartHandshake after SSLContext initialization complete
+ * Shall notify listeners on call StartHandshake after SSLContext initialization
+ * complete
*/
TEST_F(SecurityManagerTest, StartHandshake_SSLInitIsComplete) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Expect no message send
// Expect notifying listeners (success)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, true)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Success))
+ .WillOnce(Return(true));
// Emulate SessionObserver result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(Return(&mock_ssl_context_exists));
- EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted()).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(Return(&mock_ssl_context_exists));
+ EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
+ .WillOnce(Return(true));
+ EXPECT_CALL(mock_crypto_manager, IsCertificateUpdateRequired())
+ .WillOnce(Return(false));
security_manager_->StartHandshake(key);
}
@@ -540,19 +603,22 @@ TEST_F(SecurityManagerTest, StartHandshake_SSLInitIsComplete) {
* getting SEND_HANDSHAKE_DATA with NULL data
*/
TEST_F(SecurityManagerTest, ProccessHandshakeData_WrongDataSize) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
// Expect InternalError with ERROR_ID
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_INVALID_QUERY_SIZE), is_final));
- EmulateMobileMessageHandShake(NULL, 0);
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_INVALID_QUERY_SIZE),
+ is_final));
+ EmulateMobileMessageHandshake(NULL, 0);
}
/*
* Shall send InternallError on
@@ -560,28 +626,32 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_WrongDataSize) {
* for service which is not protected
*/
TEST_F(SecurityManagerTest, ProccessHandshakeData_ServiceNotProtected) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Expect InternalError with ERROR_ID
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
+ // uint8_t protocol_version = 0;
EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _));
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .WillOnce(Return(true));
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_SERVICE_NOT_PROTECTED), is_final));
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_SERVICE_NOT_PROTECTED),
+ is_final));
// Expect notifying listeners (unsuccess)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, false)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Fail))
+ .WillOnce(Return(true));
// Emulate SessionObserver result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- WillOnce(ReturnNull());
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .WillOnce(ReturnNull());
const uint8_t data[] = {0x1, 0x2};
- EmulateMobileMessageHandShake(data, sizeof(data)/sizeof(data[0]));
+ EmulateMobileMessageHandshake(data, sizeof(data) / sizeof(data[0]));
}
/*
* Shall send InternallError on getting
@@ -589,60 +659,61 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_ServiceNotProtected) {
* data (DoHandshakeStep return NULL pointer)
*/
TEST_F(SecurityManagerTest, ProccessHandshakeData_InvalidData) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Count handshake calls
const int handshake_emulates = 4;
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
- EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _)).
- Times(handshake_emulates);
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- Times(handshake_emulates).
- WillRepeatedly(Return(true));
+ // uint8_t protocol_version = 0;
+ EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _))
+ .Times(handshake_emulates);
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(true));
// Expect InternalError with ERROR_ID
EXPECT_CALL(
- mock_protocol_handler,
- SendMessageToMobileApp( InternalErrorWithErrId( SecurityManager::ERROR_SSL_INVALID_DATA), is_final)).
- Times(handshake_emulates);
+ mock_protocol_handler,
+ SendMessageToMobileApp(
+ InternalErrorWithErrId(SecurityManager::ERROR_SSL_INVALID_DATA),
+ is_final)).Times(handshake_emulates);
// Expect notifying listeners (unsuccess)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, false)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Fail))
+ .WillOnce(Return(true));
// Emulate SessionObserver and CryptoManager result
- EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl)).
- Times(handshake_emulates).
- WillRepeatedly(Return(&mock_ssl_context_exists));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(&mock_ssl_context_exists));
// Emulate DoHandshakeStep fail logics
EXPECT_CALL(
- mock_ssl_context_exists, DoHandshakeStep(_, handshake_data_size, _, _)).
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_AbnormalFail))).
- WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_AbnormalFail))).
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(0),
- Return(security_manager::SSLContext::
- Handshake_Result_AbnormalFail))).
- WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
- SetArgPointee<3>(0),
- Return(security_manager::SSLContext::
- Handshake_Result_AbnormalFail)));
-
+ mock_ssl_context_exists,
+ DoHandshakeStep(HandshakeStepEq(handshake_data, handshake_data_size),
+ handshake_data_size, _, _))
+ .WillOnce(DoAll(
+ SetArgPointee<2>(handshake_data_out_pointer),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_AbnormalFail)))
+ .WillOnce(DoAll(
+ SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_AbnormalFail)))
+ .WillOnce(DoAll(
+ SetArgPointee<2>(handshake_data_out_pointer), SetArgPointee<3>(0),
+ Return(security_manager::SSLContext::Handshake_Result_AbnormalFail)))
+ .WillOnce(DoAll(
+ SetArgPointee<2>((uint8_t*)NULL), SetArgPointee<3>(0),
+ Return(security_manager::SSLContext::Handshake_Result_AbnormalFail)));
// On each wrong handshake will be asked error
- EXPECT_CALL(mock_ssl_context_exists, LastError()).
- Times(handshake_emulates);
+ EXPECT_CALL(mock_ssl_context_exists, LastError()).Times(handshake_emulates);
// Emulate handshare #handshake_emulates times for 5 cases
- EmulateMobileMessageHandShake(handshake_data, handshake_data_size,
+ EmulateMobileMessageHandshake(handshake_data, handshake_data_size,
handshake_emulates);
}
/*
@@ -650,50 +721,53 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_InvalidData) {
* with correct handshake data Check Fail and sussecc states
*/
TEST_F(SecurityManagerTest, ProccessHandshakeData_Answer) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
// Count handshake calls
const int handshake_emulates = 2;
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
- EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _)).
- Times(handshake_emulates);
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- Times(handshake_emulates).
- WillRepeatedly(Return(true));
-
- // Expect InternalError with ERROR_ID
- EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(
- // FIXME : !!!
- _, is_final)).
- Times(handshake_emulates);
+ // uint8_t protocol_version = 0;
+ EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _))
+ .Times(handshake_emulates);
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(true));
+
+ // Get size of raw message after
+ const size_t raw_message_size = 15;
+ EXPECT_CALL(mock_protocol_handler,
+ SendMessageToMobileApp(RawMessageEqSize(raw_message_size),
+ is_final)).Times(handshake_emulates);
// Expect notifying listeners (unsuccess)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, false)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Fail))
+ .WillOnce(Return(true));
// Emulate SessionObserver and CryptoManager result
- EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted()).
- Times(handshake_emulates).
- WillRepeatedly(Return(false));
- EXPECT_CALL(
- mock_session_observer, GetSSLContext(key, kControl)).
- Times(handshake_emulates).
- WillRepeatedly(Return(&mock_ssl_context_exists));
+ EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(&mock_ssl_context_exists));
// Emulate DoHandshakeStep correct logics
EXPECT_CALL(
- mock_ssl_context_exists, DoHandshakeStep(_, handshake_data_size, _, _)).
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Success))).
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Fail)));
-
- EmulateMobileMessageHandShake(handshake_data, handshake_data_size,
+ mock_ssl_context_exists,
+ DoHandshakeStep(HandshakeStepEq(handshake_data, handshake_data_size),
+ handshake_data_size, _, _))
+ .WillOnce(DoAll(
+ SetArgPointee<2>(handshake_data_out_pointer),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Success)))
+ .WillOnce(
+ DoAll(SetArgPointee<2>(handshake_data_out_pointer),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Fail)));
+
+ EmulateMobileMessageHandshake(handshake_data, handshake_data_size,
handshake_emulates);
}
/*
@@ -701,123 +775,123 @@ TEST_F(SecurityManagerTest, ProccessHandshakeData_Answer) {
* and return handshake data
* Check Fail and sussecc states
*/
-TEST_F(SecurityManagerTest, ProccessHandshakeData_HandShakeFinished) {
- SetMockCryptoManger();
+TEST_F(SecurityManagerTest, ProccessHandshakeData_HandshakeFinished) {
+ SetMockCryptoManager();
// Count handshake calls
const int handshake_emulates = 6;
// Expect no errors
// Expect notifying listeners (success)
- EXPECT_CALL(mock_sm_listener, OnHandshakeDone(key, true)).
- WillOnce(Return(true));
+ EXPECT_CALL(mock_sm_listener,
+ OnHandshakeDone(key, SSLContext::Handshake_Result_Success))
+ .WillOnce(Return(true));
// Emulate SessionObserver and CryptoManager result
+ EXPECT_CALL(mock_session_observer, GetSSLContext(key, kControl))
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(&mock_ssl_context_exists));
+ EXPECT_CALL(mock_ssl_context_exists, IsInitCompleted())
+ .Times(handshake_emulates)
+ .WillRepeatedly(Return(true));
+
EXPECT_CALL(
- mock_session_observer, GetSSLContext(key, kControl)).
- Times(handshake_emulates).
- WillRepeatedly(Return(&mock_ssl_context_exists));
- EXPECT_CALL(
- mock_ssl_context_exists, IsInitCompleted()).
- Times(handshake_emulates).
- WillRepeatedly(Return(true));
- // FIXME(EZamakhov): add DoHandshakeStep matcher for compare handshake data
- EXPECT_CALL(
- mock_ssl_context_exists, DoHandshakeStep(_, handshake_data_size, _, _)).
- // two states with correct out data
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Success))).
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Fail))).
- // two states with with null pointer data
- WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Success))).
- WillOnce(DoAll(SetArgPointee<2>((uint8_t*)NULL),
- SetArgPointee<3>(handshake_data_out_size),
- Return(security_manager::SSLContext::
- Handshake_Result_Fail))).
- // two states with with null data size
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(0),
- Return(security_manager::SSLContext::
- Handshake_Result_Success))).
- WillOnce(DoAll(SetArgPointee<2>(handshake_data_out_pointer),
- SetArgPointee<3>(0),
- Return(security_manager::SSLContext::
- Handshake_Result_Success)));
+ mock_ssl_context_exists,
+ DoHandshakeStep(HandshakeStepEq(handshake_data, handshake_data_size),
+ handshake_data_size, _, _))
+ .
+ // two states with correct out data
+ WillOnce(DoAll(
+ SetArgPointee<2>(handshake_data_out_pointer),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Success)))
+ .WillOnce(
+ DoAll(SetArgPointee<2>(handshake_data_out_pointer),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Fail)))
+ .
+ // two states with with null pointer data
+ WillOnce(DoAll(
+ SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Success)))
+ .WillOnce(
+ DoAll(SetArgPointee<2>((uint8_t*)NULL),
+ SetArgPointee<3>(handshake_data_out_size),
+ Return(security_manager::SSLContext::Handshake_Result_Fail)))
+ .
+ // two states with with null data size
+ WillOnce(DoAll(
+ SetArgPointee<2>(handshake_data_out_pointer), SetArgPointee<3>(0),
+ Return(security_manager::SSLContext::Handshake_Result_Success)))
+ .WillOnce(DoAll(
+ SetArgPointee<2>(handshake_data_out_pointer), SetArgPointee<3>(0),
+ Return(security_manager::SSLContext::Handshake_Result_Success)));
// Expect send two message (with correct pointer and size data)
uint32_t connection_id = 0;
uint8_t session_id = 0;
- //uint8_t protocol_version = 0;
- EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _)).
- Times(2);
- EXPECT_CALL(mock_session_observer, ProtocolVersionUsed(connection_id, session_id,_)).
- Times(2).
- WillRepeatedly(Return(true));
+ // uint8_t protocol_version = 0;
+ EXPECT_CALL(mock_session_observer, PairFromKey(key, _, _)).Times(2);
+ EXPECT_CALL(mock_session_observer,
+ ProtocolVersionUsed(connection_id, session_id, _))
+ .Times(2)
+ .WillRepeatedly(Return(true));
- EXPECT_CALL(
- mock_protocol_handler, SendMessageToMobileApp(_, is_final)).
- Times(2);
+ EXPECT_CALL(mock_protocol_handler, SendMessageToMobileApp(_, is_final))
+ .Times(2);
// Expect NO InternalError with ERROR_ID
- EmulateMobileMessageHandShake(handshake_data, handshake_data_size, handshake_emulates);
+ EmulateMobileMessageHandshake(handshake_data, handshake_data_size,
+ handshake_emulates);
}
/*
* Shall not any query on getting empty SEND_INTERNAL_ERROR
*/
TEST_F(SecurityManagerTest, GetInternalError_NullData) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
- const SecurityQuery::QueryHeader header( SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_INTERNAL_ERROR, 0);
+ const SecurityQuery::QueryHeader header(
+ SecurityQuery::NOTIFICATION, SecurityQuery::SEND_INTERNAL_ERROR, 0);
EmulateMobileMessage(header, NULL, 0);
}
/*
* Shall not send any query on getting SEND_INTERNAL_ERROR
*/
TEST_F(SecurityManagerTest, GetInternalError) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
- const SecurityQuery::QueryHeader header( SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_INTERNAL_ERROR, 0);
+ const SecurityQuery::QueryHeader header(
+ SecurityQuery::NOTIFICATION, SecurityQuery::SEND_INTERNAL_ERROR, 0);
const uint8_t data[] = {0x1, 0x2};
- EmulateMobileMessage(header, data, sizeof(data)/sizeof(data[0]));
+ EmulateMobileMessage(header, data, sizeof(data) / sizeof(data[0]));
}
/*
* Shall not send any query on getting SEND_INTERNAL_ERROR with error string
*/
TEST_F(SecurityManagerTest, GetInternalError_WithErrText) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
- SecurityQuery::QueryHeader header( SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_INTERNAL_ERROR, 0);
+ SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION,
+ SecurityQuery::SEND_INTERNAL_ERROR, 0);
std::string error("JSON wrong string");
header.json_size = error.size();
- EmulateMobileMessage(header,
- reinterpret_cast<const uint8_t*>(error.c_str()),
+ EmulateMobileMessage(header, reinterpret_cast<const uint8_t*>(error.c_str()),
error.size());
}
/*
* Shall not send any query on getting SEND_INTERNAL_ERROR with error string
*/
TEST_F(SecurityManagerTest, GetInternalError_WithErrJSONText) {
- SetMockCryptoManger();
+ SetMockCryptoManager();
- SecurityQuery::QueryHeader header( SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_INTERNAL_ERROR, 0);
+ SecurityQuery::QueryHeader header(SecurityQuery::NOTIFICATION,
+ SecurityQuery::SEND_INTERNAL_ERROR, 0);
std::string error(" { \"id\": 1 } ");
header.json_size = error.size();
- EmulateMobileMessage(header,
- reinterpret_cast<const uint8_t*>(error.c_str()),
+ EmulateMobileMessage(header, reinterpret_cast<const uint8_t*>(error.c_str()),
error.size());
}
-} // namespace security_manager_test
-} // namespace components
-} // namespace test
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/security_manager/test/security_query_matcher.cc b/src/components/security_manager/test/security_query_matcher.cc
index 2320e83439..9f6bc370e7 100644
--- a/src/components/security_manager/test/security_query_matcher.cc
+++ b/src/components/security_manager/test/security_query_matcher.cc
@@ -30,8 +30,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gmock/gmock.h>
#include <string>
+
+#include "gmock/gmock.h"
#include "utils/byte_order.h"
#include "security_manager/security_query.h"
@@ -44,80 +45,76 @@ namespace security_manager_test {
* Check error id
*/
MATCHER_P(InternalErrorWithErrId, expectedErrorId,
- std::string(negation ? "is not" : "is")
- + " InternalError with selected error" ){
+ std::string(negation ? "is not" : "is") +
+ " InternalError with selected error") {
const size_t header_size =
- sizeof(security_manager::SecurityQuery::QueryHeader);
+ sizeof(security_manager::SecurityQuery::QueryHeader);
if (arg->data_size() <= header_size) {
*result_listener << "Size " << arg->data_size()
- << " bytes less or equal sizeof(QueryHeader)="
- << header_size;
+ << " bytes less or equal sizeof(QueryHeader)="
+ << header_size;
return false;
}
- const uint8_t *data = arg->data();
+ const uint8_t* data = arg->data();
const uint8_t query_type = data[0];
if (security_manager::SecurityQuery::NOTIFICATION != query_type) {
- *result_listener << "RawMessage is not notification, type=0x"
- << std::hex << static_cast<int>(query_type);
+ *result_listener << "RawMessage is not notification, type=0x" << std::hex
+ << static_cast<int>(query_type);
return false;
}
// Read Big-Endian number
- const uint32_t query_id = data[1] << 16 |
- data[2] << 8 |
- data[3];
+ const uint32_t query_id = data[1] << 16 | data[2] << 8 | data[3];
if (security_manager::SecurityQuery::SEND_INTERNAL_ERROR != query_id) {
- *result_listener << "Notification is not InternalError, id=0x"
- << std::hex << query_id;
+ *result_listener << "Notification is not InternalError, id=0x" << std::hex
+ << query_id;
return false;
}
- const uint32_t json_size = data[8] << 24 |
- data[9] << 16 |
- data[10] << 8 |
- data[11];
+ const uint32_t json_size =
+ data[8] << 24 | data[9] << 16 | data[10] << 8 | data[11];
if (header_size + json_size >= arg->data_size()) {
*result_listener << "InternalError contains only JSON data.";
return false;
}
// Read err_id as bin data number
- const uint8_t *err_id =
- reinterpret_cast<const uint8_t *>(data + header_size + json_size);
+ const uint8_t* err_id =
+ reinterpret_cast<const uint8_t*>(data + header_size + json_size);
if (expectedErrorId != *err_id) {
*result_listener << "InternalError id " << static_cast<int>(*err_id)
- << " and not equal error " << expectedErrorId;
+ << " and not equal error " << expectedErrorId;
return false;
}
return true;
}
-} // namespace security_manager_test
-} // namespace components
-} // namespace test
-/*
- * Matcher for checking QueryHeader equal in GTests
- */
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
+ /*
+ * Matcher for checking QueryHeader equal in GTests
+ */
::testing::AssertionResult QueryHeader_EQ(
- const char *m_expr, const char *n_expr,
- const ::security_manager::SecurityQuery::QueryHeader &q1,
- const ::security_manager::SecurityQuery::QueryHeader &q2);
+ const char* m_expr, const char* n_expr,
+ const ::security_manager::SecurityQuery::QueryHeader& q1,
+ const ::security_manager::SecurityQuery::QueryHeader& q2);
::testing::AssertionResult QueryHeader_EQ(
- const char* m_expr, const char* n_expr,
- const ::security_manager::SecurityQuery::QueryHeader& q1,
- const ::security_manager::SecurityQuery::QueryHeader& q2) {
+ const char* m_expr, const char* n_expr,
+ const ::security_manager::SecurityQuery::QueryHeader& q1,
+ const ::security_manager::SecurityQuery::QueryHeader& q2) {
::testing::AssertionResult fail_result = ::testing::AssertionFailure();
fail_result << "(\"" << m_expr << " and \"" << n_expr << "\") are not equal "
<< " : different ";
if (q1.json_size != q2.json_size)
- return fail_result << "json_size_1=" << q1.json_size << ", json_size_2="
- << q2.json_size;
+ return fail_result << "json_size_1=" << q1.json_size
+ << ", json_size_2=" << q2.json_size;
if (q1.query_id != q2.query_id)
- return fail_result << "query_id_1=" << q1.query_id << ", query_id_2="
- << q2.query_id;
+ return fail_result << "query_id_1=" << q1.query_id
+ << ", query_id_2=" << q2.query_id;
if (q1.query_type != q2.query_type)
- return fail_result << "query_type_1=" << q1.query_type << ", query_type_2="
- << q2.query_type;
+ return fail_result << "query_type_1=" << q1.query_type
+ << ", query_type_2=" << q2.query_type;
if (q1.seq_number != q2.seq_number)
- return fail_result << "seq_number_1=" << q1.seq_number << ", seq_number_2="
- << q2.seq_number;
+ return fail_result << "seq_number_1=" << q1.seq_number
+ << ", seq_number_2=" << q2.seq_number;
return ::testing::AssertionSuccess();
}
diff --git a/src/components/security_manager/test/security_query_test.cc b/src/components/security_manager/test/security_query_test.cc
index 6db076fd52..d4ef95400f 100644
--- a/src/components/security_manager/test/security_query_test.cc
+++ b/src/components/security_manager/test/security_query_test.cc
@@ -30,16 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <gtest/gtest.h>
#include <vector>
#include <string>
+
+#include "gtest/gtest.h"
#include "security_manager/security_query.h"
#include "protocol_handler/protocol_payload.h"
#include "utils/byte_order.h"
-#include "include/security_manager_mock.h"
+#include "security_manager/mock_security_manager.h"
// Test values for compare after serialization and byteorder conversion
-#define SEQ_NUMBER 0x12345678u
+#define SEQ_NUMBER 0x12345678u
#define CONNECTION_KEY 0xABCDEF0u
namespace test {
@@ -68,7 +69,7 @@ class SecurityQueryTest : public ::testing::Test {
* Used for handling header and data array to byte array for serialization
*/
std::vector<uint8_t> DeserializeData(SecurityQuery::QueryHeader header,
- const uint8_t * const binary_data,
+ const uint8_t* const binary_data,
const size_t bin_data_size) const {
// convert to Big-Endian (network) order
const uint32_t query_id = header.query_id << 8;
@@ -91,8 +92,8 @@ class SecurityQueryTest : public ::testing::Test {
* for correct working on Mobile side (3*8 byte)
*/
TEST_F(SecurityQueryTest, Equal_RPCHeader) {
- ASSERT_EQ(sizeof(SecurityQuery::QueryHeader)*8,
- ::protocol_handler::ProtocolPayloadV2SizeBits());
+ ASSERT_EQ(sizeof(SecurityQuery::QueryHeader) * 8,
+ ::protocol_handler::ProtocolPayloadV2SizeBits());
}
/*
* Security QueryHeader default construction
@@ -107,16 +108,16 @@ TEST_F(SecurityQueryTest, QueryHeaderConstructor) {
*/
TEST_F(SecurityQueryTest, QueryHeaderConstructor2) {
SecurityQuery::QueryHeader new_header(SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_HANDSHAKE_DATA,
- SEQ_NUMBER);
+ SecurityQuery::SEND_HANDSHAKE_DATA,
+ SEQ_NUMBER);
ASSERT_EQ(new_header.query_type, SecurityQuery::NOTIFICATION);
ASSERT_EQ(new_header.query_id, SecurityQuery::SEND_HANDSHAKE_DATA);
ASSERT_EQ(new_header.seq_number, SEQ_NUMBER);
ASSERT_EQ(new_header.json_size, 0u);
SecurityQuery::QueryHeader new_header2(SecurityQuery::RESPONSE,
- SecurityQuery::SEND_INTERNAL_ERROR,
- SEQ_NUMBER + 1);
+ SecurityQuery::SEND_INTERNAL_ERROR,
+ SEQ_NUMBER + 1);
ASSERT_EQ(new_header2.query_type, SecurityQuery::RESPONSE);
ASSERT_EQ(new_header2.query_id, SecurityQuery::SEND_INTERNAL_ERROR);
ASSERT_EQ(new_header2.seq_number, SEQ_NUMBER + 1);
@@ -138,7 +139,7 @@ TEST_F(SecurityQueryTest, QueryConstructor) {
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_TRUE(query.get_json_message().empty());
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), invalid_header);
@@ -155,7 +156,7 @@ TEST_F(SecurityQueryTest, QueryConstructor2) {
ASSERT_EQ(query.get_connection_key(), CONNECTION_KEY);
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_TRUE(query.get_json_message().empty());
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), init_header);
@@ -169,17 +170,14 @@ TEST_F(SecurityQueryTest, QueryConstructor2) {
*/
TEST_F(SecurityQueryTest, QueryConstructor3) {
uint8_t raw_data[] = {0x0, 0x1, 0x2};
- const size_t raw_data_size =
- sizeof(raw_data)/sizeof(raw_data[0]);
+ const size_t raw_data_size = sizeof(raw_data) / sizeof(raw_data[0]);
- SecurityQuery query(init_header,
- CONNECTION_KEY,
- raw_data, raw_data_size);
+ SecurityQuery query(init_header, CONNECTION_KEY, raw_data, raw_data_size);
ASSERT_EQ(query.get_connection_key(), CONNECTION_KEY);
ASSERT_EQ(query.get_data_size(), raw_data_size);
// query shall handle own array of byte data
- ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
for (size_t i = 0; i < raw_data_size; ++i) {
ASSERT_EQ(query.get_data()[i], raw_data[i]);
}
@@ -188,7 +186,7 @@ TEST_F(SecurityQueryTest, QueryConstructor3) {
// Deserialization shall return vector equal header + data array
const std::vector<uint8_t> vector =
- DeserializeData(init_header, raw_data, raw_data_size);
+ DeserializeData(init_header, raw_data, raw_data_size);
const std::vector<uint8_t> deserialize_vector = query.DeserializeQuery();
ASSERT_EQ(deserialize_vector, vector);
}
@@ -198,8 +196,7 @@ TEST_F(SecurityQueryTest, QueryConstructor3) {
TEST_F(SecurityQueryTest, Setters) {
const std::string str = "test example string";
uint8_t raw_data[] = {0x6, 0x7, 0x8};
- const size_t raw_data_size =
- sizeof(raw_data)/sizeof(raw_data[0]);
+ const size_t raw_data_size = sizeof(raw_data) / sizeof(raw_data[0]);
SecurityQuery query;
query.set_connection_key(CONNECTION_KEY);
@@ -210,7 +207,7 @@ TEST_F(SecurityQueryTest, Setters) {
ASSERT_EQ(query.get_connection_key(), CONNECTION_KEY);
ASSERT_EQ(query.get_data_size(), raw_data_size);
// query shall handle own array of byte data
- ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
for (size_t i = 0; i < raw_data_size; ++i) {
ASSERT_EQ(query.get_data()[i], raw_data[i]);
}
@@ -228,7 +225,7 @@ TEST_F(SecurityQueryTest, Parse_NullData) {
// check side-effects
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_TRUE(query.get_json_message().empty());
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), invalid_header);
}
@@ -245,7 +242,7 @@ TEST_F(SecurityQueryTest, Parse_LessHeaderData) {
// check side-effects
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_TRUE(query.get_json_message().empty());
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), invalid_header);
}
@@ -253,8 +250,7 @@ TEST_F(SecurityQueryTest, Parse_LessHeaderData) {
* SecurityQuery serializes data equal header size
*/
TEST_F(SecurityQueryTest, Parse_HeaderData) {
- const std::vector<uint8_t> vector =
- DeserializeData(init_header, NULL, 0u);
+ const std::vector<uint8_t> vector = DeserializeData(init_header, NULL, 0u);
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
@@ -263,7 +259,7 @@ TEST_F(SecurityQueryTest, Parse_HeaderData) {
// check side-effects
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_TRUE(query.get_json_message().empty());
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), init_header);
@@ -277,8 +273,7 @@ TEST_F(SecurityQueryTest, Parse_HeaderData) {
TEST_F(SecurityQueryTest, Parse_HeaderDataWrong) {
// Wrong json size
init_header.json_size = 0x0FFFFFFF;
- const std::vector<uint8_t> vector =
- DeserializeData(init_header, NULL, 0u);
+ const std::vector<uint8_t> vector = DeserializeData(init_header, NULL, 0u);
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
@@ -287,7 +282,7 @@ TEST_F(SecurityQueryTest, Parse_HeaderDataWrong) {
// check side-effects
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_TRUE(query.get_json_message().empty());
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), init_header);
@@ -301,17 +296,15 @@ TEST_F(SecurityQueryTest, Parse_HeaderDataWrong) {
*/
TEST_F(SecurityQueryTest, Parse_InvalidQuery) {
SecurityQuery::QueryHeader invalid_query_header(
- SecurityQuery::INVALID_QUERY_TYPE,
- SecurityQuery::INVALID_QUERY_ID,
+ SecurityQuery::INVALID_QUERY_TYPE, SecurityQuery::INVALID_QUERY_ID,
SEQ_NUMBER);
// some sample data
uint8_t raw_data[] = {0x6, 0x7, 0x8};
- const size_t raw_data_size =
- sizeof(raw_data)/sizeof(raw_data[0]);
+ const size_t raw_data_size = sizeof(raw_data) / sizeof(raw_data[0]);
const std::vector<uint8_t> vector =
- DeserializeData(invalid_query_header, raw_data, raw_data_size);
+ DeserializeData(invalid_query_header, raw_data, raw_data_size);
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
@@ -320,9 +313,9 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery) {
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), invalid_query_header);
ASSERT_EQ(query.get_data_size(), raw_data_size);
// query shall handle own array of byte data
- ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
for (size_t i = 0; i < raw_data_size; ++i) {
- ASSERT_EQ(query.get_data()[i], raw_data[+ i]);
+ ASSERT_EQ(query.get_data()[i], raw_data[+i]);
}
// check side-effects
ASSERT_EQ(query.get_connection_key(), 0u);
@@ -340,11 +333,10 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownTypeId) {
SecurityQuery::QueryHeader invalid_type_id_header(
SecurityQuery::INVALID_QUERY_TYPE - 1,
// Use not enum value for additional testing
- SecurityQuery::INVALID_QUERY_ID - 1,
- SEQ_NUMBER);
+ SecurityQuery::INVALID_QUERY_ID - 1, SEQ_NUMBER);
const std::vector<uint8_t> vector =
- DeserializeData(invalid_type_id_header, NULL, 0u);
+ DeserializeData(invalid_type_id_header, NULL, 0u);
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
@@ -352,10 +344,11 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownTypeId) {
// Parse set all unknown types and ids to INVALID_QUERY_ID
invalid_type_id_header.query_type = SecurityQuery::INVALID_QUERY_TYPE;
invalid_type_id_header.query_id = SecurityQuery::INVALID_QUERY_ID;
- EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), invalid_type_id_header);
+ EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(),
+ invalid_type_id_header);
// check side-effects
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_TRUE(query.get_json_message().empty());
}
@@ -367,10 +360,9 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownId_Response) {
SecurityQuery::QueryHeader invalid_id_header(
SecurityQuery::RESPONSE,
// Use not enum value for additional testing
- SecurityQuery::INVALID_QUERY_ID - 2,
- SEQ_NUMBER);
+ SecurityQuery::INVALID_QUERY_ID - 2, SEQ_NUMBER);
const std::vector<uint8_t> vector =
- DeserializeData(invalid_id_header, NULL, 0u);
+ DeserializeData(invalid_id_header, NULL, 0u);
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
@@ -380,7 +372,7 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownId_Response) {
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), invalid_id_header);
// check side-effects
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_TRUE(query.get_json_message().empty());
}
@@ -390,16 +382,14 @@ TEST_F(SecurityQueryTest, Parse_InvalidQuery_UnknownId_Response) {
*/
TEST_F(SecurityQueryTest, Parse_Handshake) {
SecurityQuery::QueryHeader handshake_header(
- SecurityQuery::NOTIFICATION,
- SecurityQuery::SEND_HANDSHAKE_DATA,
+ SecurityQuery::NOTIFICATION, SecurityQuery::SEND_HANDSHAKE_DATA,
SEQ_NUMBER);
// some sample data
uint8_t raw_data[] = {0x6, 0x7, 0x8};
- const size_t raw_data_size =
- sizeof(raw_data)/sizeof(raw_data[0]);
+ const size_t raw_data_size = sizeof(raw_data) / sizeof(raw_data[0]);
const std::vector<uint8_t> vector =
- DeserializeData(handshake_header, raw_data, raw_data_size);
+ DeserializeData(handshake_header, raw_data, raw_data_size);
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
@@ -407,9 +397,9 @@ TEST_F(SecurityQueryTest, Parse_Handshake) {
EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), handshake_header);
ASSERT_EQ(query.get_data_size(), raw_data_size);
// query shall handle own array of byte data
- ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_NE(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
for (size_t i = 0; i < raw_data_size; ++i) {
- ASSERT_EQ(query.get_data()[i], raw_data[+ i]);
+ ASSERT_EQ(query.get_data()[i], raw_data[+i]);
}
// check side-effects
ASSERT_EQ(query.get_connection_key(), 0u);
@@ -426,23 +416,22 @@ TEST_F(SecurityQueryTest, Parse_Handshake) {
TEST_F(SecurityQueryTest, Parse_InternalError) {
std::string error_str = "{some error}";
SecurityQuery::QueryHeader internal_error_header(
- SecurityQuery::REQUEST,
- SecurityQuery::SEND_INTERNAL_ERROR,
- SEQ_NUMBER);
+ SecurityQuery::REQUEST, SecurityQuery::SEND_INTERNAL_ERROR, SEQ_NUMBER);
internal_error_header.json_size = error_str.size();
const uint8_t* raw_data = reinterpret_cast<const uint8_t*>(error_str.c_str());
const std::vector<uint8_t> vector =
- DeserializeData(internal_error_header, raw_data, error_str.size());
+ DeserializeData(internal_error_header, raw_data, error_str.size());
SecurityQuery query;
const bool result = query.SerializeQuery(&vector[0], vector.size());
ASSERT_TRUE(result);
- EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(), internal_error_header);
+ EXPECT_PRED_FORMAT2(QueryHeader_EQ, query.get_header(),
+ internal_error_header);
// check side-effects
ASSERT_EQ(query.get_data_size(), 0u);
- ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t *>(NULL));
+ ASSERT_EQ(query.get_data(), reinterpret_cast<uint8_t*>(NULL));
ASSERT_EQ(query.get_connection_key(), 0u);
ASSERT_EQ(query.get_json_message(), error_str);
@@ -451,6 +440,6 @@ TEST_F(SecurityQueryTest, Parse_InternalError) {
ASSERT_EQ(deserialize_vector, vector);
}
-} // namespace security_manager_test
-} // namespace components
-} // namespace test
+} // namespace security_manager_test
+} // namespace components
+} // namespace test
diff --git a/src/components/security_manager/test/ssl_certificate_handshake_test.cc b/src/components/security_manager/test/ssl_certificate_handshake_test.cc
new file mode 100644
index 0000000000..bb59084b98
--- /dev/null
+++ b/src/components/security_manager/test/ssl_certificate_handshake_test.cc
@@ -0,0 +1,582 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <fstream>
+#include <sstream>
+
+#include "gtest/gtest.h"
+#include "security_manager/crypto_manager_impl.h"
+#include "security_manager/mock_security_manager_settings.h"
+#include "utils/custom_string.h"
+
+using ::testing::Return;
+using ::testing::ReturnRef;
+
+namespace test {
+namespace components {
+namespace ssl_handshake_test {
+namespace custom_str = utils::custom_string;
+// Use this macro for correct line printing
+// in case of fail insize of the #method
+#define GTEST_TRACE(method) \
+ do { \
+ SCOPED_TRACE(""); \
+ method; \
+ } while (false)
+
+namespace {
+const std::string server_ca_cert_filename = "server";
+const std::string client_ca_cert_filename = "client";
+const std::string client_certificate = "client/client_credential.p12.enc";
+const std::string server_certificate = "server/spt_credential.p12.enc";
+const std::string server_unsigned_cert_file =
+ "server/spt_credential_unsigned.p12.enc";
+const std::string server_expired_cert_file =
+ "server/spt_credential_expired.p12.enc";
+
+const bool verify_peer = true;
+const bool skip_peer_verification = false;
+
+const size_t updates_before_hour = 24;
+
+} // namespace
+
+class SSLHandshakeTest : public testing::Test {
+ protected:
+ void SetUp() OVERRIDE {
+ mock_server_manager_settings = new testing::NiceMock<
+ security_manager_test::MockCryptoManagerSettings>();
+
+ server_manager = new security_manager::CryptoManagerImpl(
+ utils::SharedPtr<security_manager::CryptoManagerSettings>(
+ mock_server_manager_settings));
+ ASSERT_TRUE(server_manager);
+ mock_client_manager_settings = new testing::NiceMock<
+ security_manager_test::MockCryptoManagerSettings>();
+
+ client_manager = new security_manager::CryptoManagerImpl(
+ utils::SharedPtr<security_manager::CryptoManagerSettings>(
+ mock_client_manager_settings));
+ ASSERT_TRUE(client_manager);
+ server_ctx = NULL;
+ client_ctx = NULL;
+ }
+
+ void TearDown() OVERRIDE {
+ server_manager->ReleaseSSLContext(server_ctx);
+ delete server_manager;
+ client_manager->ReleaseSSLContext(client_ctx);
+ delete client_manager;
+ }
+
+ void SetServerInitialValues(const security_manager::Protocol protocol,
+ const std::string cert,
+ const std::string server_ciphers_list,
+ const bool verify_peer,
+ const std::string& ca_certificate_path) {
+ server_certificate_ = cert;
+ server_ciphers_list_ = server_ciphers_list;
+ server_ca_certificate_path_ = ca_certificate_path;
+
+ ON_CALL(*mock_server_manager_settings, security_manager_mode())
+ .WillByDefault(Return(security_manager::SERVER));
+ ON_CALL(*mock_server_manager_settings,
+ security_manager_protocol_name())
+ .WillByDefault(Return(protocol));
+ ON_CALL(*mock_server_manager_settings, certificate_data())
+ .WillByDefault(ReturnRef(server_certificate_));
+ ON_CALL(*mock_server_manager_settings, ciphers_list())
+ .WillByDefault(ReturnRef(server_ciphers_list_));
+ ON_CALL(*mock_server_manager_settings, ca_cert_path())
+ .WillByDefault(ReturnRef(server_ca_certificate_path_));
+ ON_CALL(*mock_server_manager_settings,verify_peer())
+ .WillByDefault(Return(verify_peer));
+ }
+ void SetClientInitialValues(const security_manager::Protocol protocol,
+ const std::string certificate,
+ const std::string client_ciphers_list,
+ const bool verify_peer,
+ const std::string& ca_certificate_path) {
+
+ client_certificate_ = certificate;
+ client_ciphers_list_ = client_ciphers_list;
+ client_ca_certificate_path_ = ca_certificate_path;
+
+ ON_CALL(*mock_client_manager_settings, security_manager_mode())
+ .WillByDefault(Return(security_manager::CLIENT));
+ ON_CALL(*mock_client_manager_settings,
+ security_manager_protocol_name())
+ .WillByDefault(Return(protocol));
+ ON_CALL(*mock_client_manager_settings, certificate_data())
+ .WillByDefault(ReturnRef(client_certificate_));
+ ON_CALL(*mock_client_manager_settings, ciphers_list())
+ .WillByDefault(ReturnRef(client_ciphers_list_));
+ ON_CALL(*mock_client_manager_settings, ca_cert_path())
+ .WillByDefault(ReturnRef(client_ca_certificate_path_));
+ ON_CALL(*mock_client_manager_settings,verify_peer())
+ .WillByDefault(Return(verify_peer));
+ }
+
+ bool InitServerManagers(security_manager::Protocol protocol,
+ const std::string& cert_filename,
+ const std::string& ciphers_list,
+ const bool verify_peer,
+ const std::string& ca_certificate_path) {
+ std::ifstream cert(cert_filename);
+ std::stringstream ss;
+ if (cert.is_open()){
+ ss << cert.rdbuf();
+ }
+ cert.close();
+ SetServerInitialValues(
+ protocol, ss.str(), ciphers_list, verify_peer, ca_certificate_path);
+ const bool initialized = server_manager->Init();
+
+ if (!initialized) {
+ return false;
+ }
+
+ server_ctx = server_manager->CreateSSLContext();
+
+ if (!server_ctx) {
+ return false;
+ }
+
+ security_manager::SSLContext::HandshakeContext ctx;
+ server_ctx->SetHandshakeContext(
+ ctx.make_context(custom_str::CustomString("SPT"),
+ custom_str::CustomString("client")));
+
+ return true;
+ }
+
+ bool InitClientManagers(security_manager::Protocol protocol,
+ const std::string& cert_filename,
+ const std::string& ciphers_list,
+ const bool verify_peer,
+ const std::string& ca_certificate_path) {
+ std::ifstream cert(cert_filename);
+ std::stringstream certificate;
+ if (cert.is_open()) {
+ certificate << cert.rdbuf();
+ }
+ cert.close();
+ SetClientInitialValues(protocol,
+ certificate.str(),
+ ciphers_list,
+ verify_peer,
+ ca_certificate_path);
+ const bool initialized = client_manager->Init();
+ if (!initialized) {
+ return false;
+ }
+
+ client_ctx = client_manager->CreateSSLContext();
+ if (!client_ctx) {
+ return false;
+ }
+
+ security_manager::SSLContext::HandshakeContext ctx;
+ client_ctx->SetHandshakeContext(ctx.make_context(
+ custom_str::CustomString("SPT"), custom_str::CustomString("server")));
+
+ return true;
+ }
+
+ void ResetConnections() {
+ ASSERT_NO_THROW(server_ctx->ResetConnection());
+ ASSERT_NO_THROW(client_ctx->ResetConnection());
+ }
+
+ void StartHandshake() {
+ using security_manager::SSLContext;
+
+ ASSERT_EQ(SSLContext::Handshake_Result_Success,
+ client_ctx->StartHandshake(&client_buf, &client_buf_len));
+ ASSERT_FALSE(client_buf == NULL);
+ ASSERT_GT(client_buf_len, 0u);
+ }
+
+ void HandshakeProcedure_Success() {
+ using security_manager::SSLContext;
+ StartHandshake();
+
+ while (true) {
+ ASSERT_EQ(SSLContext::Handshake_Result_Success,
+ server_ctx->DoHandshakeStep(
+ client_buf, client_buf_len, &server_buf, &server_buf_len))
+ << ERR_reason_error_string(ERR_get_error());
+ ASSERT_FALSE(server_buf == NULL);
+ ASSERT_GT(server_buf_len, 0u);
+
+ ASSERT_EQ(SSLContext::Handshake_Result_Success,
+ client_ctx->DoHandshakeStep(
+ server_buf, server_buf_len, &client_buf, &client_buf_len))
+ << ERR_reason_error_string(ERR_get_error());
+ if (server_ctx->IsInitCompleted()) {
+ break;
+ }
+
+ ASSERT_FALSE(client_buf == NULL);
+ ASSERT_GT(client_buf_len, 0u);
+ }
+ }
+
+ void HandshakeProcedure_ServerSideFail() {
+ using security_manager::SSLContext;
+
+ StartHandshake();
+
+ while (true) {
+ const SSLContext::HandshakeResult result = server_ctx->DoHandshakeStep(
+ client_buf, client_buf_len, &server_buf, &server_buf_len);
+ ASSERT_FALSE(server_ctx->IsInitCompleted())
+ << "Expected server side handshake fail";
+
+ // First few handshake will be successful
+ if (result != SSLContext::Handshake_Result_Success) {
+ // Test successfully passed with handshake fail
+ return;
+ }
+ ASSERT_FALSE(server_buf == NULL);
+ ASSERT_GT(server_buf_len, 0u);
+
+ ASSERT_EQ(SSLContext::Handshake_Result_Success,
+ client_ctx->DoHandshakeStep(
+ server_buf, server_buf_len, &client_buf, &client_buf_len))
+ << ERR_reason_error_string(ERR_get_error());
+ ASSERT_FALSE(client_ctx->IsInitCompleted())
+ << "Expected server side handshake fail";
+
+ ASSERT_FALSE(client_buf == NULL);
+ ASSERT_GT(client_buf_len, 0u);
+ }
+ FAIL() << "Expected server side handshake fail";
+ }
+
+ void HandshakeProcedure_ClientSideFail(
+ security_manager::SSLContext::HandshakeResult expected_result) {
+ using security_manager::SSLContext;
+
+ StartHandshake();
+
+ while (true) {
+ ASSERT_EQ(SSLContext::Handshake_Result_Success,
+ server_ctx->DoHandshakeStep(
+ client_buf, client_buf_len, &server_buf, &server_buf_len))
+ << ERR_reason_error_string(ERR_get_error());
+
+ ASSERT_FALSE(server_buf == NULL);
+ ASSERT_GT(server_buf_len, 0u);
+
+ const SSLContext::HandshakeResult result = client_ctx->DoHandshakeStep(
+ server_buf, server_buf_len, &client_buf, &client_buf_len);
+ ASSERT_FALSE(client_ctx->IsInitCompleted())
+ << "Expected client side handshake fail";
+
+ // First few handsahke will be successful
+ if (result != SSLContext::Handshake_Result_Success) {
+ // Test successfully passed with handshake fail
+ ASSERT_EQ(expected_result, result);
+ return;
+ }
+
+ ASSERT_FALSE(client_buf == NULL);
+ ASSERT_GT(client_buf_len, 0u);
+ }
+ FAIL() << "Expected client side handshake fail";
+ }
+
+ security_manager::CryptoManager* server_manager;
+ security_manager::CryptoManager* client_manager;
+ security_manager::SSLContext* server_ctx;
+ security_manager::SSLContext* client_ctx;
+ testing::NiceMock<security_manager_test::MockCryptoManagerSettings>*
+ mock_server_manager_settings;
+ testing::NiceMock<security_manager_test::MockCryptoManagerSettings>*
+ mock_client_manager_settings;
+
+ const uint8_t* server_buf;
+ const uint8_t* client_buf;
+ size_t server_buf_len;
+ size_t client_buf_len;
+
+ std::string server_certificate_;
+ std::string server_ciphers_list_;
+ std::string server_ca_certificate_path_;
+
+ std::string client_certificate_;
+ std::string client_ciphers_list_;
+ std::string client_ca_certificate_path_;
+};
+
+TEST_F(SSLHandshakeTest, NoVerification) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_Success());
+}
+
+TEST_F(SSLHandshakeTest, CAVerification_ServerSide) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_Success());
+}
+
+TEST_F(SSLHandshakeTest, CAVerification_ServerSide_NoCACertificate) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ "unex"))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_ServerSideFail());
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+
+ GTEST_TRACE(ResetConnections());
+
+ GTEST_TRACE(HandshakeProcedure_Success());
+}
+
+TEST_F(SSLHandshakeTest, CAVerification_ClientSide) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ server_ca_cert_filename))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_Success());
+}
+
+TEST_F(SSLHandshakeTest, CAVerification_ClientSide_NoCACertificate) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ "client_ca_cert_filename"))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_ClientSideFail(
+ security_manager::SSLContext::Handshake_Result_Fail));
+
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ server_ca_cert_filename))
+ << client_manager->LastError();
+
+ GTEST_TRACE(ResetConnections());
+
+ GTEST_TRACE(HandshakeProcedure_Success());
+}
+
+TEST_F(SSLHandshakeTest, CAVerification_BothSides) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ server_ca_cert_filename))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_Success());
+}
+
+TEST_F(SSLHandshakeTest, UnsignedCert) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_unsigned_cert_file,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << client_manager->LastError();
+ GTEST_TRACE(HandshakeProcedure_ClientSideFail(
+ security_manager::SSLContext::Handshake_Result_CertNotSigned));
+}
+
+TEST_F(SSLHandshakeTest, ExpiredCert) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_expired_cert_file,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ server_ca_cert_filename))
+ << client_manager->LastError();
+
+ GTEST_TRACE(HandshakeProcedure_ClientSideFail(
+ security_manager::SSLContext::Handshake_Result_CertExpired));
+}
+
+TEST_F(SSLHandshakeTest, AppNameAndAppIDInvalid) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ verify_peer,
+ server_ca_cert_filename))
+ << client_manager->LastError();
+
+ security_manager::SSLContext::HandshakeContext ctx;
+ client_ctx->SetHandshakeContext(ctx.make_context(
+ custom_str::CustomString("server"), custom_str::CustomString("Wrong")));
+
+ GTEST_TRACE(HandshakeProcedure_ClientSideFail(
+ security_manager::SSLContext::Handshake_Result_AppNameMismatch));
+
+ ResetConnections();
+ client_ctx->SetHandshakeContext(ctx.make_context(
+ custom_str::CustomString("Wrong"), custom_str::CustomString("server")));
+
+ GTEST_TRACE(HandshakeProcedure_ClientSideFail(
+ security_manager::SSLContext::Handshake_Result_AppIDMismatch));
+}
+
+TEST_F(SSLHandshakeTest, NoVerification_ResetConnection) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ skip_peer_verification,
+ ""))
+ << client_manager->LastError();
+
+ const int times = 100;
+ for (int i = 0; i < times; ++i) {
+ // Expect success handshake
+ GTEST_TRACE(HandshakeProcedure_Success());
+
+ // Reset SSl connections
+ GTEST_TRACE(ResetConnections());
+ }
+}
+
+TEST_F(SSLHandshakeTest, CAVerification_BothSides_ResetConnection) {
+ ASSERT_TRUE(InitServerManagers(security_manager::TLSv1_2,
+ server_certificate,
+ "ALL",
+ verify_peer,
+ client_ca_cert_filename))
+ << server_manager->LastError();
+ ASSERT_TRUE(InitClientManagers(security_manager::TLSv1_2,
+ client_certificate,
+ "ALL",
+ skip_peer_verification,
+ server_ca_cert_filename))
+ << client_manager->LastError();
+
+ const int times = 100;
+ for (int i = 0; i < times; ++i) {
+ // Expect success handshake
+ GTEST_TRACE(HandshakeProcedure_Success());
+
+ // Reset SSl connections
+ GTEST_TRACE(ResetConnections());
+ }
+}
+
+// TODO(EZamakhov): add fail tests -broken or not full ca certificate chain
+
+} // namespace ssl_handshake_test
+} // namespace components
+} // namespace test
diff --git a/src/components/security_manager/test/ssl_context_test.cc b/src/components/security_manager/test/ssl_context_test.cc
new file mode 100644
index 0000000000..89c119b68b
--- /dev/null
+++ b/src/components/security_manager/test/ssl_context_test.cc
@@ -0,0 +1,534 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include <fstream>
+#include <sstream>
+#include <string>
+#include <openssl/ssl.h>
+
+#include "security_manager/crypto_manager.h"
+#include "security_manager/crypto_manager_impl.h"
+#include "security_manager/ssl_context.h"
+#include "utils/custom_string.h"
+#include "security_manager/mock_security_manager_settings.h"
+#include "utils/shared_ptr.h"
+#include "utils/make_shared.h"
+
+using ::testing::Return;
+using ::testing::ReturnRef;
+using ::testing::NiceMock;
+
+namespace {
+const size_t kUpdatesBeforeHour = 24;
+const std::string kCaPath = "";
+const uint8_t* kServerBuf;
+const uint8_t* kClientBuf;
+const std::string kAllCiphers = "ALL";
+size_t server_buf_len;
+size_t client_buf_len;
+#ifdef __QNXNTO__
+const std::string kFordCipher = SSL3_TXT_RSA_DES_192_CBC3_SHA;
+#else
+// Used cipher from ford protocol requirement
+const std::string kFordCipher = TLS1_TXT_RSA_WITH_AES_256_GCM_SHA384;
+#endif
+} // namespace
+
+namespace test {
+namespace components {
+namespace ssl_context_test {
+namespace custom_str = utils::custom_string;
+
+struct ProtocolAndCipher {
+ security_manager::Protocol server_protocol;
+ security_manager::Protocol client_protocol;
+ std::string server_ciphers_list;
+ std::string client_ciphers_list;
+
+ ProtocolAndCipher(security_manager::Protocol s_protocol,
+ security_manager::Protocol c_protocol,
+ std::string s_ciphers_list,
+ std::string c_ciphers_list)
+ : server_protocol(s_protocol)
+ , client_protocol(c_protocol)
+ , server_ciphers_list(s_ciphers_list)
+ , client_ciphers_list(c_ciphers_list) {}
+};
+
+class SSLTest : public testing::Test {
+ protected:
+ static void SetUpTestCase() {
+ std::ifstream certificate_file("server/spt_credential_unsigned.p12");
+ std::stringstream certificate;
+ if (certificate_file.is_open()) {
+ certificate << certificate_file.rdbuf();
+ }
+ certificate_file.close();
+ certificate_data_base64_ = certificate.str();
+ ASSERT_FALSE(certificate_data_base64_.empty()) << "Certificate data file is empty";
+ }
+
+ virtual void SetUp() OVERRIDE {
+ mock_crypto_manager_settings_ = utils::MakeShared<
+ NiceMock<security_manager_test::MockCryptoManagerSettings>>();
+ utils::SharedPtr<security_manager::CryptoManagerSettings> crypto_set(
+ mock_crypto_manager_settings_);
+ crypto_manager_ = new security_manager::CryptoManagerImpl(crypto_set);
+
+ EXPECT_CALL(*mock_crypto_manager_settings_, security_manager_mode())
+ .WillOnce(Return(security_manager::SERVER));
+ EXPECT_CALL(*mock_crypto_manager_settings_,
+ security_manager_protocol_name())
+ .WillOnce(Return(security_manager::TLSv1_2));
+ EXPECT_CALL(*mock_crypto_manager_settings_, certificate_data())
+ .WillOnce(ReturnRef(certificate_data_base64_));
+ EXPECT_CALL(*mock_crypto_manager_settings_, ciphers_list())
+ .WillRepeatedly(ReturnRef(kAllCiphers));
+ EXPECT_CALL(*mock_crypto_manager_settings_, ca_cert_path())
+ .WillRepeatedly(ReturnRef(kCaPath));
+ EXPECT_CALL(*mock_crypto_manager_settings_, verify_peer())
+ .WillOnce(Return(false));
+ const bool crypto_manager_initialization = crypto_manager_->Init();
+ EXPECT_TRUE(crypto_manager_initialization);
+
+ mock_client_manager_settings_ = utils::MakeShared<
+ NiceMock<security_manager_test::MockCryptoManagerSettings>>();
+ utils::SharedPtr<security_manager::CryptoManagerSettings> client_crypto(
+ mock_client_manager_settings_);
+ client_manager_ = new security_manager::CryptoManagerImpl(client_crypto);
+
+ EXPECT_CALL(*mock_client_manager_settings_, security_manager_mode())
+ .WillOnce(Return(security_manager::CLIENT));
+ EXPECT_CALL(*mock_client_manager_settings_,
+ security_manager_protocol_name())
+ .WillOnce(Return(security_manager::TLSv1_2));
+ EXPECT_CALL(*mock_client_manager_settings_, certificate_data())
+ .WillOnce(ReturnRef(certificate_data_base64_));
+ EXPECT_CALL(*mock_client_manager_settings_, ciphers_list())
+ .WillRepeatedly(ReturnRef(kAllCiphers));
+ EXPECT_CALL(*mock_client_manager_settings_, ca_cert_path())
+ .Times(2)
+ .WillRepeatedly(ReturnRef(kCaPath));
+ EXPECT_CALL(*mock_client_manager_settings_, verify_peer())
+ .WillOnce(Return(false));
+ const bool client_manager_initialization = client_manager_->Init();
+ EXPECT_TRUE(client_manager_initialization);
+
+ ON_CALL(*mock_crypto_manager_settings_, maximum_payload_size())
+ .WillByDefault(Return(kMaximumPayloadSize));
+ ON_CALL(*mock_client_manager_settings_, maximum_payload_size())
+ .WillByDefault(Return(kMaximumPayloadSize));
+ EXPECT_CALL(*mock_crypto_manager_settings_, security_manager_mode())
+ .WillRepeatedly(Return(security_manager::SERVER));
+ server_ctx = crypto_manager_->CreateSSLContext();
+ EXPECT_CALL(*mock_client_manager_settings_, security_manager_mode())
+ .Times(2)
+ .WillRepeatedly(Return(security_manager::CLIENT));
+ client_ctx = client_manager_->CreateSSLContext();
+
+ security_manager::SSLContext::HandshakeContext ctx;
+ ctx.make_context(custom_str::CustomString("SPT"),
+ custom_str::CustomString("client"));
+ server_ctx->SetHandshakeContext(ctx);
+
+ ctx.expected_cn = "server";
+ client_ctx->SetHandshakeContext(ctx);
+
+ kServerBuf = NULL;
+ kClientBuf = NULL;
+ server_buf_len = 0u;
+ client_buf_len = 0u;
+ }
+
+ virtual void TearDown() OVERRIDE {
+ crypto_manager_->ReleaseSSLContext(server_ctx);
+ client_manager_->ReleaseSSLContext(client_ctx);
+
+ delete crypto_manager_;
+ delete client_manager_;
+ }
+
+ const size_t kMaximumPayloadSize = 1000u;
+ security_manager::CryptoManager* crypto_manager_;
+ security_manager::CryptoManager* client_manager_;
+ utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings>>
+ mock_crypto_manager_settings_;
+ utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings>>
+ mock_client_manager_settings_;
+ security_manager::SSLContext* server_ctx;
+ security_manager::SSLContext* client_ctx;
+
+ static std::string certificate_data_base64_;
+};
+std::string SSLTest::certificate_data_base64_;
+
+// StartHandshake() fails when client and server protocols are not TLSv1_2
+class SSLTestParam : public testing::TestWithParam<ProtocolAndCipher> {
+ protected:
+ virtual void SetUp() OVERRIDE {
+ std::ifstream certificate_file("server/spt_credential.p12");
+ ASSERT_TRUE(certificate_file.is_open())
+ << "Could not open certificate data file";
+
+ const std::string certificate(
+ (std::istreambuf_iterator<char>(certificate_file)),
+ std::istreambuf_iterator<char>());
+ certificate_file.close();
+ ASSERT_FALSE(certificate.empty()) << "Certificate data file is empty";
+ certificate_data_base64_ = certificate;
+
+ mock_crypto_manager_settings_ = utils::MakeShared<
+ NiceMock<security_manager_test::MockCryptoManagerSettings>>();
+ utils::SharedPtr<security_manager::CryptoManagerSettings> server_crypto(
+ mock_crypto_manager_settings_);
+ crypto_manager = new security_manager::CryptoManagerImpl(server_crypto);
+
+ SetServerInitialValues(GetParam().server_protocol,
+ GetParam().server_ciphers_list);
+
+ const bool crypto_manager_initialization = crypto_manager->Init();
+ EXPECT_TRUE(crypto_manager_initialization);
+
+ mock_client_manager_settings_ = utils::MakeShared<
+ NiceMock<security_manager_test::MockCryptoManagerSettings>>();
+
+ utils::SharedPtr<security_manager::CryptoManagerSettings> client_crypto(
+ mock_client_manager_settings_);
+ client_manager = new security_manager::CryptoManagerImpl(client_crypto);
+
+ SetClientInitialValues(GetParam().client_protocol,
+ GetParam().client_ciphers_list);
+
+ const bool client_manager_initialization = client_manager->Init();
+ EXPECT_TRUE(client_manager_initialization);
+
+ server_ctx = crypto_manager->CreateSSLContext();
+ client_ctx = client_manager->CreateSSLContext();
+
+ security_manager::SSLContext::HandshakeContext ctx;
+ ctx.make_context(custom_str::CustomString("SPT"),
+ custom_str::CustomString("client"));
+ server_ctx->SetHandshakeContext(ctx);
+
+ ctx.expected_cn = "server";
+ client_ctx->SetHandshakeContext(ctx);
+
+ kServerBuf = NULL;
+ kClientBuf = NULL;
+ server_buf_len = 0u;
+ client_buf_len = 0u;
+ }
+
+ virtual void TearDown() OVERRIDE {
+ crypto_manager->ReleaseSSLContext(server_ctx);
+ client_manager->ReleaseSSLContext(client_ctx);
+
+ delete crypto_manager;
+ delete client_manager;
+ }
+
+ void SetServerInitialValues(security_manager::Protocol protocol,
+ const std::string& server_ciphers_list) {
+ ON_CALL(*mock_crypto_manager_settings_, security_manager_mode())
+ .WillByDefault(Return(security_manager::SERVER));
+ ON_CALL(*mock_crypto_manager_settings_, security_manager_protocol_name())
+ .WillByDefault(Return(protocol));
+ ON_CALL(*mock_crypto_manager_settings_, certificate_data())
+ .WillByDefault(ReturnRef(certificate_data_base64_));
+ ON_CALL(*mock_crypto_manager_settings_, ciphers_list())
+ .WillByDefault(ReturnRef(server_ciphers_list));
+ ON_CALL(*mock_crypto_manager_settings_, ca_cert_path())
+ .WillByDefault(ReturnRef(kCaPath));
+ ON_CALL(*mock_crypto_manager_settings_, verify_peer())
+ .WillByDefault(Return(false));
+ }
+ void SetClientInitialValues(security_manager::Protocol protocol,
+ const std::string& client_ciphers_list) {
+ ON_CALL(*mock_client_manager_settings_, security_manager_mode())
+ .WillByDefault(Return(security_manager::CLIENT));
+ ON_CALL(*mock_client_manager_settings_, security_manager_protocol_name())
+ .WillByDefault(Return(protocol));
+ ON_CALL(*mock_client_manager_settings_, certificate_data())
+ .WillByDefault(ReturnRef(certificate_data_base64_));
+ ON_CALL(*mock_client_manager_settings_, ciphers_list())
+ .WillByDefault(ReturnRef(client_ciphers_list));
+ ON_CALL(*mock_client_manager_settings_, ca_cert_path())
+ .WillByDefault(ReturnRef(kCaPath));
+ ON_CALL(*mock_client_manager_settings_, verify_peer())
+ .WillByDefault(Return(false));
+ }
+
+ utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings>>
+ mock_crypto_manager_settings_;
+ utils::SharedPtr<NiceMock<security_manager_test::MockCryptoManagerSettings>>
+ mock_client_manager_settings_;
+ security_manager::CryptoManager* crypto_manager;
+ security_manager::CryptoManager* client_manager;
+ security_manager::SSLContext* server_ctx;
+ security_manager::SSLContext* client_ctx;
+ std::string certificate_data_base64_;
+};
+
+class SSLTestForTLS1_2 : public SSLTestParam {};
+
+// This case fails starting because we can handshake only with TLSv1_2 protocol.
+INSTANTIATE_TEST_CASE_P(
+ CorrectProtocolAndCiphers,
+ SSLTestParam,
+ ::testing::Values(ProtocolAndCipher(security_manager::TLSv1,
+ security_manager::TLSv1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_1,
+ security_manager::TLSv1_1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::SSLv3,
+ security_manager::SSLv3,
+ kFordCipher,
+ kFordCipher)));
+
+INSTANTIATE_TEST_CASE_P(
+ IncorrectProtocolAndCiphers,
+ SSLTestParam,
+ ::testing::Values(ProtocolAndCipher(security_manager::TLSv1,
+ security_manager::TLSv1_1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1,
+ security_manager::SSLv3,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_1,
+ security_manager::TLSv1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_1,
+ security_manager::SSLv3,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_2,
+ security_manager::TLSv1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_2,
+ security_manager::TLSv1_1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_2,
+ security_manager::SSLv3,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::SSLv3,
+ security_manager::TLSv1,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::SSLv3,
+ security_manager::TLSv1_1,
+ kFordCipher,
+ kFordCipher)));
+
+TEST_F(SSLTest, OnTSL2Protocol_BrokenHandshake) {
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ client_ctx->StartHandshake(&kClientBuf, &client_buf_len));
+ ASSERT_FALSE(NULL == kClientBuf);
+ ASSERT_LT(0u, client_buf_len);
+ // Broke 3 bytes for get abnormal fail of handshake
+ const_cast<uint8_t*>(kClientBuf)[0] ^= 0xFF;
+ const_cast<uint8_t*>(kClientBuf)[client_buf_len / 2] ^= 0xFF;
+ const_cast<uint8_t*>(kClientBuf)[client_buf_len - 1] ^= 0xFF;
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_AbnormalFail,
+ server_ctx->DoHandshakeStep(
+ kClientBuf, client_buf_len, &kServerBuf, &server_buf_len));
+ EXPECT_EQ("Initialization is not completed", server_ctx->LastError());
+ EXPECT_EQ("Initialization is not completed", client_ctx->LastError());
+}
+
+// TODO {AKozoriz} : Unexpected uncomplited init of SSL component.
+// In this and next tests.
+// Must be fixed after merge to develop.
+TEST_F(SSLTest, DISABLED_OnTSL2Protocol_Positive) {
+ ASSERT_EQ(client_ctx->StartHandshake(&kClientBuf, &client_buf_len),
+ security_manager::SSLContext::Handshake_Result_Success);
+ ASSERT_FALSE(NULL == kClientBuf);
+ ASSERT_LT(0u, client_buf_len);
+ EXPECT_TRUE(server_ctx->IsInitCompleted());
+
+ while (true) {
+ const security_manager::SSLContext::HandshakeResult server_result =
+ server_ctx->DoHandshakeStep(
+ kClientBuf, client_buf_len, &kServerBuf, &server_buf_len);
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ server_result);
+ ASSERT_FALSE(NULL == kServerBuf);
+ ASSERT_LT(0u, server_buf_len);
+
+ const security_manager::SSLContext::HandshakeResult client_result =
+ client_ctx->DoHandshakeStep(
+ kServerBuf, server_buf_len, &kClientBuf, &client_buf_len);
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ client_result);
+ if (server_ctx->IsInitCompleted()) {
+ break;
+ }
+
+ ASSERT_FALSE(NULL == kClientBuf);
+ ASSERT_LT(0u, client_buf_len);
+ }
+ // Expect empty buffers after init complete
+ ASSERT_TRUE(NULL == kClientBuf);
+ ASSERT_EQ(0u, client_buf_len);
+ // expect both side initialization complete
+ EXPECT_TRUE(client_ctx->IsInitCompleted());
+ EXPECT_TRUE(server_ctx->IsInitCompleted());
+
+ // Encrypt text on client side
+ const uint8_t* text = reinterpret_cast<const uint8_t*>("abra");
+ const uint8_t* encrypted_text = 0;
+ size_t text_len = 4;
+ size_t encrypted_text_len;
+ EXPECT_TRUE(client_ctx->Encrypt(
+ text, text_len, &encrypted_text, &encrypted_text_len));
+
+ ASSERT_NE(reinterpret_cast<void*>(NULL), encrypted_text);
+ ASSERT_LT(0u, encrypted_text_len);
+
+ // Decrypt text on server side
+ EXPECT_TRUE(server_ctx->Decrypt(
+ encrypted_text, encrypted_text_len, &text, &text_len));
+ ASSERT_NE(reinterpret_cast<void*>(NULL), text);
+ ASSERT_LT(0u, text_len);
+
+ ASSERT_EQ(strncmp(reinterpret_cast<const char*>(text), "abra", 4), 0);
+}
+
+TEST_F(SSLTest, DISABLED_OnTSL2Protocol_EcncryptionFail) {
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ client_ctx->StartHandshake(&kClientBuf, &client_buf_len));
+
+ while (!server_ctx->IsInitCompleted()) {
+ ASSERT_FALSE(NULL == kClientBuf);
+ ASSERT_LT(0u, client_buf_len);
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ server_ctx->DoHandshakeStep(
+ kClientBuf, client_buf_len, &kServerBuf, &server_buf_len));
+ ASSERT_FALSE(NULL == kServerBuf);
+ ASSERT_LT(0u, server_buf_len);
+
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ client_ctx->DoHandshakeStep(
+ kServerBuf, server_buf_len, &kClientBuf, &client_buf_len));
+ }
+ // Expect empty buffers after init complete
+ ASSERT_TRUE(NULL == kClientBuf);
+ ASSERT_EQ(0u, client_buf_len);
+ // Expect both side initialization complete
+ EXPECT_TRUE(client_ctx->IsInitCompleted());
+ EXPECT_TRUE(server_ctx->IsInitCompleted());
+
+ // Encrypt text on client side
+ const uint8_t* text = reinterpret_cast<const uint8_t*>("abra");
+ const uint8_t* encrypted_text = 0;
+ size_t text_len = 4;
+ size_t encrypted_text_len;
+ EXPECT_TRUE(client_ctx->Encrypt(
+ text, text_len, &encrypted_text, &encrypted_text_len));
+ ASSERT_NE(reinterpret_cast<void*>(NULL), encrypted_text);
+ ASSERT_LT(0u, encrypted_text_len);
+
+ std::vector<uint8_t> broken(encrypted_text,
+ encrypted_text + encrypted_text_len);
+ // Broke message
+ broken[encrypted_text_len / 2] ^= 0xFF;
+
+ const uint8_t* out_text;
+ size_t out_text_size;
+ // Decrypt broken text on server side
+ EXPECT_FALSE(server_ctx->Decrypt(
+ &broken[0], broken.size(), &out_text, &out_text_size));
+
+ // Check after broken message that server encryption and decryption fail
+ // Encrypte message on server side
+ EXPECT_FALSE(server_ctx->Decrypt(
+ encrypted_text, encrypted_text_len, &out_text, &out_text_size));
+ EXPECT_FALSE(server_ctx->Encrypt(
+ text, text_len, &encrypted_text, &encrypted_text_len));
+}
+
+TEST_P(SSLTestParam, ClientAndServerNotTLSv1_2_HandshakeFailed) {
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_AbnormalFail,
+ client_ctx->StartHandshake(&kClientBuf, &client_buf_len));
+ EXPECT_TRUE(NULL == kClientBuf);
+ EXPECT_EQ(0u, client_buf_len);
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ server_ctx->DoHandshakeStep(
+ kClientBuf, client_buf_len, &kServerBuf, &server_buf_len));
+ EXPECT_TRUE(NULL == kServerBuf);
+ EXPECT_EQ(0u, server_buf_len);
+
+ EXPECT_FALSE(server_ctx->IsInitCompleted());
+}
+
+INSTANTIATE_TEST_CASE_P(
+ ServerProtocolTLSv12,
+ SSLTestForTLS1_2,
+ ::testing::Values(ProtocolAndCipher(security_manager::TLSv1,
+ security_manager::TLSv1_2,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::TLSv1_1,
+ security_manager::TLSv1_2,
+ kFordCipher,
+ kFordCipher),
+ ProtocolAndCipher(security_manager::SSLv3,
+ security_manager::TLSv1_2,
+ kFordCipher,
+ kFordCipher)));
+
+TEST_P(SSLTestForTLS1_2, HandshakeFailed) {
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_Success,
+ client_ctx->StartHandshake(&kClientBuf, &client_buf_len));
+ EXPECT_FALSE(NULL == kClientBuf);
+ ASSERT_LT(0u, client_buf_len);
+ ASSERT_EQ(security_manager::SSLContext::Handshake_Result_AbnormalFail,
+ server_ctx->DoHandshakeStep(
+ kClientBuf, client_buf_len, &kServerBuf, &server_buf_len));
+ EXPECT_TRUE(NULL == kServerBuf);
+ EXPECT_EQ(0u, server_buf_len);
+
+ EXPECT_FALSE(server_ctx->IsInitCompleted());
+}
+
+} // namespace ssl_context_test
+} // namespace components
+} // namespace test
diff --git a/src/components/smart_objects/include/smart_objects/number_schema_item.h b/src/components/smart_objects/include/smart_objects/number_schema_item.h
index fb4d287fe4..b97b20bd9f 100644
--- a/src/components/smart_objects/include/smart_objects/number_schema_item.h
+++ b/src/components/smart_objects/include/smart_objects/number_schema_item.h
@@ -34,10 +34,11 @@
#define SRC_COMPONENTS_SMART_OBJECTS_INCLUDE_SMART_OBJECTS_NUMBER_SCHEMA_ITEM_H_
#include <typeinfo>
-
+#include <limits>
#include "utils/shared_ptr.h"
#include "smart_objects/default_shema_item.h"
#include "smart_objects/schema_item_parameter.h"
+#include "utils/convert_utils.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
@@ -111,32 +112,36 @@ template<typename NumberType>
bool TNumberSchemaItem<NumberType>::isValidNumberType(SmartType type) {
NumberType value(0);
if ((SmartType_Double == type) &&
- (typeid(double) == typeid(value))) {
+ (typeid(double) == typeid(value))) {
return true;
} else if ((SmartType_Integer == type) &&
(typeid(int32_t) == typeid(value) ||
typeid(uint32_t) == typeid(value) ||
- typeid(int64_t) == typeid(value))) {
+ typeid(int64_t) == typeid(value) ||
+ typeid(double) == typeid(value))) {
return true;
} else {
return false;
}
}
-template<typename NumberType>
-Errors::eType TNumberSchemaItem<NumberType>::validate(const SmartObject& Object) {
+template <typename NumberType>
+Errors::eType TNumberSchemaItem<NumberType>::validate(
+ const SmartObject& Object) {
if (!isValidNumberType(Object.getType())) {
return Errors::INVALID_VALUE;
}
NumberType value(0);
if (typeid(int32_t) == typeid(value)) {
- value = Object.asInt();
+ value = utils::SafeStaticCast<int64_t,int32_t>(Object.asInt());
} else if (typeid(uint32_t) == typeid(value)) {
- value = Object.asUInt();
+ value = utils::SafeStaticCast<uint64_t,uint32_t>(Object.asUInt());
} else if (typeid(double) == typeid(value)) {
value = Object.asDouble();
} else if (typeid(int64_t) == typeid(value)) {
- value = Object.asInt64();
+ value = Object.asInt();
+ } else if (typeid(uint64_t) == typeid(value)) {
+ value = Object.asUInt();
} else {
NOTREACHED();
}
@@ -183,7 +188,7 @@ template<>
SmartType TNumberSchemaItem<uint32_t>::getSmartType() const;
template<>
-SmartType TNumberSchemaItem<uint32_t>::getSmartType() const;
+SmartType TNumberSchemaItem<int64_t>::getSmartType() const;
template<>
SmartType TNumberSchemaItem<double>::getSmartType() const;
diff --git a/src/components/smart_objects/include/smart_objects/smart_object.h b/src/components/smart_objects/include/smart_objects/smart_object.h
index bd70b7ea11..688550b040 100644
--- a/src/components/smart_objects/include/smart_objects/smart_object.h
+++ b/src/components/smart_objects/include/smart_objects/smart_object.h
@@ -39,9 +39,13 @@
#include <map>
#include "smart_objects/smart_schema.h"
+#include "utils/custom_string.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
+
+namespace custom_str = utils::custom_string;
+
class SmartObject;
/**
@@ -89,12 +93,19 @@ enum SmartType {
SmartType_Array = 7,
/**
- * @brief Binary data value. Gives possibility for object to store binary data.
+ * @brief Binary data value. Gives possibility for object to store binary
+ *data.
**/
SmartType_Binary = 8,
/**
- * @brief Invalid value. Represents invalid object that cannot change his type.
+ * @brief Unsigned Integer value.
+ **/
+ SmartType_UInteger = 9,
+
+ /**
+ * @brief Invalid value. Represents invalid object that cannot change his
+ *type.
**/
SmartType_Invalid = -1
};
@@ -124,9 +135,12 @@ typedef std::vector<SmartObjectSPtr> SmartObjectList;
/**
* @brief Main SmartObject class
*
- * This class act as Variant type from other languages and can be used as primitive type
- * like bool, int32_t, char, double, string and as complex type like array and map.
+ * This class act as Variant type from other languages and can be used as
+ *primitive type
+ * like bool, int32_t, char, double, string and as complex type like array and
+ *map.
**/
+
class SmartObject FINAL {
public:
/**
@@ -149,7 +163,7 @@ class SmartObject FINAL {
*
* @param pointer
**/
- template<typename UnknownType>
+ template <typename UnknownType>
SmartObject(const UnknownType&);
/**
@@ -192,14 +206,14 @@ class SmartObject FINAL {
*
* @param InitialValue Initial object value
**/
- explicit SmartObject(int32_t InitialValue);
+ explicit SmartObject(const int32_t InitialValue);
/**
- * @brief Returns current object converted to int32_t
+ * @brief Returns current object converted to int64_t
*
- * @return int32_t
+ * @return int64_t
**/
- int32_t asInt() const;
+ int64_t asInt() const;
/**
* @brief Assignment operator for type: int32_t
@@ -207,7 +221,7 @@ class SmartObject FINAL {
* @param NewValue New object value
* @return SmartObject&
**/
- SmartObject& operator=(int32_t NewValue);
+ SmartObject& operator=(const int32_t NewValue);
/**
* @brief Comparison operator for comparing object with integer value
@@ -215,7 +229,7 @@ class SmartObject FINAL {
* @param Value Value to compare object with
* @return bool
**/
- bool operator==(int32_t Value) const;
+ bool operator==(const int32_t Value) const;
// Support of type: uint32_t
/**
@@ -223,14 +237,14 @@ class SmartObject FINAL {
*
* @param InitialValue Initial object value
**/
- explicit SmartObject(uint32_t InitialValue);
+ explicit SmartObject(const uint32_t InitialValue);
/**
- * @brief Returns current object converted to uint32_t int32_t
+ * @brief Returns current object converted to uint64_t
*
- * @return double
+ * @return uint64_t
**/
- uint32_t asUInt() const;
+ uint64_t asUInt() const;
/**
* @brief Assignment operator for type: int32_t
@@ -238,7 +252,7 @@ class SmartObject FINAL {
* @param NewValue New object value
* @return SmartObject&
**/
- SmartObject& operator=(uint32_t NewValue);
+ SmartObject& operator=(const uint32_t NewValue);
/**
* @brief Comparison operator for comparing object with uint32_t value
@@ -246,7 +260,7 @@ class SmartObject FINAL {
* @param Value Value to compare object with
* @return bool
**/
- bool operator==(uint32_t Value) const;
+ bool operator==(const uint32_t Value) const;
/**
* @name Support of type: int64_t
@@ -257,7 +271,7 @@ class SmartObject FINAL {
*
* @param InitialValue Initial object value
**/
- explicit SmartObject(int64_t InitialValue);
+ explicit SmartObject(const int64_t InitialValue);
/**
* @brief Returns current object converted to int64_t
@@ -272,7 +286,7 @@ class SmartObject FINAL {
* @param NewValue New object value
* @return SmartObject&
**/
- SmartObject& operator=(int64_t NewValue);
+ SmartObject& operator=(const int64_t NewValue);
/**
* @brief Comparison operator for comparing object with integer value
@@ -280,7 +294,20 @@ class SmartObject FINAL {
* @param Value Value to compare object with
* @return bool
**/
- bool operator==(int64_t Value) const;
+ bool operator==(const int64_t Value) const;
+
+ /**
+ * @name Support of type: uint64_t
+ * @{
+ **/
+
+ /**
+ * @brief Assignment operator for type: uint64_t
+ *
+ * @param NewValue New object value
+ * @return SmartObject&
+ **/
+ SmartObject& operator=(const uint64_t NewValue);
/** @} */
@@ -401,6 +428,13 @@ class SmartObject FINAL {
explicit SmartObject(const std::string& InitialValue);
/**
+ * @brief Constructor for creating object of type: CustomString
+ *
+ * @param InitialValue Initial object value
+ **/
+ explicit SmartObject(const custom_str::CustomString& InitialValue);
+
+ /**
* @brief Constructor for creating object of type: string
*
* @param InitialValue Initial object value
@@ -408,6 +442,13 @@ class SmartObject FINAL {
explicit SmartObject(const char* InitialValue);
/**
+ * @brief Returns current object converted to CustomString
+ *
+ * @return custom_str::CustomString
+ **/
+ custom_str::CustomString asCustomString() const;
+
+ /**
* @brief Returns current object converted to string
*
* @return std::string
@@ -423,6 +464,14 @@ class SmartObject FINAL {
const char* asCharArray() const;
/**
+ * @brief Assignment operator for type: CustomString
+ *
+ * @param NewValue New object value
+ * @return SmartObject&
+ **/
+ SmartObject& operator=(const custom_str::CustomString& NewValue);
+
+ /**
* @brief Assignment operator for type: string
*
* @param NewValue New object value
@@ -673,7 +722,7 @@ class SmartObject FINAL {
* @param Other value to be compared with
* @return bool Result of nequation
**/
- template<typename Type>
+ template <typename Type>
bool operator!=(const Type& Other) const {
return !(*this == Other);
}
@@ -697,7 +746,8 @@ class SmartObject FINAL {
/**
* @brief Converts object to int32_t type
*
- * @return int32_t Converted value or invalid_int_value if conversion not possible
+ * @return int32_t Converted value or invalid_int_value if conversion not
+ *possible
**/
inline int64_t convert_int() const;
/** @} */
@@ -719,7 +769,8 @@ class SmartObject FINAL {
/**
* @brief Converts object to char type
*
- * @return int32_t Converted value or invalid_char_value if conversion not possible
+ * @return int32_t Converted value or invalid_char_value if conversion not
+ *possible
**/
inline char convert_char() const;
/** @} */
@@ -741,7 +792,8 @@ class SmartObject FINAL {
/**
* @brief Converts object to double type
*
- * @return int32_t Converted value or invalid_double_value if conversion not possible
+ * @return int32_t Converted value or invalid_double_value if conversion not
+ *possible
**/
inline double convert_double() const;
/** @} */
@@ -763,16 +815,13 @@ class SmartObject FINAL {
/**
* @brief Converts object to bool type
*
- * @return int32_t Converted value or invalid_bool_value if conversion not possible
+ * @return int32_t Converted value or invalid_bool_value if conversion not
+ *possible
**/
inline bool convert_bool() const;
/** @} */
/**
- * @name Support of type: string (internal)
- * @{
- */
- /**
* @brief Sets new string value to the object.
*
* This method changes also internal object type
@@ -780,10 +829,10 @@ class SmartObject FINAL {
* @param NewValue New object value
* @return void
**/
- inline void set_value_string(const std::string& NewValue);
+ inline void set_value_string(const custom_str::CustomString& NewValue);
/**
- * @brief Sets new string value to the object.
+ * @brief Sets new CustomString value to the object.
*
* This method changes also internal object type
*
@@ -795,12 +844,21 @@ class SmartObject FINAL {
/**
* @brief Converts object to string type
*
- * @return int32_t Converted value or invalid_string_value if conversion not possible
+ * @return int32_t Converted value or invalid_string_value if conversion not
+ *possible
**/
inline std::string convert_string() const;
/** @} */
/**
+ * @brief Converts object to CustomString type
+ *
+ * @return CustomString Converted value or
+ * invalid_string_value if conversion not possible
+ **/
+ inline custom_str::CustomString convert_custom_string() const;
+
+ /**
* @name Support of type: binary (internal)
* @{
*/
@@ -817,7 +875,8 @@ class SmartObject FINAL {
/**
* @brief Converts object to binary type
*
- * @return int32_t Converted value or invalid_binary_value if conversion not possible
+ * @return int32_t Converted value or invalid_binary_value if conversion not
+ *possible
**/
inline SmartBinary convert_binary() const;
@@ -843,7 +902,7 @@ class SmartObject FINAL {
* @param Value Pointer to string to convert
* @return double
**/
- static double convert_string_to_double(const std::string* Value);
+ static double convert_string_to_double(const custom_str::CustomString* Value);
/**
* @brief Converts string to int64_t
@@ -851,7 +910,8 @@ class SmartObject FINAL {
* @param Value Pointer to string to convert
* @return int64_t int64_t
**/
- static uint64_t convert_string_to_integer(const std::string* Value);
+ static uint64_t convert_string_to_integer(
+ const custom_str::CustomString* Value);
/**
* @brief Converts double value to string
@@ -901,7 +961,7 @@ class SmartObject FINAL {
bool bool_value;
char char_value;
int64_t int_value;
- std::string* str_value;
+ custom_str::CustomString* str_value;
SmartArray* array_value;
SmartMap* map_value;
SmartBinary* binary_value;
diff --git a/src/components/smart_objects/src/smart_object.cc b/src/components/smart_objects/src/smart_object.cc
index 264652e448..5c90de5671 100644
--- a/src/components/smart_objects/src/smart_object.cc
+++ b/src/components/smart_objects/src/smart_object.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -50,28 +50,26 @@ namespace NsSmartObjects {
**/
static const char* invalid_cstr_value = "";
-SmartObject::SmartObject()
- : m_type(SmartType_Null),
- m_schema() {
+SmartObject::SmartObject() : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
}
SmartObject::SmartObject(const SmartObject& Other)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
duplicate(Other);
}
-SmartObject::SmartObject(SmartType Type)
- : m_type(SmartType_Null),
- m_schema() {
+SmartObject::SmartObject(SmartType Type) : m_type(SmartType_Null), m_schema() {
switch (Type) {
case SmartType_Null:
break;
case SmartType_Integer:
set_value_integer(0);
break;
+ case SmartType_UInteger:
+ set_value_integer(0);
+ break;
case SmartType_Double:
set_value_double(0);
break;
@@ -82,7 +80,7 @@ SmartObject::SmartObject(SmartType Type)
set_value_char(' ');
break;
case SmartType_String:
- set_value_string("");
+ set_value_string(custom_str::CustomString());
break;
case SmartType_Map:
m_data.map_value = new SmartMap();
@@ -121,6 +119,8 @@ bool SmartObject::operator==(const SmartObject& Other) const {
switch (m_type) {
case SmartType_Integer:
return m_data.int_value == Other.m_data.int_value;
+ case SmartType_UInteger:
+ return m_data.int_value == Other.m_data.int_value;
case SmartType_Double:
return m_data.double_value == Other.m_data.double_value;
case SmartType_Boolean:
@@ -134,17 +134,19 @@ bool SmartObject::operator==(const SmartObject& Other) const {
return true;
if (m_data.map_value->size() != Other.m_data.map_value->size())
return false;
- return std::equal(m_data.map_value->begin(), m_data.map_value->end(),
+ return std::equal(m_data.map_value->begin(),
+ m_data.map_value->end(),
Other.m_data.map_value->begin());
- }
+ }
case SmartType_Array: {
if (m_data.array_value == Other.m_data.array_value)
return true;
if (m_data.array_value->size() != Other.m_data.array_value->size())
return false;
- return std::equal(m_data.array_value->begin(), m_data.array_value->end(),
+ return std::equal(m_data.array_value->begin(),
+ m_data.array_value->end(),
Other.m_data.array_value->begin());
- }
+ }
case SmartType_Binary: {
if (m_data.binary_value == Other.m_data.binary_value)
return true;
@@ -153,7 +155,7 @@ bool SmartObject::operator==(const SmartObject& Other) const {
return std::equal(m_data.binary_value->begin(),
m_data.binary_value->end(),
Other.m_data.binary_value->begin());
- }
+ }
case SmartType_Null:
return true;
case SmartType_Invalid:
@@ -165,24 +167,18 @@ bool SmartObject::operator==(const SmartObject& Other) const {
return false;
}
-// =============================================================
-// INTEGER TYPE SUPPORT
-// =============================================================
SmartObject::SmartObject(int32_t InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_integer(InitialValue);
}
-int32_t SmartObject::asInt() const {
+int64_t SmartObject::asInt() const {
const int64_t convert = convert_int();
if (invalid_int64_value == convert) {
return invalid_int_value;
}
- DCHECK(convert >= std::numeric_limits<int32_t>::min());
- DCHECK(convert <= std::numeric_limits<int32_t>::max());
- return static_cast<int32_t>(convert);
+ return convert;
}
SmartObject& SmartObject::operator=(const int32_t NewValue) {
@@ -201,7 +197,12 @@ bool SmartObject::operator==(const int32_t Value) const {
}
void SmartObject::set_value_integer(int64_t NewValue) {
- set_new_type(SmartType_Integer);
+ if (NewValue > std::numeric_limits<int32_t>::max() &&
+ NewValue <= std::numeric_limits<uint32_t>::max()) {
+ set_new_type(SmartType_UInteger);
+ } else {
+ set_new_type(SmartType_Integer);
+ }
m_data.int_value = NewValue;
}
@@ -213,6 +214,8 @@ int64_t SmartObject::convert_int() const {
return (m_data.bool_value == true) ? 1 : 0;
case SmartType_Integer:
return m_data.int_value;
+ case SmartType_UInteger:
+ return m_data.int_value;
case SmartType_Double:
return static_cast<int64_t>(m_data.double_value);
default:
@@ -221,24 +224,18 @@ int64_t SmartObject::convert_int() const {
return invalid_int64_value;
}
-// =============================================================
-// uint32_t TYPE SUPPORT
-// =============================================================
SmartObject::SmartObject(uint32_t InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_integer(InitialValue);
}
-uint32_t SmartObject::asUInt() const {
+uint64_t SmartObject::asUInt() const {
const int64_t convert = convert_int();
- if (invalid_int64_value == convert) {
+ if (convert <= invalid_int_value) {
return invalid_unsigned_int_value;
}
- DCHECK(convert >= std::numeric_limits<uint32_t>::min());
- DCHECK(convert <= std::numeric_limits<uint32_t>::max());
- return static_cast<uint32_t>(convert);
+ return static_cast<uint64_t>(convert);
}
SmartObject& SmartObject::operator=(const uint32_t NewValue) {
@@ -256,20 +253,12 @@ bool SmartObject::operator==(const uint32_t Value) const {
return comp == static_cast<int64_t>(Value);
}
-// =============================================================
-// int64_t TYPE SUPPORT
-// =============================================================
SmartObject::SmartObject(int64_t InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_integer(InitialValue);
}
-int64_t SmartObject::asInt64() const {
- return convert_int();
-}
-
SmartObject& SmartObject::operator=(const int64_t NewValue) {
if (m_type != SmartType_Invalid) {
set_value_integer(NewValue);
@@ -285,12 +274,15 @@ bool SmartObject::operator==(const int64_t Value) const {
return comp == Value;
}
-// =============================================================
-// DOUBLE TYPE SUPPORT
-// =============================================================
+SmartObject& SmartObject::operator=(const uint64_t NewValue) {
+ if (m_type != SmartType_Invalid) {
+ set_value_integer(NewValue);
+ }
+ return *this;
+}
+
SmartObject::SmartObject(double InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_double(InitialValue);
}
@@ -335,13 +327,8 @@ double SmartObject::convert_double() const {
return invalid_double_value;
}
-// =============================================================
-// BOOL TYPE SUPPORT
-// =============================================================
-
SmartObject::SmartObject(bool InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_bool(InitialValue);
}
@@ -385,13 +372,8 @@ bool SmartObject::convert_bool() const {
return invalid_bool_value;
}
-// =============================================================
-// CHAR TYPE SUPPORT
-// =============================================================
-
SmartObject::SmartObject(char InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_char(InitialValue);
}
@@ -423,9 +405,10 @@ void SmartObject::set_value_char(char NewValue) {
char SmartObject::convert_char() const {
switch (m_type) {
case SmartType_String:
- return
- (m_data.str_value->length() == 1) ?
- m_data.str_value->at(0) : invalid_char_value;
+ return (m_data.str_value->length() == 1 &&
+ m_data.str_value->is_ascii_string())
+ ? m_data.str_value->at(0)
+ : invalid_char_value;
case SmartType_Character:
return m_data.char_value;
default:
@@ -438,17 +421,26 @@ char SmartObject::convert_char() const {
// STD::STRING TYPE SUPPORT
// =============================================================
-SmartObject::SmartObject(const std::string& InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+SmartObject::SmartObject(const custom_str::CustomString& InitialValue)
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_string(InitialValue);
}
+SmartObject::SmartObject(const std::string& InitialValue)
+ : m_type(SmartType_Null), m_schema() {
+ m_data.str_value = NULL;
+ set_value_string(custom_str::CustomString(InitialValue));
+}
+
std::string SmartObject::asString() const {
return convert_string();
}
+custom_str::CustomString SmartObject::asCustomString() const {
+ return convert_custom_string();
+}
+
const char* SmartObject::asCharArray() const {
if (m_data.str_value != NULL) {
return m_data.str_value->c_str();
@@ -458,50 +450,65 @@ const char* SmartObject::asCharArray() const {
SmartObject& SmartObject::operator=(const std::string& NewValue) {
if (m_type != SmartType_Invalid) {
+ set_value_string(custom_str::CustomString(NewValue));
+ }
+ return *this;
+}
+
+SmartObject& SmartObject::operator=(const custom_str::CustomString& NewValue) {
+ if (m_type != SmartType_Invalid) {
set_value_string(NewValue);
}
return *this;
}
bool SmartObject::operator==(const std::string& Value) const {
- const std::string comp = convert_string();
+ const custom_str::CustomString& comp(convert_custom_string());
if (comp == invalid_string_value) {
return false;
}
return comp == Value;
}
-void SmartObject::set_value_string(const std::string& NewValue) {
+void SmartObject::set_value_string(const custom_str::CustomString& NewValue) {
set_new_type(SmartType_String);
- m_data.str_value = new std::string(NewValue);
+ m_data.str_value = new custom_str::CustomString(NewValue);
}
std::string SmartObject::convert_string() const {
switch (m_type) {
- case SmartType_String:
- return *(m_data.str_value);
case SmartType_Integer: {
- std::stringstream stream;
- stream << m_data.int_value;
- return stream.str();
- }
+ std::stringstream stream;
+ stream << m_data.int_value;
+ return stream.str();
+ }
case SmartType_Character:
return std::string(1, m_data.char_value);
case SmartType_Double:
return convert_double_to_string(m_data.double_value);
+ case SmartType_String:
+ return (m_data.str_value)->AsMBString();
default:
break;
}
return NsSmartDeviceLink::NsSmartObjects::invalid_cstr_value;
}
+custom_str::CustomString SmartObject::convert_custom_string() const {
+ switch (m_type) {
+ case SmartType_String:
+ return *(m_data.str_value);
+ default:
+ return custom_str::CustomString(convert_string());
+ }
+}
+
// =============================================================
// CHAR* TYPE SUPPORT
// =============================================================
SmartObject::SmartObject(const char* const InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_cstr(InitialValue);
return;
@@ -515,7 +522,7 @@ SmartObject& SmartObject::operator=(const char* NewValue) {
}
bool SmartObject::operator==(const char* Value) const {
- const std::string comp = convert_string();
+ const custom_str::CustomString& comp(convert_custom_string());
if (comp == invalid_string_value) {
return false;
}
@@ -523,15 +530,15 @@ bool SmartObject::operator==(const char* Value) const {
}
void SmartObject::set_value_cstr(const char* NewValue) {
- set_value_string(NewValue ? std::string(NewValue) : std::string());
+ set_value_string(NewValue ? custom_str::CustomString(NewValue)
+ : custom_str::CustomString());
}
// =============================================================
// BINARY TYPE SUPPORT
// =============================================================
SmartObject::SmartObject(const SmartBinary& InitialValue)
- : m_type(SmartType_Null),
- m_schema() {
+ : m_type(SmartType_Null), m_schema() {
m_data.str_value = NULL;
set_value_binary(InitialValue);
}
@@ -622,7 +629,7 @@ SmartObject& SmartObject::operator[](const std::string& Key) {
return handle_map_access(Key);
}
-const SmartObject& SmartObject::operator[] (const std::string& Key) const {
+const SmartObject& SmartObject::operator[](const std::string& Key) const {
return getElement(Key);
}
@@ -683,7 +690,7 @@ void SmartObject::duplicate(const SmartObject& OtherObject) {
SmartData newData;
const SmartType newType = OtherObject.m_type;
switch (newType) {
- case SmartType_Null: // on duplicate empty SmartObject
+ case SmartType_Null: // on duplicate empty SmartObject
return;
case SmartType_Map:
newData.map_value = new SmartMap(*OtherObject.m_data.map_value);
@@ -704,7 +711,8 @@ void SmartObject::duplicate(const SmartObject& OtherObject) {
newData.char_value = OtherObject.m_data.char_value;
break;
case SmartType_String:
- newData.str_value = new std::string(*OtherObject.m_data.str_value);
+ newData.str_value =
+ new custom_str::CustomString(*OtherObject.m_data.str_value);
break;
case SmartType_Binary:
newData.binary_value = new SmartBinary(*OtherObject.m_data.binary_value);
@@ -777,8 +785,9 @@ void SmartObject::set_new_type(SmartType NewType) {
m_type = NewType;
}
-double SmartObject::convert_string_to_double(const std::string* Value) {
- if (!Value || Value->empty()) {
+double SmartObject::convert_string_to_double(
+ const custom_str::CustomString* Value) {
+ if (!Value || Value->empty() || !(Value->is_ascii_string())) {
return invalid_double_value;
}
@@ -811,12 +820,13 @@ std::string SmartObject::convert_double_to_string(const double& Value) {
return s;
}
-uint64_t SmartObject::convert_string_to_integer(const std::string* Value) {
- if (!Value || Value->empty()) {
+uint64_t SmartObject::convert_string_to_integer(
+ const custom_str::CustomString* Value) {
+ if (!Value || Value->empty() || !(Value->is_ascii_string())) {
return invalid_int64_value;
}
int64_t result;
- std::stringstream stream(*Value);
+ std::stringstream stream(Value->AsMBString());
stream >> result;
if (stream.eof()) {
return result;
@@ -828,20 +838,18 @@ SmartType SmartObject::getType() const {
return m_type;
}
-std::string SmartObject::OperatorToTransform(const SmartMap::value_type &pair) {
- return pair.first;
+std::string SmartObject::OperatorToTransform(const SmartMap::value_type& pair) {
+ return pair.first;
}
std::set<std::string> SmartObject::enumerate() const {
std::set<std::string> keys;
if (m_type == SmartType_Map) {
- std::transform(
- m_data.map_value->begin(),
- m_data.map_value->end(),
- std::inserter(keys, keys.end()),
- &SmartObject::OperatorToTransform
- );
+ std::transform(m_data.map_value->begin(),
+ m_data.map_value->end(),
+ std::inserter(keys, keys.end()),
+ &SmartObject::OperatorToTransform);
}
return keys;
}
diff --git a/src/components/smart_objects/src/string_schema_item.cc b/src/components/smart_objects/src/string_schema_item.cc
index c9c00e8896..3fac3a6cde 100644
--- a/src/components/smart_objects/src/string_schema_item.cc
+++ b/src/components/smart_objects/src/string_schema_item.cc
@@ -31,10 +31,13 @@
*/
#include "smart_objects/smart_object.h"
#include "smart_objects/string_schema_item.h"
+#include "utils/custom_string.h"
namespace NsSmartDeviceLink {
namespace NsSmartObjects {
+namespace custom_str = utils::custom_string;
+
utils::SharedPtr<CStringSchemaItem> CStringSchemaItem::create(
const TSchemaItemParameter<size_t>& MinLength,
const TSchemaItemParameter<size_t>& MaxLength,
@@ -47,7 +50,7 @@ Errors::eType CStringSchemaItem::validate(const SmartObject& Object) {
return Errors::INVALID_VALUE;
}
- const std::string value = Object.asString();
+ const custom_str::CustomString value = Object.asCustomString();
size_t length;
if (mMinLength.getValue(length) && (value.size() < length)) {
@@ -71,10 +74,9 @@ CStringSchemaItem::CStringSchemaItem(
const TSchemaItemParameter<size_t>& MinLength,
const TSchemaItemParameter<size_t>& MaxLength,
const TSchemaItemParameter<std::string>& DefaultValue)
- : CDefaultSchemaItem<std::string>(DefaultValue),
- mMinLength(MinLength),
- mMaxLength(MaxLength) {
-}
+ : CDefaultSchemaItem<std::string>(DefaultValue)
+ , mMinLength(MinLength)
+ , mMaxLength(MaxLength) {}
} // namespace NsSmartObjects
} // namespace NsSmartDeviceLink
diff --git a/src/components/smart_objects/test/CObjectSchemaItem_test.cc b/src/components/smart_objects/test/CObjectSchemaItem_test.cc
index b5e1286ee1..82e859702b 100644
--- a/src/components/smart_objects/test/CObjectSchemaItem_test.cc
+++ b/src/components/smart_objects/test/CObjectSchemaItem_test.cc
@@ -43,7 +43,7 @@
#include "smart_objects/schema_item_parameter.h"
#include "smart_objects/object_schema_item.h"
#include "formatters/generic_json_formatter.h"
-#include "formatters/CSmartFactory.hpp"
+#include "formatters/CSmartFactory.h"
namespace formatters = NsSmartDeviceLink::NsJSONHandler::Formatters;
namespace smartobj = NsSmartDeviceLink::NsSmartObjects;
diff --git a/src/components/smart_objects/test/NumberSchemaItem_test.cc b/src/components/smart_objects/test/NumberSchemaItem_test.cc
index cc56228694..4e52bdf491 100644
--- a/src/components/smart_objects/test/NumberSchemaItem_test.cc
+++ b/src/components/smart_objects/test/NumberSchemaItem_test.cc
@@ -791,7 +791,7 @@ TEST(test_int_double_value, test_NumberSchemaItemTest) {
EXPECT_EQ(Errors::INVALID_VALUE, resultType);
}
-TEST(test_double_int_value, DISABLED_test_NumberSchemaItemTest) {
+TEST(test_double_int_value, test_NumberSchemaItemTest) {
using namespace NsSmartDeviceLink::NsSmartObjects;
ISchemaItemPtr item = TNumberSchemaItem<double>::create(
diff --git a/src/components/time_tester/CMakeLists.txt b/src/components/telemetry_monitor/CMakeLists.txt
index 24f0fa98e3..a70a6e18b7 100644
--- a/src/components/time_tester/CMakeLists.txt
+++ b/src/components/telemetry_monitor/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (c) 2014, Ford Motor Company
+# Copyright (c) 2016, Ford Motor Company
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@@ -29,10 +29,10 @@
# POSSIBILITY OF SUCH DAMAGE.
-set(TIME_TESTER_SRC_DIR ${COMPONENTS_DIR}/time_tester/src)
+set(TELEMETRY_MONITOR_SRC_DIR ${COMPONENTS_DIR}/telemetry_monitor/src)
-include_directories(
- include/time_tester
+include_directories (
+ include
${COMPONENTS_DIR}/utils/include/
${COMPONENTS_DIR}/protocol_handler/include/
${COMPONENTS_DIR}/connection_handler/include/
@@ -50,19 +50,19 @@ include_directories(
)
set(SOURCES
- ${TIME_TESTER_SRC_DIR}/metric_wrapper.cc
- ${TIME_TESTER_SRC_DIR}/time_manager.cc
- ${TIME_TESTER_SRC_DIR}/application_manager_observer.cc
- ${TIME_TESTER_SRC_DIR}/transport_manager_observer.cc
- ${TIME_TESTER_SRC_DIR}/protocol_handler_observer.cc
- ${TIME_TESTER_SRC_DIR}/application_manager_metric.cc
- ${TIME_TESTER_SRC_DIR}/transport_manager_metric.cc
- ${TIME_TESTER_SRC_DIR}/protocol_handler_metric.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/metric_wrapper.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/telemetry_monitor.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/application_manager_observer.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/transport_manager_observer.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/protocol_handler_observer.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/application_manager_metric_wrapper.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/transport_manager_metric_wrapper.cc
+ ${TELEMETRY_MONITOR_SRC_DIR}/protocol_handler_metric_wrapper.cc
)
-add_library("TimeTester" ${SOURCES})
-target_link_libraries("TimeTester" ${LIBRARIES})
-add_dependencies("TimeTester" HMI_API MOBILE_API)
+add_library("TelemetryMonitor" ${SOURCES})
+target_link_libraries("TelemetryMonitor" ${LIBRARIES})
+add_dependencies("TelemetryMonitor" HMI_API MOBILE_API)
if(BUILD_TESTS)
add_subdirectory(test)
diff --git a/src/components/time_tester/include/time_tester/application_manager_metric.h b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h
index 1c21c0f722..df568e7ebd 100644
--- a/src/components/time_tester/include/time_tester/application_manager_metric.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_metric_wrapper.h
@@ -30,27 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_APPLICATION_MANAGER_MECTRIC_WRAPPER_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_APPLICATION_MANAGER_MECTRIC_WRAPPER_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_MECTRIC_WRAPPER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_MECTRIC_WRAPPER_H_
#include <string>
-#include "metric_wrapper.h"
-#include "application_manager_observer.h"
+#include "telemetry_monitor/metric_wrapper.h"
+#include "telemetry_monitor/application_manager_observer.h"
-namespace time_tester {
+namespace telemetry_monitor {
class ApplicationManagerObserver;
class ApplicationManagerMetricWrapper: public MetricWrapper {
public:
- utils::SharedPtr<application_manager::AMMetricObserver::MessageMetric> message_metric;
-
- protected:
+ utils::SharedPtr<application_manager::AMTelemetryObserver::MessageMetric> message_metric;
virtual Json::Value GetJsonMetric();
};
}
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_APPLICATION_MANAGER_MECTRIC_WRAPPER_H_
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_MECTRIC_WRAPPER_H_
diff --git a/src/components/time_tester/include/time_tester/application_manager_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h
index 9c224f8920..4f509075b4 100644
--- a/src/components/time_tester/include/time_tester/application_manager_observer.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/application_manager_observer.h
@@ -30,26 +30,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_APPLICATION_MANAGER_OBSERVER_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_APPLICATION_MANAGER_OBSERVER_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_OBSERVER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_OBSERVER_H_
#include "utils/message_queue.h"
-#include "application_manager/time_metric_observer.h"
-#include "application_manager_metric.h"
+#include "application_manager/telemetry_observer.h"
+#include "telemetry_monitor/application_manager_metric_wrapper.h"
-namespace time_tester {
+namespace telemetry_monitor {
-class TimeManager;
+class TelemetryMonitor;
-class ApplicationManagerObserver: public application_manager::AMMetricObserver {
+class ApplicationManagerObserver: public application_manager::AMTelemetryObserver {
public:
- explicit ApplicationManagerObserver(TimeManager* time_manager);
+ explicit ApplicationManagerObserver(TelemetryMonitor* telemetry_monitor);
virtual void OnMessage(utils::SharedPtr<MessageMetric> metric);
private:
- TimeManager* time_manager_;
+ TelemetryMonitor* telemetry_monitor_;
};
}
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_APPLICATION_MANAGER_OBSERVER_H_
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_APPLICATION_MANAGER_OBSERVER_H_
diff --git a/src/components/time_tester/include/time_tester/json_keys.h b/src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h
index 532202067f..f5aba07721 100644
--- a/src/components/time_tester/include/time_tester/json_keys.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/json_keys.h
@@ -31,10 +31,10 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_JSON_KEYS_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_JSON_KEYS_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_JSON_KEYS_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_JSON_KEYS_H_
-namespace time_tester {
+namespace telemetry_monitor {
namespace strings {
const char logger[] = "logger";
const char begin[] = "begin";
@@ -49,4 +49,4 @@ namespace time_tester {
const char memory[] = "RAM";
}
}
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_JSON_KEYS_H_
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_JSON_KEYS_H_
diff --git a/src/components/time_tester/include/time_tester/metric_wrapper.h b/src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h
index a1867824d4..994065e0e3 100644
--- a/src/components/time_tester/include/time_tester/metric_wrapper.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/metric_wrapper.h
@@ -30,14 +30,14 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_MECTRIC_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_MECTRIC_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_MECTRIC_WRAPPER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_MECTRIC_WRAPPER_H_
#include <string>
#include "utils/resource_usage.h"
#include "json/json.h"
-namespace time_tester {
+namespace telemetry_monitor {
class MetricWrapper {
utils::ResourseUsage* resources;
@@ -48,12 +48,12 @@ class MetricWrapper {
*/
bool grabResources();
virtual std::string GetStyledString();
+ virtual Json::Value GetJsonMetric();
virtual ~MetricWrapper();
protected:
- virtual Json::Value GetJsonMetric();
void Clear();
};
-} // namespace time_tester
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_MECTRIC_H_
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_MECTRIC_WRAPPER_H_
diff --git a/src/components/time_tester/include/time_tester/protocol_handler_metric.h b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h
index 47db117a39..b3485e6942 100644
--- a/src/components/time_tester/include/time_tester/protocol_handler_metric.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_metric_wrapper.h
@@ -30,22 +30,21 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_PROTOCOL_HANDLER_MECTRIC_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_PROTOCOL_HANDLER_MECTRIC_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_MECTRIC_WRAPPER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_MECTRIC_WRAPPER_H_
#include <string>
#include "utils/shared_ptr.h"
-#include "metric_wrapper.h"
+#include "telemetry_monitor/metric_wrapper.h"
#include "protocol_handler_observer.h"
-namespace time_tester {
+namespace telemetry_monitor {
class ProtocolHandlerMecticWrapper: public MetricWrapper {
public:
- utils::SharedPtr<protocol_handler::PHMetricObserver::MessageMetric> message_metric;
- protected:
+ utils::SharedPtr<protocol_handler::PHTelemetryObserver::MessageMetric> message_metric;
virtual Json::Value GetJsonMetric();
};
-} // namespace time_tester
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_PROTOCOL_HANDLER_MECTRIC_H_
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_MECTRIC_WRAPPER_H_
diff --git a/src/components/time_tester/include/time_tester/protocol_handler_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h
index 4c962cfc84..c9f6a7f07f 100644
--- a/src/components/time_tester/include/time_tester/protocol_handler_observer.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/protocol_handler_observer.h
@@ -30,27 +30,27 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_PROTOCOL_HANDLER_OBSERVER_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_PROTOCOL_HANDLER_OBSERVER_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_OBSERVER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_OBSERVER_H_
-#include "protocol_handler/time_metric_observer.h"
+#include "protocol_handler/telemetry_observer.h"
#include "utils/message_queue.h"
-namespace time_tester {
+namespace telemetry_monitor {
-class TimeManager;
+class TelemetryMonitor;
-class ProtocolHandlerObserver: public protocol_handler::PHMetricObserver {
+class ProtocolHandlerObserver: public protocol_handler::PHTelemetryObserver {
public:
- explicit ProtocolHandlerObserver(TimeManager* time_manager);
+ explicit ProtocolHandlerObserver(TelemetryMonitor* telemetry_monitor);
virtual void StartMessageProcess(uint32_t message_id, const TimevalStruct& start_time);
virtual void EndMessageProcess(utils::SharedPtr<MessageMetric> m);
private:
- TimeManager* time_manager_;
+ TelemetryMonitor* telemetry_monitor_;
std::map<uint32_t, TimevalStruct> time_starts;
};
-} // namespace time_tester
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_PROTOCOL_HANDLER_OBSERVER_H_
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_PROTOCOL_HANDLER_OBSERVER_H_
diff --git a/src/components/time_tester/include/time_tester/time_manager.h b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
index dc56d3682c..316f687b46 100644
--- a/src/components/time_tester/include/time_tester/time_manager.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/telemetry_monitor.h
@@ -1,4 +1,4 @@
-/*
+/*
* Copyright (c) 2014, Ford Motor Company
* All rights reserved.
*
@@ -30,61 +30,68 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_MANAGER_INCLUDE_TIME_MANAGER_MEDIA_MANAGER_H_
-#define SRC_COMPONENTS_TIME_MANAGER_INCLUDE_TIME_MANAGER_MEDIA_MANAGER_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_H_
#include <string>
#include "utils/shared_ptr.h"
#include "utils/message_queue.h"
#include "utils/threads/thread.h"
-#include "utils/singleton.h"
#include "utils/threads/thread_delegate.h"
-#include "metric_wrapper.h"
-#include "application_manager_observer.h"
+#include "telemetry_monitor/metric_wrapper.h"
+#include "telemetry_monitor/application_manager_observer.h"
#include "application_manager/application_manager_impl.h"
-#include "transport_manager_observer.h"
+#include "telemetry_monitor/transport_manager_observer.h"
#include "transport_manager/transport_manager_impl.h"
#include "protocol_handler_observer.h"
#include "protocol_handler/protocol_handler_impl.h"
-namespace time_tester {
+namespace telemetry_monitor {
using ::utils::MessageQueue;
-class TimeManager {
+class Streamer : public threads::ThreadDelegate {
public:
- TimeManager();
- ~TimeManager();
- void Init(protocol_handler::ProtocolHandlerImpl* ph);
- void Stop();
- void SendMetric(utils::SharedPtr<MetricWrapper> metric);
+ explicit Streamer(TelemetryMonitor* const server);
+ ~Streamer();
+ void threadMain() OVERRIDE;
+ void exitThreadMain() OVERRIDE;
+
+ virtual void PushMessage(utils::SharedPtr<MetricWrapper> metric);
+ volatile bool is_client_connected_;
private:
+ void Start();
+ void Stop();
+ bool IsReady() const;
+ bool Send(const std::string &msg);
+ void ShutDownAndCloseSocket(int32_t socket_fd);
+ TelemetryMonitor* const kserver_;
+ int32_t server_socket_fd_;
+ int32_t client_socket_fd_;
+ volatile bool stop_flag_;
+ MessageQueue<utils::SharedPtr<MetricWrapper> > messages_;
+ DISALLOW_COPY_AND_ASSIGN(Streamer);
+};
- class Streamer : public threads::ThreadDelegate {
- public:
- explicit Streamer(TimeManager* const server);
- ~Streamer();
- void threadMain() OVERRIDE;
- void exitThreadMain() OVERRIDE;
- bool IsReady() const;
- void Start();
- void Stop();
- bool Send(const std::string &msg);
- void PushMessage(utils::SharedPtr<MetricWrapper> metric);
- volatile bool is_client_connected_;
- private:
- void ShutDownAndCloseSocket(int32_t socket_fd);
- TimeManager* const server_;
- int32_t server_socket_fd_;
- int32_t client_socket_fd_;
- volatile bool stop_flag_;
- MessageQueue<utils::SharedPtr<MetricWrapper> > messages_;
- DISALLOW_COPY_AND_ASSIGN(Streamer);
- };
+class TelemetryMonitor {
+ public:
+ TelemetryMonitor(const std::string& server_address, uint16_t port);
+ virtual ~TelemetryMonitor();
+ virtual void Init(
+ TelemetryObservable<protocol_handler::PHTelemetryObserver>* protocol_handler,
+ TelemetryObservable<application_manager::AMTelemetryObserver>* app_manager,
+ TelemetryObservable<transport_manager::TMTelemetryObserver>* transport_manager);
+ virtual void Stop();
+ virtual void Start();
+ virtual void SendMetric(utils::SharedPtr<MetricWrapper> metric);
+ void set_streamer(Streamer* streamer);
+ const std::string& ip() const;
+ int16_t port() const;
+ private:
+ std::string server_address_;
int16_t port_;
- std::string ip_;
bool is_ready_;
threads::Thread* thread_;
Streamer* streamer_;
@@ -92,7 +99,7 @@ class TimeManager {
TransportManagerObserver tm_observer;
ProtocolHandlerObserver ph_observer;
- DISALLOW_COPY_AND_ASSIGN(TimeManager);
+ DISALLOW_COPY_AND_ASSIGN(TelemetryMonitor);
};
-} // namespace time_manager
-#endif // SRC_COMPONENTS_TIME_MANAGER_INCLUDE_TIME_MANAGER_MEDIA_MANAGER_H_
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_H_
diff --git a/src/components/time_tester/include/time_tester/transport_manager_metric.h b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h
index 25261b007c..8057402f11 100644
--- a/src/components/time_tester/include/time_tester/transport_manager_metric.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_metric_wrapper.h
@@ -30,20 +30,19 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_TRANSPORT_MANAGER_MECTRIC_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_TRANSPORT_MANAGER_MECTRIC_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_MECTRIC_WRAPPER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_MECTRIC_H_
#include <string>
-#include "metric_wrapper.h"
-#include "transport_manager_observer.h"
+#include "telemetry_monitor/metric_wrapper.h"
+#include "telemetry_monitor/transport_manager_observer.h"
-namespace time_tester {
+namespace telemetry_monitor {
class TransportManagerMecticWrapper: public MetricWrapper {
public:
- utils::SharedPtr<transport_manager::TMMetricObserver::MessageMetric> message_metric;
- protected:
- virtual Json::Value GetJsonMetric();
+ utils::SharedPtr<transport_manager::TMTelemetryObserver::MessageMetric> message_metric;
+ virtual Json::Value GetJsonMetric();
};
-} // namespace time_tester
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_TRANSPORT_MANAGER_MECTRIC_H_
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_MECTRIC_WRAPPER_H_
diff --git a/src/components/time_tester/include/time_tester/transport_manager_observer.h b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h
index bd46ba0822..9390ecd209 100644
--- a/src/components/time_tester/include/time_tester/transport_manager_observer.h
+++ b/src/components/telemetry_monitor/include/telemetry_monitor/transport_manager_observer.h
@@ -30,25 +30,25 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_TRANSPORT_MANAGER_OBSERVER_H_
-#define SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_TRANSPORT_MANAGER_OBSERVER_H_
+#ifndef SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_OBSERVER_H_
+#define SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_OBSERVER_H_
-#include "transport_manager/time_metric_observer.h"
+#include "transport_manager/telemetry_observer.h"
#include "utils/message_queue.h"
#include "utils/date_time.h"
-namespace time_tester {
+namespace telemetry_monitor {
-class TimeManager;
+class TelemetryMonitor;
-class TransportManagerObserver: public transport_manager::TMMetricObserver {
+class TransportManagerObserver: public transport_manager::TMTelemetryObserver {
public:
- explicit TransportManagerObserver(TimeManager* time_manager);
+ explicit TransportManagerObserver(TelemetryMonitor* telemetry_monitor);
virtual void StartRawMsg(const protocol_handler::RawMessage* ptr);
virtual void StopRawMsg(const protocol_handler::RawMessage* ptr);
private:
- TimeManager* time_manager_;
+ TelemetryMonitor* telemetry_monitor_;
std::map<const protocol_handler::RawMessage*, TimevalStruct> time_starts;
};
-} // namespace time_tester
-#endif // SRC_COMPONENTS_TIME_TESTER_INCLUDE_TIME_TESTER_TRANSPORT_MANAGER_OBSERVER_H_
+} // namespace telemetry_monitor
+#endif // SRC_COMPONENTS_TELEMETRY_MONITOR_INCLUDE_TELEMETRY_MONITOR_TRANSPORT_MANAGER_OBSERVER_H_
diff --git a/src/components/time_tester/src/application_manager_metric.cc b/src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc
index 251323dc4f..b693d9df22 100644
--- a/src/components/time_tester/src/application_manager_metric.cc
+++ b/src/components/telemetry_monitor/src/application_manager_metric_wrapper.cc
@@ -30,11 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager_metric.h"
-#include "json_keys.h"
+#include "telemetry_monitor/application_manager_metric_wrapper.h"
+#include "telemetry_monitor/json_keys.h"
#include "application_manager/smart_object_keys.h"
+#include "utils/convert_utils.h"
-namespace time_tester {
+namespace telemetry_monitor {
Json::Value ApplicationManagerMetricWrapper::GetJsonMetric() {
Json::Value result = MetricWrapper::GetJsonMetric();
@@ -45,10 +46,10 @@ Json::Value ApplicationManagerMetricWrapper::GetJsonMetric() {
Json::Int64(date_time::DateTime::getuSecs(message_metric->end));
const NsSmartDeviceLink::NsSmartObjects::SmartObject& params =
message_metric->message->getElement(application_manager::strings::params);
- result[strings::correlation_id] =
- params[application_manager::strings::correlation_id].asInt();
- result[strings::connection_key] =
- params[application_manager::strings::connection_key].asInt();
+ result[strings::correlation_id] = utils::ConvertInt64ToLongLongInt(
+ params[application_manager::strings::correlation_id].asInt());
+ result[strings::connection_key] = utils::ConvertInt64ToLongLongInt(
+ params[application_manager::strings::connection_key].asInt());
return result;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
diff --git a/src/components/time_tester/src/application_manager_observer.cc b/src/components/telemetry_monitor/src/application_manager_observer.cc
index c0d87a0551..e3de439b96 100644
--- a/src/components/time_tester/src/application_manager_observer.cc
+++ b/src/components/telemetry_monitor/src/application_manager_observer.cc
@@ -29,21 +29,21 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "application_manager_observer.h"
+#include "telemetry_monitor/application_manager_observer.h"
#include "utils/shared_ptr.h"
-#include "time_manager.h"
-#include "application_manager_metric.h"
+#include "telemetry_monitor/telemetry_monitor.h"
+#include "telemetry_monitor/application_manager_metric_wrapper.h"
-namespace time_tester {
+namespace telemetry_monitor {
-ApplicationManagerObserver::ApplicationManagerObserver(TimeManager* time_manager):
- time_manager_(time_manager) {
+ApplicationManagerObserver::ApplicationManagerObserver(TelemetryMonitor* telemetry_monitor):
+ telemetry_monitor_(telemetry_monitor) {
}
void ApplicationManagerObserver::OnMessage(utils::SharedPtr<MessageMetric> metric) {
ApplicationManagerMetricWrapper* m = new ApplicationManagerMetricWrapper();
m->message_metric = metric;
m->grabResources();
- time_manager_->SendMetric(m);
+ telemetry_monitor_->SendMetric(m);
}
-} // namespace time_tester
+} // namespace telemetry_monitor
diff --git a/src/components/telemetry_monitor/src/metric_wrapper.cc b/src/components/telemetry_monitor/src/metric_wrapper.cc
new file mode 100644
index 0000000000..2803921501
--- /dev/null
+++ b/src/components/telemetry_monitor/src/metric_wrapper.cc
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "telemetry_monitor/metric_wrapper.h"
+#include "telemetry_monitor/json_keys.h"
+
+namespace telemetry_monitor {
+
+ MetricWrapper::MetricWrapper():
+ resources(NULL) {
+ }
+
+bool MetricWrapper::grabResources() {
+ Clear();
+ resources = utils::Resources::getCurrentResourseUsage();
+ if (NULL != resources) {
+ return true;
+ } else {
+ return false;
+ }
+ flush(std::cout);
+}
+
+std::string MetricWrapper::GetStyledString() {
+ return GetJsonMetric().toStyledString();
+}
+
+Json::Value MetricWrapper::GetJsonMetric() {
+ Json::Value result;
+ if (resources) {
+ result[strings::stime] = resources->stime;
+ result[strings::utime] = resources->utime;
+ result[strings::memory] = resources->memory;
+ }
+ return result;
+}
+
+void MetricWrapper::Clear() {
+ if (NULL != resources) {
+ delete resources;
+ resources = NULL;
+ }
+}
+
+MetricWrapper::~MetricWrapper() {
+ Clear();
+}
+
+}
diff --git a/src/components/time_tester/src/protocol_handler_metric.cc b/src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc
index 93e08642f1..335f0dbb29 100644
--- a/src/components/time_tester/src/protocol_handler_metric.cc
+++ b/src/components/telemetry_monitor/src/protocol_handler_metric_wrapper.cc
@@ -30,11 +30,11 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "protocol_handler_metric.h"
+#include "telemetry_monitor/protocol_handler_metric_wrapper.h"
#include "json/json.h"
-#include "json_keys.h"
+#include "telemetry_monitor/json_keys.h"
-namespace time_tester {
+namespace telemetry_monitor {
Json::Value ProtocolHandlerMecticWrapper::GetJsonMetric() {
Json::Value result = MetricWrapper::GetJsonMetric();
@@ -48,4 +48,4 @@ Json::Value ProtocolHandlerMecticWrapper::GetJsonMetric() {
return result;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
diff --git a/src/components/time_tester/src/protocol_handler_observer.cc b/src/components/telemetry_monitor/src/protocol_handler_observer.cc
index 0ad6ec1c0d..69f4564fc1 100644
--- a/src/components/time_tester/src/protocol_handler_observer.cc
+++ b/src/components/telemetry_monitor/src/protocol_handler_observer.cc
@@ -30,17 +30,17 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "protocol_handler_observer.h"
#include "utils/date_time.h"
-#include "protocol_handler_metric.h"
-#include "time_manager.h"
+#include "telemetry_monitor/protocol_handler_observer.h"
+#include "telemetry_monitor/protocol_handler_metric_wrapper.h"
+#include "telemetry_monitor/telemetry_monitor.h"
-namespace time_tester {
+namespace telemetry_monitor {
-CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor")
-ProtocolHandlerObserver::ProtocolHandlerObserver(TimeManager *time_manager):
- time_manager_(time_manager) {
+ProtocolHandlerObserver::ProtocolHandlerObserver(TelemetryMonitor *telemetry_monitor):
+ telemetry_monitor_(telemetry_monitor) {
}
void ProtocolHandlerObserver::StartMessageProcess(uint32_t message_id,
@@ -49,7 +49,8 @@ void ProtocolHandlerObserver::StartMessageProcess(uint32_t message_id,
return;
}
if (time_starts.find(message_id) != time_starts.end()) {
- LOG4CXX_INFO(logger_, "Message ID already wait for stop processing" << message_id);
+ LOG4CXX_DEBUG(logger_, "Already waiting for stop processing for Message ID: "
+ << message_id);
return;
}
time_starts[message_id] = start_time;
@@ -62,11 +63,11 @@ void ProtocolHandlerObserver::EndMessageProcess(utils::SharedPtr<MessageMetric>
LOG4CXX_WARN(logger_, "Cant find start time for message" << message_id);
return;
}
- m->begin= time_starts[message_id];
+ m->begin = time_starts[message_id];
m->end = date_time::DateTime::getCurrentTime();
ProtocolHandlerMecticWrapper* metric = new ProtocolHandlerMecticWrapper();
metric->message_metric = m;
metric->grabResources();
- time_manager_->SendMetric(metric);
+ telemetry_monitor_->SendMetric(metric);
}
-} //namespace time_tester
+} // namespace telemetry_monitor
diff --git a/src/components/time_tester/src/time_manager.cc b/src/components/telemetry_monitor/src/telemetry_monitor.cc
index db389dbda0..7a697cb309 100644
--- a/src/components/time_tester/src/time_manager.cc
+++ b/src/components/telemetry_monitor/src/telemetry_monitor.cc
@@ -30,7 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "time_manager.h"
+#include "telemetry_monitor/telemetry_monitor.h"
#include <sys/socket.h>
#include <sys/types.h>
@@ -39,72 +39,104 @@
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
-#include <string.h>
#include "transport_manager/transport_manager_default.h"
-#include "config_profile/profile.h"
#include "utils/resource_usage.h"
+#include "telemetry_monitor/telemetry_observable.h"
-namespace time_tester {
+namespace telemetry_monitor {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TimeManager")
+CREATE_LOGGERPTR_GLOBAL(logger_, "TelemetryMonitor")
-TimeManager::TimeManager():
+TelemetryMonitor::TelemetryMonitor(const std::string& server_address,
+ uint16_t port):
+ server_address_(server_address),
+ port_(port),
thread_(NULL),
streamer_(NULL),
app_observer(this),
tm_observer(this),
ph_observer(this) {
- ip_ = profile::Profile::instance()->server_address();
- port_ = profile::Profile::instance()->time_testing_port();
- streamer_ = new Streamer(this);
- thread_ = threads::CreateThread("TimeManager", streamer_ );
+
}
-TimeManager::~TimeManager() {
- Stop();
+void TelemetryMonitor::Start() {
+ streamer_ = new Streamer(this);
+ thread_ = threads::CreateThread("TelemetryMonitor", streamer_ );
}
-void TimeManager::Init(protocol_handler::ProtocolHandlerImpl* ph) {
+void TelemetryMonitor::set_streamer(Streamer* streamer) {
LOG4CXX_AUTO_TRACE(logger_);
- DCHECK(ph);
- if (!ph) {
- LOG4CXX_DEBUG(logger_, "ProtocolHandler poiner is NULL");
- return;
+ if (thread_ && !thread_->is_running()) {
+ thread_->set_delegate(streamer);
+ if (streamer_) {
+ delete streamer_;
+ }
+ streamer_ = streamer;
+ } else {
+ LOG4CXX_ERROR(logger_, "Unable to replace streamer if it is active");
}
+}
+
+const std::string& TelemetryMonitor::ip() const {
+ return server_address_;
+}
- application_manager::ApplicationManagerImpl::instance()->SetTimeMetricObserver(&app_observer);
- transport_manager::TransportManagerDefault::instance()->SetTimeMetricObserver(&tm_observer);
- ph->SetTimeMetricObserver(&ph_observer);
+int16_t TelemetryMonitor::port() const {
+ return port_;
+}
+
+TelemetryMonitor::~TelemetryMonitor() {
+ Stop();
+}
+
+void TelemetryMonitor::Init(
+ TelemetryObservable<protocol_handler::PHTelemetryObserver>*
+ protocol_handler,
+ TelemetryObservable<application_manager::AMTelemetryObserver>*
+ app_manager,
+ TelemetryObservable<transport_manager::TMTelemetryObserver>*
+ transport_manager) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK_OR_RETURN_VOID(streamer_);
+
+ app_manager->SetTelemetryObserver(&app_observer);
+ transport_manager->SetTelemetryObserver(&tm_observer);
+ protocol_handler->SetTelemetryObserver(&ph_observer);
+
+ DCHECK_OR_RETURN_VOID(thread_);
thread_->start(threads::ThreadOptions());
}
-void TimeManager::Stop() {
+void TelemetryMonitor::Stop() {
LOG4CXX_AUTO_TRACE(logger_);
- threads::DeleteThread(thread_);
+ if (thread_) {
+ thread_->stop();
+ thread_->join();
+ threads::DeleteThread(thread_);
+ }
thread_ = NULL;
}
-void TimeManager::SendMetric(utils::SharedPtr<MetricWrapper> metric) {
+void TelemetryMonitor::SendMetric(utils::SharedPtr<MetricWrapper> metric) {
if ((NULL != streamer_ )&& streamer_->is_client_connected_) {
streamer_->PushMessage(metric);
}
}
-TimeManager::Streamer::Streamer(
- TimeManager* const server)
+Streamer::Streamer(TelemetryMonitor* const server)
: is_client_connected_(false),
- server_(server),
+ kserver_(server),
server_socket_fd_(0),
client_socket_fd_(0),
stop_flag_(false) {
}
-TimeManager::Streamer::~Streamer() {
+Streamer::~Streamer() {
Stop();
}
-void TimeManager::Streamer::threadMain() {
+void Streamer::threadMain() {
LOG4CXX_AUTO_TRACE(logger_);
Start();
@@ -121,7 +153,10 @@ void TimeManager::Streamer::threadMain() {
is_client_connected_ = true;
while (is_client_connected_) {
while (!messages_.empty()) {
- utils::SharedPtr<MetricWrapper> metric = messages_.pop();
+ utils::SharedPtr<MetricWrapper> metric;
+ if (!messages_.pop(metric)) {
+ continue;
+ }
is_client_connected_ = Send(metric->GetStyledString());
}
@@ -135,18 +170,18 @@ void TimeManager::Streamer::threadMain() {
}
}
-void TimeManager::Streamer::exitThreadMain() {
+void Streamer::exitThreadMain() {
LOG4CXX_AUTO_TRACE(logger_);
Stop();
messages_.Shutdown();
}
-void TimeManager::Streamer::Start() {
+void Streamer::Start() {
LOG4CXX_AUTO_TRACE(logger_);
server_socket_fd_ = socket(AF_INET, SOCK_STREAM, 0);
if (0 >= server_socket_fd_) {
- LOG4CXX_ERROR_EXT(logger_, "Server open error");
+ LOG4CXX_ERROR(logger_, "Server open error");
return;
} else {
LOG4CXX_DEBUG(logger_, "Server socket : " << server_socket_fd_);
@@ -155,20 +190,20 @@ void TimeManager::Streamer::Start() {
int32_t optval = 1;
if (-1 == setsockopt(server_socket_fd_, SOL_SOCKET, SO_REUSEADDR,
&optval, sizeof optval)) {
- LOG4CXX_ERROR_EXT(logger_, "Unable to set sockopt");
+ LOG4CXX_ERROR(logger_, "Unable to set sockopt");
return;
}
sockaddr_in serv_addr_ = { 0 };
- serv_addr_.sin_addr.s_addr = inet_addr(server_->ip_.c_str());
+ serv_addr_.sin_addr.s_addr = inet_addr(kserver_->ip().c_str());
serv_addr_.sin_family = AF_INET;
- serv_addr_.sin_port = htons(server_->port_);
+ serv_addr_.sin_port = htons(kserver_->port());
if (-1 == bind(server_socket_fd_,
reinterpret_cast<struct sockaddr*>(&serv_addr_),
sizeof(serv_addr_))) {
LOG4CXX_ERROR(logger_, "Unable to bind server "
- << server_->ip_.c_str() << ':' << server_->port_);
+ << kserver_->ip().c_str() << ':' << kserver_->port());
return;
}
if (-1 == listen(server_socket_fd_, 1)) {
@@ -177,7 +212,7 @@ void TimeManager::Streamer::Start() {
}
}
-void TimeManager::Streamer::ShutDownAndCloseSocket(int32_t socket_fd) {
+void Streamer::ShutDownAndCloseSocket(int32_t socket_fd) {
LOG4CXX_AUTO_TRACE(logger_);
if (0 < socket_fd){
LOG4CXX_INFO(logger_, "Shutdown socket");
@@ -192,7 +227,7 @@ void TimeManager::Streamer::ShutDownAndCloseSocket(int32_t socket_fd) {
}
}
-void TimeManager::Streamer::Stop() {
+void Streamer::Stop() {
LOG4CXX_AUTO_TRACE(logger_);
if (stop_flag_) {
LOG4CXX_WARN(logger_, "Already Stopped");
@@ -210,7 +245,7 @@ void TimeManager::Streamer::Stop() {
is_client_connected_ = false;
}
-bool TimeManager::Streamer::IsReady() const {
+bool Streamer::IsReady() const {
bool result = true;
fd_set fds;
FD_ZERO(&fds);
@@ -222,32 +257,32 @@ bool TimeManager::Streamer::IsReady() const {
const int retval = select(client_socket_fd_ + 1, 0, &fds, 0, &tv);
if (-1 == retval) {
- LOG4CXX_ERROR_EXT(logger_, "An error occurred");
+ LOG4CXX_ERROR(logger_, "An error occurred");
result = false;
} else if (0 == retval) {
- LOG4CXX_ERROR_EXT(logger_, "The timeout expired");
+ LOG4CXX_ERROR(logger_, "The timeout expired");
result = false;
}
return result;
}
-bool TimeManager::Streamer::Send(const std::string& msg) {
+bool Streamer::Send(const std::string& msg) {
LOG4CXX_AUTO_TRACE(logger_);
if (!IsReady()) {
- LOG4CXX_ERROR_EXT(logger_, " Socket is not ready");
+ LOG4CXX_ERROR(logger_, " Socket is not ready");
return false;
}
if (-1 == ::send(client_socket_fd_, msg.c_str(),
msg.size(), MSG_NOSIGNAL)) {
- LOG4CXX_ERROR_EXT(logger_, " Unable to send");
+ LOG4CXX_ERROR(logger_, " Unable to send");
return false;
}
return true;
}
-void TimeManager::Streamer::PushMessage(utils::SharedPtr<MetricWrapper> metric) {
+void Streamer::PushMessage(utils::SharedPtr<MetricWrapper> metric) {
messages_.push(metric);
}
-} // namespace time_tester
+} // namespace telemetry_monitor
diff --git a/src/components/time_tester/src/transport_manager_metric.cc b/src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc
index a7c9ecb5a2..a891aa1118 100644
--- a/src/components/time_tester/src/transport_manager_metric.cc
+++ b/src/components/telemetry_monitor/src/transport_manager_metric_wrapper.cc
@@ -30,12 +30,12 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "transport_manager_metric.h"
+#include "telemetry_monitor/transport_manager_metric_wrapper.h"
#include "json/json.h"
-#include "json_keys.h"
+#include "telemetry_monitor/json_keys.h"
#include "application_manager/smart_object_keys.h"
-namespace time_tester {
+namespace telemetry_monitor {
Json::Value TransportManagerMecticWrapper::GetJsonMetric() {
Json::Value result = MetricWrapper::GetJsonMetric();
@@ -48,4 +48,4 @@ Json::Value TransportManagerMecticWrapper::GetJsonMetric() {
return result;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
diff --git a/src/components/time_tester/src/transport_manager_observer.cc b/src/components/telemetry_monitor/src/transport_manager_observer.cc
index 6c63a576e7..36f0e3c75a 100644
--- a/src/components/time_tester/src/transport_manager_observer.cc
+++ b/src/components/telemetry_monitor/src/transport_manager_observer.cc
@@ -29,17 +29,17 @@
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include "transport_manager_observer.h"
+#include "telemetry_monitor/transport_manager_observer.h"
#include <time.h>
-#include "transport_manager_metric.h"
-#include "time_manager.h"
+#include "telemetry_monitor/transport_manager_metric_wrapper.h"
+#include "telemetry_monitor/telemetry_monitor.h"
-namespace time_tester {
+namespace telemetry_monitor {
-TransportManagerObserver::TransportManagerObserver(TimeManager* time_manager):
- time_manager_ (time_manager) {
+TransportManagerObserver::TransportManagerObserver(TelemetryMonitor* telemetry_monitor):
+ telemetry_monitor_ (telemetry_monitor) {
}
void TransportManagerObserver::StartRawMsg(const protocol_handler::RawMessage* ptr) {
@@ -51,13 +51,13 @@ void TransportManagerObserver::StopRawMsg(const protocol_handler::RawMessage* pt
it = time_starts.find(ptr);
if (it != time_starts.end()) {
TransportManagerMecticWrapper* m = new TransportManagerMecticWrapper();
- m->message_metric = new transport_manager::TMMetricObserver::MessageMetric();
+ m->message_metric = new transport_manager::TMTelemetryObserver::MessageMetric();
m->message_metric->begin = it->second;
m->message_metric->end = date_time::DateTime::getCurrentTime();
m->message_metric->data_size = ptr->data_size();
m->grabResources();
- time_manager_->SendMetric(m);
+ telemetry_monitor_->SendMetric(m);
}
}
-} //namespace time_tester
+} //namespace telemetry_monitor
diff --git a/src/components/time_tester/test/CMakeLists.txt b/src/components/telemetry_monitor/test/CMakeLists.txt
index 006f6a430f..f574621828 100644
--- a/src/components/time_tester/test/CMakeLists.txt
+++ b/src/components/telemetry_monitor/test/CMakeLists.txt
@@ -30,48 +30,46 @@
if(BUILD_TESTS)
-include_directories (
- ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/include
- ${CMAKE_SOURCE_DIR}/src/3rd_party-static/gmock-1.7.0/gtest/include
- ${COMPONENTS_DIR}/include/utils
- ${COMPONENTS_DIR}/include/protocol_handler
- ${COMPONENTS_DIR}/time_tester/include
+include_directories(
+ include
+ ${GMOCK_INCLUDE_DIRECTORY}
+ ${COMPONENTS_DIR}/telemetry_monitor/include
${COMPONENTS_DIR}/utils/include
${COMPONENTS_DIR}/protocol_handler/include
${COMPONENTS_DIR}/application_manager/include
- ${COMPONENTS_DIR}/protocol_handler/test
- )
+)
set(testSources
- #metric_wrapper_test.cc
- #time_manager_test.cc
- #protocol_handler_metric_test.cc
+ metric_wrapper_test.cc
+ telemetry_monitor_test.cc
+ protocol_handler_metric_test.cc
protocol_handler_observer_test.cc
- #transport_manager_metric_test.cc
+ transport_manager_metric_test.cc
transport_manager_observer_test.cc
- #application_manager_metric_test.cc
+ application_manager_metric_test.cc
application_manager_observer_test.cc
)
set(testLibraries
gmock
- TimeTester
+ TelemetryMonitor
jsoncpp
- Utils
+ Utils
MediaManager
- ProtocolHandler
+ ProtocolHandler
v4_protocol_v1_2_no_extra
- SmartObjects
+ SmartObjects
ProtocolLibrary
ConfigProfile
- connectionHandler
ApplicationManager
+ MessageHelper
Resumption
jsoncpp
transport_manager
MediaManager
- ProtocolHandler
+ ProtocolHandler
+ connectionHandler
)
if (BUILD_USB_SUPPORT)
@@ -82,12 +80,8 @@ if (BUILD_BT_SUPPORT)
list(APPEND testLibraries bluetooth)
endif()
-if (BUILD_AVAHI_SUPPORT)
- list(APPEND testLibraries avahi-client avahi-common)
-endif()
-
file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-create_test("time_tester_test" "${testSources}" "${testLibraries}")
+create_test("telemetry_monitor_test" "${testSources}" "${testLibraries}")
endif()
diff --git a/src/components/time_tester/test/application_manager_metric_test.cc b/src/components/telemetry_monitor/test/application_manager_metric_test.cc
index 7d09cc85c9..08cac32c65 100644
--- a/src/components/time_tester/test/application_manager_metric_test.cc
+++ b/src/components/telemetry_monitor/test/application_manager_metric_test.cc
@@ -31,16 +31,16 @@
*/
#include "gtest/gtest.h"
-#include "json_keys.h"
+#include "telemetry_monitor/json_keys.h"
#include "utils/resource_usage.h"
#include "application_manager/smart_object_keys.h"
-#include "application_manager_metric.h"
+#include "telemetry_monitor/application_manager_metric_wrapper.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace ::time_tester;
+using namespace ::telemetry_monitor;
TEST(ApplicationManagerMetricWrapper, grabResources) {
ApplicationManagerMetricWrapper metric_test;
@@ -57,7 +57,7 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetric) {
TimevalStruct end_time;
end_time.tv_sec = 10;
end_time.tv_usec = 0;
- metric_test.message_metric = new application_manager::AMMetricObserver::MessageMetric();
+ metric_test.message_metric = new application_manager::AMTelemetryObserver::MessageMetric();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
@@ -66,14 +66,14 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetric) {
metric_test.message_metric->message = new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj);
Json::Value jvalue = metric_test.GetJsonMetric();
- EXPECT_EQ("null\n", jvalue[time_tester::strings::stime].toStyledString());
- EXPECT_EQ("null\n", jvalue[time_tester::strings::utime].toStyledString());
- EXPECT_EQ("null\n", jvalue[time_tester::strings::memory].toStyledString());
+ EXPECT_EQ("null\n", jvalue[telemetry_monitor::strings::stime].toStyledString());
+ EXPECT_EQ("null\n", jvalue[telemetry_monitor::strings::utime].toStyledString());
+ EXPECT_EQ("null\n", jvalue[telemetry_monitor::strings::memory].toStyledString());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[time_tester::strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[time_tester::strings::end].asInt64());
- EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(), jvalue[time_tester::strings::correlation_id].asInt64());
- EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(), jvalue[time_tester::strings::connection_key].asInt());
+ EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[telemetry_monitor::strings::begin].asInt64());
+ EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[telemetry_monitor::strings::end].asInt64());
+ EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(), jvalue[telemetry_monitor::strings::correlation_id].asInt64());
+ EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(), jvalue[telemetry_monitor::strings::connection_key].asInt());
}
TEST(ApplicationManagerMetricWrapper, GetJsonMetricWithGrabResources) {
@@ -89,7 +89,7 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetricWithGrabResources) {
end_time.tv_sec = 10;
end_time.tv_usec = 0;
- metric_test.message_metric = new application_manager::AMMetricObserver::MessageMetric();
+ metric_test.message_metric = new application_manager::AMTelemetryObserver::MessageMetric();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
NsSmartDeviceLink::NsSmartObjects::SmartObject obj;
@@ -98,21 +98,21 @@ TEST(ApplicationManagerMetricWrapper, GetJsonMetricWithGrabResources) {
metric_test.message_metric->message = new NsSmartDeviceLink::NsSmartObjects::SmartObject(obj);
Json::Value jvalue = metric_test.GetJsonMetric();
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[time_tester::strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[time_tester::strings::end].asInt64());
- EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(), jvalue[time_tester::strings::correlation_id].asInt64());
- EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(), jvalue[time_tester::strings::connection_key].asInt());
+ EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[telemetry_monitor::strings::begin].asInt64());
+ EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[telemetry_monitor::strings::end].asInt64());
+ EXPECT_EQ(obj["params"][application_manager::strings::correlation_id].asInt(), jvalue[telemetry_monitor::strings::correlation_id].asInt64());
+ EXPECT_EQ(obj["params"][application_manager::strings::connection_key].asInt(), jvalue[telemetry_monitor::strings::connection_key].asInt());
- EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[time_tester::strings::begin].asInt64());
- EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[time_tester::strings::end].asInt64());
+ EXPECT_EQ(date_time::DateTime::getuSecs(start_time), jvalue[telemetry_monitor::strings::begin].asInt64());
+ EXPECT_EQ(date_time::DateTime::getuSecs(end_time), jvalue[telemetry_monitor::strings::end].asInt64());
- EXPECT_NEAR(resources->stime, jvalue[time_tester::strings::stime].asInt(),1);
- EXPECT_NEAR(resources->utime, jvalue[time_tester::strings::utime].asInt(),1);
- EXPECT_EQ(resources->memory, jvalue[time_tester::strings::memory].asInt());
+ EXPECT_NEAR(resources->stime, jvalue[telemetry_monitor::strings::stime].asInt(),1);
+ EXPECT_NEAR(resources->utime, jvalue[telemetry_monitor::strings::utime].asInt(),1);
+ EXPECT_EQ(resources->memory, jvalue[telemetry_monitor::strings::memory].asInt());
delete resources;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
} // namespace components
} // namespace test
diff --git a/src/components/time_tester/test/application_manager_observer_test.cc b/src/components/telemetry_monitor/test/application_manager_observer_test.cc
index f63394e4f2..4925544d09 100644
--- a/src/components/time_tester/test/application_manager_observer_test.cc
+++ b/src/components/telemetry_monitor/test/application_manager_observer_test.cc
@@ -31,29 +31,29 @@
*/
#include "gtest/gtest.h"
-#include "include/time_manager_mock.h"
-#include "application_manager/time_metric_observer.h"
-#include "application_manager_metric.h"
-#include "application_manager_observer.h"
+#include "telemetry_monitor/mock_telemetry_monitor.h"
+#include "application_manager/telemetry_observer.h"
+#include "telemetry_monitor/application_manager_metric_wrapper.h"
+#include "telemetry_monitor/application_manager_observer.h"
#include "utils/shared_ptr.h"
-#include "time_manager.h"
+#include "telemetry_monitor/telemetry_monitor.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace time_tester;
+using namespace telemetry_monitor;
using ::testing::_;
-TEST(ApplicationManagerObserver, DISABLED_CallOnMessage) {
- TimeManagerMock time_manager_mock;
- ApplicationManagerObserver app_observer(&time_manager_mock);
- typedef application_manager::AMMetricObserver::MessageMetric AMMetric;
- utils::SharedPtr<AMMetric> ptr = application_manager::AMMetricObserver::MessageMetricSharedPtr();
- EXPECT_CALL(time_manager_mock, SendMetric(_));
+TEST(ApplicationManagerObserver, CallOnMessage) {
+ MockTelemetryMonitor mock_telemetry_monitor;
+ ApplicationManagerObserver app_observer(&mock_telemetry_monitor);
+ typedef application_manager::AMTelemetryObserver::MessageMetric AMMetric;
+ utils::SharedPtr<AMMetric> ptr = application_manager::AMTelemetryObserver::MessageMetricSharedPtr();
+ EXPECT_CALL(mock_telemetry_monitor, SendMetric(_));
app_observer.OnMessage(ptr);
}
-} // namespace time_tester
+} // namespace telemetry_monitor
} // namespace components
} // namespace test
diff --git a/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h b/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h
new file mode 100644
index 0000000000..2d849a634c
--- /dev/null
+++ b/src/components/telemetry_monitor/test/include/telemetry_monitor/mock_telemetry_monitor.h
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_MOCK_TELEMETRY_MONITOR_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_MOCK_TELEMETRY_MONITOR_H_
+
+#include <string>
+#include "gmock/gmock.h"
+#include "telemetry_monitor/telemetry_monitor.h"
+#include "telemetry_monitor/metric_wrapper.h"
+#include "utils/shared_ptr.h"
+
+namespace test {
+namespace components {
+namespace telemetry_monitor_test {
+
+class MockTelemetryMonitor: public telemetry_monitor::TelemetryMonitor {
+ public:
+ MockTelemetryMonitor():telemetry_monitor::TelemetryMonitor("",0u){}
+ MOCK_METHOD1(Init, void(protocol_handler::ProtocolHandlerImpl* ph));
+ MOCK_METHOD0(Stop, void());
+ MOCK_METHOD0(Start, void());
+ MOCK_METHOD1(SendMetric,
+ void(utils::SharedPtr<telemetry_monitor::MetricWrapper> metric));
+};
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_MOCK_TELEMETRY_MONITOR_H_
diff --git a/src/components/time_tester/test/log4cxx.properties b/src/components/telemetry_monitor/test/log4cxx.properties
index 68adbfa7f3..68adbfa7f3 100644
--- a/src/components/time_tester/test/log4cxx.properties
+++ b/src/components/telemetry_monitor/test/log4cxx.properties
diff --git a/src/components/time_tester/test/metric_wrapper_test.cc b/src/components/telemetry_monitor/test/metric_wrapper_test.cc
index 5eddf0fb62..08b9747742 100644
--- a/src/components/time_tester/test/metric_wrapper_test.cc
+++ b/src/components/telemetry_monitor/test/metric_wrapper_test.cc
@@ -31,16 +31,16 @@
*/
#include "gtest/gtest.h"
-#include "metric_wrapper.h"
-#include "json_keys.h"
+#include "telemetry_monitor/metric_wrapper.h"
+#include "telemetry_monitor/json_keys.h"
#include "json/json.h"
#include "utils/resource_usage.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace ::time_tester;
+using namespace ::telemetry_monitor;
TEST(MetricWrapper, grabResources) {
MetricWrapper metric_test;
@@ -77,6 +77,6 @@ TEST(MetricWrapper, GetJsonMetricWithGrabResources) {
delete resources;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
} // namespace components
} // namespace test
diff --git a/src/components/time_tester/test/protocol_handler_metric_test.cc b/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc
index 150e1205fe..b8114f5511 100644
--- a/src/components/time_tester/test/protocol_handler_metric_test.cc
+++ b/src/components/telemetry_monitor/test/protocol_handler_metric_test.cc
@@ -31,17 +31,17 @@
*/
#include "gtest/gtest.h"
-#include "json_keys.h"
+#include "telemetry_monitor/json_keys.h"
#include "json/json.h"
#include "utils/resource_usage.h"
-#include "protocol_handler_metric.h"
-#include "protocol_handler/time_metric_observer.h"
+#include "telemetry_monitor/protocol_handler_metric_wrapper.h"
+#include "protocol_handler/telemetry_observer.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace ::time_tester;
+using namespace ::telemetry_monitor;
TEST(ProtocolHandlerMetricTest, grabResources) {
ProtocolHandlerMecticWrapper metric_test;
@@ -58,7 +58,7 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetric) {
TimevalStruct end_time;
end_time.tv_sec = 10;
end_time.tv_usec = 0;
- metric_test.message_metric = new protocol_handler::PHMetricObserver::MessageMetric();
+ metric_test.message_metric = new protocol_handler::PHTelemetryObserver::MessageMetric();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
metric_test.message_metric->message_id = 5;
@@ -89,7 +89,7 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetricWithGrabResources) {
TimevalStruct end_time;
end_time.tv_sec = 10;
end_time.tv_usec = 0;
- metric_test.message_metric = new protocol_handler::PHMetricObserver::MessageMetric();
+ metric_test.message_metric = new protocol_handler::PHTelemetryObserver::MessageMetric();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
metric_test.message_metric->message_id = 5;
@@ -114,6 +114,6 @@ TEST(ProtocolHandlerMetricTest, GetJsonMetricWithGrabResources) {
delete resources;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
} // namespace components
} // namespace test
diff --git a/src/components/time_tester/test/protocol_handler_observer_test.cc b/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc
index 8922334aee..784e809da6 100644
--- a/src/components/time_tester/test/protocol_handler_observer_test.cc
+++ b/src/components/telemetry_monitor/test/protocol_handler_observer_test.cc
@@ -31,51 +31,51 @@
*/
#include "gtest/gtest.h"
-#include "time_manager.h"
-#include "include/time_manager_mock.h"
-#include "protocol_handler/time_metric_observer.h"
+#include "telemetry_monitor/telemetry_monitor.h"
+#include "telemetry_monitor/mock_telemetry_monitor.h"
+#include "protocol_handler/telemetry_observer.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace time_tester;
+using namespace telemetry_monitor;
using ::testing::_;
-TEST(ProtocolHandlerObserverTest, DISABLED_MessageProcess) {
- TimeManagerMock time_manager_mock;
+TEST(ProtocolHandlerObserverTest, MessageProcess) {
+ MockTelemetryMonitor mock_telemetry_monitor;
- ProtocolHandlerObserver pr_handler(&time_manager_mock);
+ ProtocolHandlerObserver pr_handler(&mock_telemetry_monitor);
uint32_t message_id = 1;
TimevalStruct start_time;
start_time.tv_sec = 1;
start_time.tv_usec = 0;
pr_handler.StartMessageProcess(message_id, start_time);
- typedef protocol_handler::PHMetricObserver::MessageMetric MetricType;
+ typedef protocol_handler::PHTelemetryObserver::MessageMetric MetricType;
utils::SharedPtr<MetricType> message_metric = new MetricType();
message_metric->message_id = 1;
- EXPECT_CALL(time_manager_mock, SendMetric(_));
+ EXPECT_CALL(mock_telemetry_monitor, SendMetric(_));
pr_handler.EndMessageProcess(message_metric);
}
TEST(ProtocolHandlerObserverTest, MessageProcessWithZeroMessageId) {
- TimeManagerMock time_manager_mock;
+ MockTelemetryMonitor mock_telemetry_monitor;
- ProtocolHandlerObserver pr_handler(&time_manager_mock);
+ ProtocolHandlerObserver pr_handler(&mock_telemetry_monitor);
uint32_t message_id = 0;
TimevalStruct start_time;
start_time.tv_sec = 1;
start_time.tv_usec = 0;
pr_handler.StartMessageProcess(message_id, start_time);
- typedef protocol_handler::PHMetricObserver::MessageMetric MetricType;
+ typedef protocol_handler::PHTelemetryObserver::MessageMetric MetricType;
utils::SharedPtr<MetricType> message_metric = new MetricType();
message_metric->message_id = 0;
- EXPECT_CALL(time_manager_mock, SendMetric(_)).Times(0);
+ EXPECT_CALL(mock_telemetry_monitor, SendMetric(_)).Times(0);
pr_handler.EndMessageProcess(message_metric);
}
-} // namespace time_tester
+} // namespace telemetry_monitor_test
} // namespace components
} // namespace test
diff --git a/src/components/telemetry_monitor/test/telemetry_monitor_test.cc b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
new file mode 100644
index 0000000000..14c7fe4cd5
--- /dev/null
+++ b/src/components/telemetry_monitor/test/telemetry_monitor_test.cc
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include "telemetry_monitor/telemetry_monitor.h"
+#include "protocol_handler/telemetry_observer.h"
+#include "protocol_handler/protocol_handler.h"
+#include "protocol_handler//mock_protocol_handler.h"
+#include "protocol_handler/mock_session_observer.h"
+#include "protocol_handler/mock_protocol_handler_settings.h"
+#include "connection_handler/mock_connection_handler.h"
+#include "transport_manager/transport_manager_mock.h"
+#include "telemetry_monitor/mock_telemetry_observable.h"
+
+
+using testing::Return;
+using testing::_;
+
+namespace test {
+namespace components {
+namespace telemetry_monitor_test {
+
+using namespace telemetry_monitor;
+
+class StreamerMock : public Streamer {
+ public:
+ StreamerMock(TelemetryMonitor* const server)
+ : Streamer(server) {
+ is_client_connected_ = true;
+ }
+ MOCK_METHOD1(PushMessage,void(utils::SharedPtr<MetricWrapper> metric));
+};
+
+TEST(TelemetryMonitorTest, MessageProcess) {
+ const std::string& server_address = "server_address";
+ const uint16_t port = 12345;
+ MockTelemetryObservable am_observeble;
+
+ transport_manager_test::MockTransportManager transport_manager_mock;
+ testing::NiceMock<connection_handler_test::MockConnectionHandler>
+ connection_handler_mock;
+ testing::NiceMock<
+ ::test::components::protocol_handler_test::MockProtocolHandlerSettings>
+ protocol_handler_settings_mock;
+ ::test::components::protocol_handler_test::MockSessionObserver
+ session_observer_mock;
+
+ const size_t init_value = 1000u;
+ ON_CALL(protocol_handler_settings_mock, maximum_payload_size())
+ .WillByDefault(Return(init_value));
+ ON_CALL(protocol_handler_settings_mock, message_frequency_time())
+ .WillByDefault(Return(init_value));
+ ON_CALL(protocol_handler_settings_mock, malformed_message_filtering())
+ .WillByDefault(Return(init_value));
+ ON_CALL(protocol_handler_settings_mock, multiframe_waiting_timeout())
+ .WillByDefault(Return(init_value));
+ protocol_handler::ProtocolHandlerImpl protocol_handler_mock(
+ protocol_handler_settings_mock, session_observer_mock,
+ connection_handler_mock, transport_manager_mock);
+
+ EXPECT_CALL(am_observeble, SetTelemetryObserver(_));
+ EXPECT_CALL(transport_manager_mock, SetTelemetryObserver(_));
+ telemetry_monitor::TelemetryMonitor telemetry_monitor(server_address, port);
+ StreamerMock streamer_mock(&telemetry_monitor);
+ telemetry_monitor.Start();
+
+ telemetry_monitor.set_streamer(&streamer_mock);
+ telemetry_monitor.Init(&protocol_handler_mock, &am_observeble,
+ &transport_manager_mock);
+ utils::SharedPtr<telemetry_monitor::MetricWrapper> test_metric;
+ EXPECT_CALL(streamer_mock, PushMessage(test_metric));
+ telemetry_monitor.SendMetric(test_metric);
+}
+
+} // namespace telemetry_monitor
+} // namespace components
+} // namespace test
diff --git a/src/components/time_tester/test/transport_manager_metric_test.cc b/src/components/telemetry_monitor/test/transport_manager_metric_test.cc
index 2bb09416ed..1219a9b1ab 100644
--- a/src/components/time_tester/test/transport_manager_metric_test.cc
+++ b/src/components/telemetry_monitor/test/transport_manager_metric_test.cc
@@ -31,17 +31,17 @@
*/
#include "gtest/gtest.h"
-#include "json_keys.h"
+#include "telemetry_monitor/json_keys.h"
#include "json/json.h"
#include "utils/resource_usage.h"
-#include "transport_manager_metric.h"
-#include "protocol_handler/time_metric_observer.h"
+#include "telemetry_monitor/transport_manager_metric_wrapper.h"
+#include "protocol_handler/telemetry_observer.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace ::time_tester;
+using namespace ::telemetry_monitor;
TEST(TransportManagerMetricWrapper, grabResources) {
TransportManagerMecticWrapper metric_test;
@@ -58,7 +58,7 @@ TEST(TransportManagerMetricWrapper, GetJsonMetric) {
TimevalStruct end_time;
end_time.tv_sec = 10;
end_time.tv_usec = 0;
- metric_test.message_metric = new transport_manager::TMMetricObserver::MessageMetric();
+ metric_test.message_metric = new transport_manager::TMTelemetryObserver::MessageMetric();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
metric_test.message_metric->data_size = 1000;
@@ -86,7 +86,7 @@ TEST(TransportManagerMetricWrapper, GetJsonMetricWithGrabResources) {
TimevalStruct end_time;
end_time.tv_sec = 10;
end_time.tv_usec = 0;
- metric_test.message_metric = new transport_manager::TMMetricObserver::MessageMetric();
+ metric_test.message_metric = new transport_manager::TMTelemetryObserver::MessageMetric();
metric_test.message_metric->begin = start_time;
metric_test.message_metric->end = end_time;
@@ -105,6 +105,6 @@ TEST(TransportManagerMetricWrapper, GetJsonMetricWithGrabResources) {
delete resources;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
} // namespace components
} // namespace test
diff --git a/src/components/time_tester/test/transport_manager_observer_test.cc b/src/components/telemetry_monitor/test/transport_manager_observer_test.cc
index 9dcf27bd97..71de55e47a 100644
--- a/src/components/time_tester/test/transport_manager_observer_test.cc
+++ b/src/components/telemetry_monitor/test/transport_manager_observer_test.cc
@@ -31,28 +31,28 @@
*/
#include "gtest/gtest.h"
-#include "include/time_manager_mock.h"
-#include "protocol_handler/time_metric_observer.h"
-#include "transport_manager_metric.h"
-#include "transport_manager_observer.h"
+#include "telemetry_monitor/mock_telemetry_monitor.h"
+#include "protocol_handler/telemetry_observer.h"
+#include "telemetry_monitor/transport_manager_metric_wrapper.h"
+#include "telemetry_monitor/transport_manager_observer.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace telemetry_monitor_test {
-using namespace time_tester;
+using namespace telemetry_monitor;
using ::testing::_;
-TEST(TransportManagerObserverTest, DISABLED_MessageProcess) {
- TimeManagerMock time_manager_mock;
- TransportManagerObserver tr_observer(&time_manager_mock);
+TEST(TransportManagerObserverTest, MessageProcess) {
+ MockTelemetryMonitor mock_telemetry_monitor;
+ TransportManagerObserver tr_observer(&mock_telemetry_monitor);
protocol_handler::RawMessage* ptr = new ::protocol_handler::RawMessage(0, 0, NULL, 0);
tr_observer.StartRawMsg(ptr);
- EXPECT_CALL(time_manager_mock, SendMetric(_));
+ EXPECT_CALL(mock_telemetry_monitor, SendMetric(_));
tr_observer.StopRawMsg(ptr);
delete ptr;
}
-} // namespace time_tester
+} // namespace telemetry_monitor
} // namespace components
} // namespace test
diff --git a/src/components/test_main.cc b/src/components/test_main.cc
index a0aee7614d..66013d78c4 100755..100644
--- a/src/components/test_main.cc
+++ b/src/components/test_main.cc
@@ -1,10 +1,12 @@
#include "gmock/gmock.h"
#include "utils/logger.h"
-
+#include "utils/custom_string.h"
+namespace custom_str = utils::custom_string;
int main(int argc, char** argv) {
- testing::InitGoogleMock(&argc, argv);
- const int result = RUN_ALL_TESTS();
- DEINIT_LOGGER();
- return result;
+ testing::InitGoogleMock(&argc, argv);
+ ::testing::DefaultValue<custom_str::CustomString>::Set(
+ custom_str::CustomString(""));
+ const int result = RUN_ALL_TESTS();
+ DEINIT_LOGGER();
+ return result;
}
-
diff --git a/src/components/time_tester/src/metric_wrapper.cc b/src/components/time_tester/src/metric_wrapper.cc
deleted file mode 100644
index 2922bf35cb..0000000000
--- a/src/components/time_tester/src/metric_wrapper.cc
+++ /dev/null
@@ -1,46 +0,0 @@
-#include "metric_wrapper.h"
-#include "json_keys.h"
-
-namespace time_tester {
-
- MetricWrapper::MetricWrapper():
- resources(NULL) {
- }
-
-bool MetricWrapper::grabResources() {
- Clear();
- resources = utils::Resources::getCurrentResourseUsage();
- if (NULL != resources) {
- return true;
- } else {
- return false;
- }
- flush(std::cout);
-}
-
-std::string MetricWrapper::GetStyledString() {
- return GetJsonMetric().toStyledString();
-}
-
-Json::Value MetricWrapper::GetJsonMetric() {
- Json::Value result;
- if (resources) {
- result[strings::stime] = resources->stime;
- result[strings::utime] = resources->utime;
- result[strings::memory] = resources->memory;
- }
- return result;
-}
-
-void MetricWrapper::Clear() {
- if (NULL != resources) {
- delete resources;
- resources = NULL;
- }
-}
-
-MetricWrapper::~MetricWrapper() {
- Clear();
-}
-
-}
diff --git a/src/components/transport_manager/CMakeLists.txt b/src/components/transport_manager/CMakeLists.txt
index 764f1cdafa..fbe6018d6a 100644
--- a/src/components/transport_manager/CMakeLists.txt
+++ b/src/components/transport_manager/CMakeLists.txt
@@ -60,11 +60,6 @@ set (SOURCES
${TM_SRC_DIR}/tcp/tcp_connection_factory.cc
)
-if (BUILD_AVAHI_SUPPORT)
- list (APPEND SOURCES
- ${TM_SRC_DIR}/tcp/dnssd_service_browser.cc
- )
-endif()
if (BUILD_BT_SUPPORT)
list (APPEND SOURCES
${TM_SRC_DIR}/bluetooth/bluetooth_device_scanner.cc
@@ -109,11 +104,6 @@ if (BUILD_USB_SUPPORT)
endif()
endif(BUILD_USB_SUPPORT)
-
-if (BUILD_AVAHI_SUPPORT)
- target_link_libraries(${target} avahi-common)
-endif()
-
if(ENABLE_LOG)
target_link_libraries(${target} log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
endif()
diff --git a/src/components/transport_manager/include/transport_manager/tcp/dnssd_service_browser.h b/src/components/transport_manager/include/transport_manager/tcp/dnssd_service_browser.h
deleted file mode 100644
index 079494d035..0000000000
--- a/src/components/transport_manager/include/transport_manager/tcp/dnssd_service_browser.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * \file dnssd_service_browser.h
- * \brief DnssdServiceBrowser class header file.
- *
- * 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_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_DNSSD_SERVICE_BROWSER_H_
-#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_DNSSD_SERVICE_BROWSER_H_
-
-#include <avahi-client/client.h>
-#include <avahi-client/lookup.h>
-#include <avahi-common/error.h>
-#include <avahi-common/thread-watch.h>
-
-#include <string>
-#include <vector>
-
-#include "utils/lock.h"
-#include "transport_manager/transport_adapter/device_scanner.h"
-#include "transport_manager/transport_adapter/transport_adapter.h"
-
-namespace transport_manager {
-
-namespace transport_adapter {
-
-struct DnssdServiceRecord {
- AvahiIfIndex interface;
- AvahiProtocol protocol;
- std::string domain_name;
- std::string host_name;
- std::string name;
- std::string type;
- uint16_t port;
- uint32_t addr;
-};
-
-#define DNSSD_DEFAULT_SERVICE_TYPE "_ford-sdlapp._tcp"
-
-/**
- * @brief DNS service discovery class.
- */
-class DnssdServiceBrowser : public DeviceScanner {
- public:
- /**
- * @brief Constructor.
- *
- * @param controller Pointer to the device adapter controller.
- */
- explicit DnssdServiceBrowser(class TransportAdapterController* controller);
- virtual ~DnssdServiceBrowser();
-
- protected:
- virtual TransportAdapter::Error Init();
- virtual TransportAdapter::Error Scan();
- virtual void Terminate();
- virtual bool IsInitialised() const;
-
- private:
- TransportAdapter::Error CreateAvahiClientAndBrowser();
- void AddService(AvahiIfIndex interface, AvahiProtocol protocol,
- const char *name, const char *type, const char *domain);
- void RemoveService(AvahiIfIndex interface, AvahiProtocol protocol,
- const char *name, const char *type, const char *domain);
-
- void OnClientConnected();
- void OnClientFailure();
-
- DeviceVector PrepareDeviceVector() const;
-
- void ServiceResolved(const DnssdServiceRecord& service_record);
- void ServiceResolveFailed(const DnssdServiceRecord& service_record);
-
- friend void AvahiClientCallback(AvahiClient *avahi_client,
- AvahiClientState avahi_client_state,
- void* data);
- friend void AvahiServiceBrowserCallback(
- AvahiServiceBrowser *avahi_service_browser, AvahiIfIndex interface,
- AvahiProtocol protocol, AvahiBrowserEvent event, const char *name,
- const char *type, const char *domain, AvahiLookupResultFlags flags,
- void* data);
-
- friend void AvahiServiceResolverCallback(
- AvahiServiceResolver* avahi_service_resolver, AvahiIfIndex interface,
- AvahiProtocol protocol, AvahiResolverEvent event, const char* name,
- const char* type, const char* domain, const char* host_name,
- const AvahiAddress* avahi_address, uint16_t port, AvahiStringList* txt,
- AvahiLookupResultFlags flags, void *data);
-
- TransportAdapterController* controller_;
-
- AvahiServiceBrowser* avahi_service_browser_;
- AvahiThreadedPoll* avahi_threaded_poll_;
- AvahiClient* avahi_client_;
-
- typedef std::vector<DnssdServiceRecord> ServiceRecords;
- ServiceRecords service_records_;
-
- sync_primitives::Lock mutex_;
-
- bool initialised_;
-};
-
-} // namespace transport_adapter
-} // namespace transport_manager
-
-#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TCP_DNSSD_SERVICE_BROWSER_H_
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h
index d5a24f07eb..620efff2b1 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_client_listener.h
@@ -99,6 +99,20 @@ class TcpClientListener : public ClientConnectionListener {
*/
virtual TransportAdapter::Error StopListening();
+#ifdef BUILD_TESTS
+ uint16_t port() const {
+ return port_;
+ }
+
+ int get_socket() const {
+ return socket_;
+ }
+
+ threads::Thread* thread() const {
+ return thread_;
+ }
+#endif // BUILD_TESTS
+
private:
const uint16_t port_;
const bool enable_keepalive_;
diff --git a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
index 45bcc405d7..981ba9f6ee 100644
--- a/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
+++ b/src/components/transport_manager/include/transport_manager/tcp/tcp_device.h
@@ -121,7 +121,7 @@ class TcpDevice : public Device {
*
* @return Application's port No.
*/
- int GetApplicationPort(const ApplicationHandle app_handle) const;
+ virtual int GetApplicationPort(const ApplicationHandle app_handle) const;
/**
* @brief Return address.
diff --git a/src/components/transport_manager/include/transport_manager/time_metric_observer.h b/src/components/transport_manager/include/transport_manager/telemetry_observer.h
index ce59a9b4c4..8fe98a1553 100644
--- a/src/components/transport_manager/include/transport_manager/time_metric_observer.h
+++ b/src/components/transport_manager/include/transport_manager/telemetry_observer.h
@@ -39,7 +39,7 @@
namespace transport_manager {
-class TMMetricObserver {
+class TMTelemetryObserver {
public:
struct MessageMetric {
TimevalStruct begin;
@@ -49,7 +49,7 @@ class TMMetricObserver {
virtual void StartRawMsg(const protocol_handler::RawMessage* ptr) = 0;
virtual void StopRawMsg(const protocol_handler::RawMessage* ptr) = 0;
- virtual ~TMMetricObserver(){}
+ virtual ~TMTelemetryObserver(){}
};
} // transport_manager
#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TIME_METRIC_OBSERVER_H_
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
index 5306a7af5a..0cf28f7a16 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_impl.h
@@ -41,13 +41,14 @@
#include "utils/lock.h"
#include "utils/rwlock.h"
+
#include "transport_manager/transport_adapter/transport_adapter.h"
#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/transport_adapter/connection.h"
-#ifdef TIME_TESTER
-#include "transport_manager/time_metric_observer.h"
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+#include "transport_manager/telemetry_observer.h"
+#endif // TELEMETRY_MONITOR
namespace transport_manager {
@@ -397,21 +398,21 @@ class TransportAdapterImpl : public TransportAdapter,
*/
virtual std::string GetConnectionType() const;
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
/**
* @brief Setup observer for time metric.
*
* @param observer - pointer to observer
*/
- void SetTimeMetricObserver(TMMetricObserver* observer);
+ void SetTelemetryObserver(TMTelemetryObserver* observer);
/**
* @brief Return Time metric observer
*
* @param return pointer to Time metric observer
*/
- virtual TMMetricObserver* GetTimeMetricObserver();
-#endif // TIME_TESTER
+ virtual TMTelemetryObserver* GetTelemetryObserver();
+#endif // TELEMETRY_MONITOR
protected:
/**
@@ -446,7 +447,7 @@ class TransportAdapterImpl : public TransportAdapter,
*
* @return pointer to the connection.
*/
- ConnectionSPtr FindEstablishedConnection(const DeviceUID& device_handle,
+ virtual ConnectionSPtr FindEstablishedConnection(const DeviceUID& device_handle,
const ApplicationHandle& app_handle) const;
private:
@@ -528,12 +529,12 @@ class TransportAdapterImpl : public TransportAdapter,
mutable sync_primitives::RWLock connections_lock_;
protected:
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
/**
* @brief Pointer to time metric observer
*/
- TMMetricObserver* metric_observer_;
-#endif // TIME_TESTER
+ TMTelemetryObserver* metric_observer_;
+#endif // TELEMETRY_MONITOR
/**
* @brief Pointer to the device scanner.
diff --git a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
index 87d71ea56f..2a2d6dc401 100644
--- a/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_adapter/transport_adapter_listener_impl.h
@@ -36,13 +36,12 @@
#include "transport_manager/common.h"
#include "transport_manager/transport_adapter/transport_adapter_listener.h"
#include "transport_manager/transport_adapter/transport_adapter.h"
+#include "transport_manager/transport_manager.h"
namespace transport_manager {
using transport_manager::transport_adapter::TransportAdapter;
-class TransportManagerImpl;
-
/**
* @brief Implementation of TransportAdapterListener class.
*/
@@ -72,10 +71,10 @@ class TransportAdapterListenerImpl
/**
* @brief Constructor.
*
- * @param manager Pointer to the transport manager implementation class.
+ * @param manager Pointer to the transport manager class.
* @param adapter Pointer to the transport adapter associated with listener.
*/
- TransportAdapterListenerImpl(TransportManagerImpl* manager,
+ TransportAdapterListenerImpl(TransportManager* manager,
TransportAdapter* adapter);
/**
@@ -100,7 +99,7 @@ class TransportAdapterListenerImpl
const SearchDeviceError& error);
/**
- * @brief Passes notification to TransportManagerImpl
+ * @brief Passes notification to TransportManager
*
* @param adapter Transport adapter that sent notification
*/
@@ -284,7 +283,7 @@ class TransportAdapterListenerImpl
const ApplicationHandle& app_id);
private:
- TransportManagerImpl* transport_manager_impl_;
+ TransportManager* transport_manager_;
TransportAdapter* transport_adapter_;
};
} // namespace transport_manager
diff --git a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
index 4c38716f3f..7d0e2b177d 100644
--- a/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
+++ b/src/components/transport_manager/include/transport_manager/transport_manager_impl.h
@@ -36,28 +36,44 @@
#include <queue>
#include <map>
#include <list>
+#include <vector>
+#include <utility>
#include <algorithm>
-#include "utils/timer_thread.h"
+#include "utils/timer.h"
+#include "utils/timer_task_impl.h"
+#include "utils/rwlock.h"
#include "transport_manager/transport_manager.h"
#include "transport_manager/transport_manager_listener.h"
#include "transport_manager/transport_adapter/transport_adapter_listener_impl.h"
#include "protocol/common.h"
-#ifdef TIME_TESTER
-#include "transport_manager/time_metric_observer.h"
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+#include "transport_manager/telemetry_observer.h"
+#endif // TELEMETRY_MONITOR
#include "utils/threads/message_loop_thread.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
+#include "telemetry_monitor/telemetry_observable.h"
namespace transport_manager {
+typedef threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> >
+ RawMessageLoopThread;
+typedef threads::MessageLoopThread<std::queue<TransportAdapterEvent> >
+ TransportAdapterEventLoopThread;
+typedef utils::SharedPtr<timer::Timer> TimerSPtr;
+
/**
* @brief Implementation of transport manager.s
*/
-class TransportManagerImpl : public TransportManager,
- public threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> >::Handler,
- public threads::MessageLoopThread<std::queue<TransportAdapterEvent> >::Handler {
+class TransportManagerImpl
+ : public TransportManager,
+ public RawMessageLoopThread::Handler
+#ifdef TELEMETRY_MONITOR
+ ,
+ public telemetry_monitor::TelemetryObservable<TMTelemetryObserver>
+#endif // TELEMETRY_MONITOR
+ , public TransportAdapterEventLoopThread::Handler {
public:
struct Connection {
ConnectionUID id;
@@ -72,22 +88,21 @@ class TransportManagerImpl : public TransportManager,
struct ConnectionInternal: public Connection {
TransportManagerImpl* transport_manager;
TransportAdapter* transport_adapter;
- typedef timer::TimerThread<ConnectionInternal> TimerInternal;
- typedef utils::SharedPtr<TimerInternal> TimerInternalSharedPointer;
- TimerInternalSharedPointer timer;
- bool shutDown;
+ TimerSPtr timer;
+ bool shut_down;
DeviceHandle device_handle_;
int messages_count;
ConnectionInternal(TransportManagerImpl* transport_manager,
TransportAdapter* transport_adapter,
- const ConnectionUID& id, const DeviceUID& dev_id,
+ const ConnectionUID id,
+ const DeviceUID& dev_id,
const ApplicationHandle& app_id,
- const DeviceHandle& device_handle);
+ const DeviceHandle device_handle);
+
void DisconnectFailedRoutine();
};
public:
-
/**
* @brief Destructor.
**/
@@ -98,20 +113,20 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
*/
- virtual int Init();
+ int Init() OVERRIDE;
/**
* Reinitializes transport manager
* @return Error code
*/
- virtual int Reinit();
+ int Reinit() OVERRIDE;
/**
* @brief Start scanning for new devices.
*
* @return Code error.
**/
- virtual int SearchDevices();
+ int SearchDevices() OVERRIDE;
/**
* @brief Connect to all applications discovered on device.
@@ -120,7 +135,7 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int ConnectDevice(const DeviceHandle& device_id);
+ int ConnectDevice(const DeviceHandle device_id) OVERRIDE;
/**
* @brief Disconnect from all applications connected on device.
@@ -129,7 +144,7 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int DisconnectDevice(const DeviceHandle& device_id);
+ int DisconnectDevice(const DeviceHandle device_id) OVERRIDE;
/**
* @brief Disconnect from applications connected on device by connection
@@ -139,14 +154,14 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int Disconnect(const ConnectionUID& connection_id);
+ int Disconnect(const ConnectionUID connection_id) OVERRIDE;
/**
* @brief Disconnect and clear all unreceived data.
*
* @param connection Connection unique identifier.
*/
- virtual int DisconnectForce(const ConnectionUID& connection_id);
+ int DisconnectForce(const ConnectionUID connection_id) OVERRIDE;
/**
* @brief Post new message in queue for massages destined to device.
*
@@ -154,7 +169,7 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int SendMessageToDevice(const protocol_handler::RawMessagePtr message);
+ int SendMessageToDevice(const protocol_handler::RawMessagePtr message) OVERRIDE;
/**
* @brief Post event in the event queue.
@@ -163,7 +178,7 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int ReceiveEventFromDevice(const TransportAdapterEvent& event);
+ int ReceiveEventFromDevice(const TransportAdapterEvent& event) OVERRIDE;
/**
* @brief Post listener to the container of transport manager listeners.
@@ -172,9 +187,9 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int AddEventListener(TransportManagerListener* listener);
+ int AddEventListener(TransportManagerListener* listener) OVERRIDE;
- virtual int Stop();
+ int Stop() OVERRIDE;
/**
* @brief Add device adapter to the container of device adapters.
@@ -183,8 +198,8 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int AddTransportAdapter(
- transport_adapter::TransportAdapter* transport_adapter);
+ int AddTransportAdapter(
+ transport_adapter::TransportAdapter* transport_adapter) OVERRIDE;
/**
* @brief Remove device from the container that hold devices.
@@ -193,7 +208,7 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
**/
- virtual int RemoveDevice(const DeviceHandle& device);
+ int RemoveDevice(const DeviceHandle device) OVERRIDE;
/**
* @brief Turns on or off visibility of SDL to mobile devices
@@ -202,7 +217,7 @@ class TransportManagerImpl : public TransportManager,
*
* @return Code error.
*/
- virtual int Visibility(const bool& on_off) const;
+ int Visibility(const bool& on_off) const OVERRIDE;
/**
* @brief Updates total device list with info from specific transport adapter.
@@ -210,14 +225,14 @@ class TransportManagerImpl : public TransportManager,
*/
void UpdateDeviceList(TransportAdapter* ta);
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
/**
* @brief Setup observer for time metric.
*
* @param observer - pointer to observer
*/
- void SetTimeMetricObserver(TMMetricObserver* observer);
-#endif // TIME_TESTER
+ void SetTelemetryObserver(TMTelemetryObserver* observer);
+#endif // TELEMETRY_MONITOR
/**
@@ -226,7 +241,6 @@ class TransportManagerImpl : public TransportManager,
TransportManagerImpl();
protected:
-
template <class Proc, class... Args>
void RaiseEvent(Proc proc, Args... args) {
for (TransportManagerListenerList::iterator it =
@@ -264,9 +278,9 @@ class TransportManagerImpl : public TransportManager,
*/
bool is_initialized_;
-#ifdef TIME_TESTER
- TMMetricObserver* metric_observer_;
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+ TMTelemetryObserver* metric_observer_;
+#endif // TELEMETRY_MONITOR
private:
/**
@@ -282,6 +296,8 @@ class TransportManagerImpl : public TransportManager,
}
DeviceHandle UidToHandle(const DeviceUID& dev_uid, bool& is_new) {
+ {
+ sync_primitives::AutoReadLock lock(conversion_table_lock);
ConversionTable::iterator it = std::find(
conversion_table_.begin(), conversion_table_.end(), dev_uid);
if (it != conversion_table_.end()) {
@@ -289,12 +305,15 @@ class TransportManagerImpl : public TransportManager,
return std::distance(conversion_table_.begin(), it) +
1; // handle begin since 1 (one)
}
+ }
is_new = true;
+ sync_primitives::AutoWriteLock lock(conversion_table_lock);
conversion_table_.push_back(dev_uid);
return conversion_table_.size(); // handle begin since 1 (one)
}
DeviceUID HandleToUid(DeviceHandle handle) {
+ sync_primitives::AutoReadLock lock(conversion_table_lock);
if (handle == 0 || handle > conversion_table_.size()) {
return DeviceUID();
}
@@ -302,6 +321,7 @@ class TransportManagerImpl : public TransportManager,
}
ConversionTable conversion_table_;
+ sync_primitives::RWLock conversion_table_lock;
};
/**
@@ -312,22 +332,26 @@ class TransportManagerImpl : public TransportManager,
explicit TransportManagerImpl(const TransportManagerImpl&);
int connection_id_counter_;
+ sync_primitives::RWLock connections_lock_;
std::vector<ConnectionInternal> connections_;
- std::map<DeviceUID, TransportAdapter*> device_to_adapter_map_;
+ sync_primitives::RWLock device_to_adapter_map_lock_;
+ typedef std::map<DeviceUID, TransportAdapter*> DeviceToAdapterMap;
+ DeviceToAdapterMap device_to_adapter_map_;
std::vector<TransportAdapter*> transport_adapters_;
/** For keep listeners which were add TMImpl */
std::map<TransportAdapter*, TransportAdapterListenerImpl*>
transport_adapter_listeners_;
- threads::MessageLoopThread<std::queue<protocol_handler::RawMessagePtr> > message_queue_;
- threads::MessageLoopThread<std::queue<TransportAdapterEvent> > event_queue_;
+ RawMessageLoopThread message_queue_;
+ TransportAdapterEventLoopThread event_queue_;
typedef std::vector<std::pair<const TransportAdapter*, DeviceInfo> >
DeviceInfoList;
+ sync_primitives::RWLock device_list_lock_;
DeviceInfoList device_list_;
void AddConnection(const ConnectionInternal& c);
void RemoveConnection(uint32_t id);
- ConnectionInternal* GetConnection(const ConnectionUID& id);
+ ConnectionInternal* GetConnection(const ConnectionUID id);
ConnectionInternal* GetConnection(const DeviceUID& device,
const ApplicationHandle& application);
@@ -339,7 +363,7 @@ class TransportManagerImpl : public TransportManager,
bool GetFrameSize(unsigned char* data, unsigned int data_size,
unsigned int& frame_size);
bool GetFrame(std::map<ConnectionUID,
- std::pair<unsigned int, unsigned char*> >& container,
+ std::pair<unsigned int, unsigned char*> >& container,
ConnectionUID id, unsigned int frame_size,
unsigned char** frame);
@@ -348,9 +372,6 @@ class TransportManagerImpl : public TransportManager,
void TerminateAllAdapters();
int InitAllAdapters();
static Connection convert(const ConnectionInternal& p);
-};
-// class ;
-
+}; // class TransportManagerImpl
} // namespace transport_manager
-
-#endif
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TRANSPORT_MANAGER_IMPL_H_
diff --git a/src/components/transport_manager/src/tcp/dnssd_service_browser.cc b/src/components/transport_manager/src/tcp/dnssd_service_browser.cc
deleted file mode 100644
index 3571ac8156..0000000000
--- a/src/components/transport_manager/src/tcp/dnssd_service_browser.cc
+++ /dev/null
@@ -1,378 +0,0 @@
-/*
- *
- * Copyright (c) 2013, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <algorithm>
-#include <map>
-#include "utils/logger.h"
-
-#include "transport_manager/transport_adapter/transport_adapter_impl.h"
-#include "transport_manager/tcp/tcp_device.h"
-#include "transport_manager/tcp/dnssd_service_browser.h"
-
-
-namespace transport_manager {
-namespace transport_adapter {
-
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
-
-
-bool operator==(const DnssdServiceRecord& a, const DnssdServiceRecord& b) {
- return a.name == b.name && a.type == b.type && a.interface == b.interface
- && a.protocol == b.protocol && a.domain_name == b.domain_name;
-}
-
-void DnssdServiceBrowser::Terminate() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (0 != avahi_threaded_poll_) {
- avahi_threaded_poll_stop(avahi_threaded_poll_);
- }
- if (0 != avahi_service_browser_) {
- avahi_service_browser_free(avahi_service_browser_);
- avahi_service_browser_ = NULL;
- }
- if (0 != avahi_client_) {
- avahi_client_free(avahi_client_);
- avahi_client_ = NULL;
- }
- if (0 != avahi_threaded_poll_) {
- avahi_threaded_poll_free(avahi_threaded_poll_);
- avahi_threaded_poll_ = NULL;
- }
-}
-
-bool DnssdServiceBrowser::IsInitialised() const {
- return initialised_;
-}
-
-DnssdServiceBrowser::DnssdServiceBrowser(TransportAdapterController* controller)
- : controller_(controller),
- avahi_service_browser_(0),
- avahi_threaded_poll_(0),
- avahi_client_(0),
- service_records_(),
- mutex_(),
- initialised_(false) {
-}
-
-DnssdServiceBrowser::~DnssdServiceBrowser() {
-}
-
-void DnssdServiceBrowser::OnClientConnected() {
- initialised_ = true;
- LOG4CXX_INFO(logger_, "AvahiClient ready");
-}
-
-void DnssdServiceBrowser::OnClientFailure() {
- LOG4CXX_AUTO_TRACE(logger_);
- const int avahi_errno = avahi_client_errno(avahi_client_);
- if (avahi_errno == AVAHI_ERR_DISCONNECTED) {
- LOG4CXX_DEBUG(logger_, "AvahiClient disconnected");
- CreateAvahiClientAndBrowser();
- } else {
- LOG4CXX_ERROR(logger_,
- "AvahiClient failure: " << avahi_strerror(avahi_errno));
- }
-}
-
-void AvahiClientCallback(AvahiClient* avahi_client,
- AvahiClientState avahi_client_state, void* data) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "avahi_client " << avahi_client << ", avahi_client_state " << avahi_client_state << ", data " << data);
- DnssdServiceBrowser* dnssd_service_browser =
- static_cast<DnssdServiceBrowser*>(data);
-
- switch (avahi_client_state) {
- case AVAHI_CLIENT_S_RUNNING:
- dnssd_service_browser->OnClientConnected();
- LOG4CXX_DEBUG(logger_, "avahi_client_state: AVAHI_CLIENT_S_RUNNING");
- break;
- case AVAHI_CLIENT_FAILURE:
- dnssd_service_browser->OnClientFailure();
- LOG4CXX_DEBUG(logger_, "avahi_client_state: AVAHI_CLIENT_FAILURE");
- break;
- default: {
- LOG4CXX_ERROR(logger_,
- "Unknown avahi_client_state: " << avahi_client_state);
- }
- }
-}
-
-void AvahiServiceBrowserCallback(AvahiServiceBrowser* avahi_service_browser,
- AvahiIfIndex interface, AvahiProtocol protocol,
- AvahiBrowserEvent event, const char* name,
- const char* type, const char* domain,
- AvahiLookupResultFlags flags, void* data) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "avahi_service_browser " << avahi_service_browser << " interface " << interface <<
- " protocol " << protocol << " event " << event << " name " << name <<
- " type " << type << " domain " << domain << " flags " << flags << " data " << data);
- DnssdServiceBrowser* dnssd_service_browser =
- static_cast<DnssdServiceBrowser*>(data);
-
- switch (event) {
- case AVAHI_BROWSER_FAILURE:
- LOG4CXX_ERROR(
- logger_,
- "AvahiServiceBrowser failure: " << avahi_strerror(avahi_client_errno(
- avahi_service_browser_get_client(avahi_service_browser))));
- break;
-
- case AVAHI_BROWSER_NEW:
- dnssd_service_browser->AddService(interface, protocol, name, type,
- domain);
- LOG4CXX_DEBUG(logger_, "event: AVAHI_BROWSER_NEW");
- break;
-
- case AVAHI_BROWSER_REMOVE:
- dnssd_service_browser->RemoveService(interface, protocol, name, type,
- domain);
- LOG4CXX_DEBUG(logger_, "event: AVAHI_BROWSER_REMOVE");
- break;
-
- case AVAHI_BROWSER_ALL_FOR_NOW:
- LOG4CXX_DEBUG(logger_, "event: AVAHI_BROWSER_ALL_FOR_NOW");
- break;
- case AVAHI_BROWSER_CACHE_EXHAUSTED:
- LOG4CXX_DEBUG(logger_, "event: AVAHI_BROWSER_CACHE_EXHAUSTED");
- break;
- }
- LOG4CXX_TRACE(logger_, "exit");
-}
-
-void DnssdServiceBrowser::ServiceResolved(
- const DnssdServiceRecord& service_record) {
- LOG4CXX_AUTO_TRACE(logger_);
- sync_primitives::AutoLock locker(mutex_);
- ServiceRecords::iterator service_record_it = std::find(
- service_records_.begin(), service_records_.end(), service_record);
- if (service_record_it != service_records_.end()) {
- *service_record_it = service_record;
- }
- DeviceVector device_vector = PrepareDeviceVector();
- controller_->SearchDeviceDone(device_vector);
-}
-
-void DnssdServiceBrowser::ServiceResolveFailed(
- const DnssdServiceRecord& service_record) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(logger_,
- "AvahiServiceResolver failure for: " << service_record.name);
- sync_primitives::AutoLock locker(mutex_);
- ServiceRecords::iterator service_record_it = std::find(
- service_records_.begin(), service_records_.end(), service_record);
- if (service_record_it != service_records_.end()) {
- service_records_.erase(service_record_it);
- }
-}
-
-void AvahiServiceResolverCallback(AvahiServiceResolver* avahi_service_resolver,
- AvahiIfIndex interface,
- AvahiProtocol protocol,
- AvahiResolverEvent event, const char* name,
- const char* type, const char* domain,
- const char* host_name,
- const AvahiAddress* avahi_address,
- uint16_t port, AvahiStringList* txt,
- AvahiLookupResultFlags flags, void* data) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "avahi_service_resolver " << avahi_service_resolver << " interface " << interface <<
- " protocol " << protocol << " event " << event << " name " << name <<
- " type " << type << " domain " << domain << " host_name " << host_name <<
- " avahi_address " << avahi_address << " port " << port <<
- " txt " << txt << " flags " << flags << " data " << data);
- DnssdServiceBrowser* dnssd_service_browser =
- static_cast<DnssdServiceBrowser*>(data);
-
- DnssdServiceRecord service_record;
- service_record.interface = interface;
- service_record.protocol = protocol;
- service_record.domain_name = domain;
- service_record.host_name = host_name;
- service_record.name = name;
- service_record.type = type;
- switch (event) {
- case AVAHI_RESOLVER_FOUND:
- service_record.addr = avahi_address->data.ipv4.address;
- service_record.port = port;
- dnssd_service_browser->ServiceResolved(service_record);
- LOG4CXX_DEBUG(logger_, "event: AVAHI_RESOLVER_FOUND");
- break;
- case AVAHI_RESOLVER_FAILURE:
- dnssd_service_browser->ServiceResolveFailed(service_record);
- LOG4CXX_DEBUG(logger_, "event: AVAHI_RESOLVER_FAILURE");
- break;
- }
-
- avahi_service_resolver_free(avahi_service_resolver);
-}
-
-TransportAdapter::Error DnssdServiceBrowser::CreateAvahiClientAndBrowser() {
- LOG4CXX_AUTO_TRACE(logger_);
- if (0 != avahi_service_browser_) {
- avahi_service_browser_free(avahi_service_browser_);
- avahi_service_browser_ = NULL;
- }
- if (0 != avahi_client_) {
- avahi_client_free(avahi_client_);
- avahi_client_ = NULL;
- }
-
- int avahi_error;
- avahi_client_ = avahi_client_new(
- avahi_threaded_poll_get(avahi_threaded_poll_), AVAHI_CLIENT_NO_FAIL,
- AvahiClientCallback, this, &avahi_error);
- if (0 == avahi_client_) {
- LOG4CXX_ERROR(
- logger_,
- "Failed to create AvahiClient: " << avahi_strerror(avahi_error));
- return TransportAdapter::FAIL;
- }
-
- mutex_.Acquire();
- service_records_.clear();
- mutex_.Release();
-
- avahi_service_browser_ = avahi_service_browser_new(
- avahi_client_, AVAHI_IF_UNSPEC, /* TODO use only required iface */
- AVAHI_PROTO_INET, DNSSD_DEFAULT_SERVICE_TYPE, NULL, /* use default domain */
- static_cast<AvahiLookupFlags>(0), AvahiServiceBrowserCallback, this);
- return TransportAdapter::OK;
-}
-
-TransportAdapter::Error DnssdServiceBrowser::Init() {
- LOG4CXX_AUTO_TRACE(logger_);
- avahi_threaded_poll_ = avahi_threaded_poll_new();
- if (0 == avahi_threaded_poll_) {
- LOG4CXX_ERROR(logger_, "Failed to create AvahiThreadedPoll");
- return TransportAdapter::FAIL;
- }
-
- const TransportAdapter::Error err = CreateAvahiClientAndBrowser();
- if (err != TransportAdapter::OK) {
- LOG4CXX_ERROR(logger_, "Error " << err);
- return err;
- }
-
- const int poll_start_status = avahi_threaded_poll_start(avahi_threaded_poll_);
- if (0 != poll_start_status) {
- LOG4CXX_ERROR(logger_, "Failed to start AvahiThreadedPoll");
- return TransportAdapter::FAIL;
- }
- return TransportAdapter::OK;
-}
-
-TransportAdapter::Error DnssdServiceBrowser::Scan() {
- return TransportAdapter::NOT_SUPPORTED;
-}
-
-void DnssdServiceBrowser::AddService(AvahiIfIndex interface,
- AvahiProtocol protocol, const char* name,
- const char* type, const char* domain) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "interface " << interface << " protocol " << protocol << " name " << name << " type " << type << " domain " << domain);
- DnssdServiceRecord record;
- record.interface = interface;
- record.protocol = protocol;
- record.domain_name = domain;
- record.name = name;
- record.type = type;
-
- sync_primitives::AutoLock locker(mutex_);
- if (service_records_.end()
- == std::find(service_records_.begin(), service_records_.end(), record)) {
- service_records_.push_back(record);
- avahi_service_resolver_new(avahi_client_, interface, protocol, name, type,
- domain, AVAHI_PROTO_INET,
- static_cast<AvahiLookupFlags>(0),
- AvahiServiceResolverCallback, this);
- }
-}
-
-void DnssdServiceBrowser::RemoveService(AvahiIfIndex interface,
- AvahiProtocol protocol,
- const char* name, const char* type,
- const char* domain) {
- LOG4CXX_AUTO_TRACE(logger_);
- LOG4CXX_DEBUG(
- logger_,
- "interface " << interface << " protocol " << protocol << " name " << name << " type " << type << " domain " << domain);
- DnssdServiceRecord record;
- record.interface = interface;
- record.protocol = protocol;
- record.name = name;
- record.type = type;
- record.domain_name = domain;
-
- sync_primitives::AutoLock locker(mutex_);
- service_records_.erase(
- std::remove(service_records_.begin(), service_records_.end(), record),
- service_records_.end());
-}
-
-DeviceVector DnssdServiceBrowser::PrepareDeviceVector() const {
- LOG4CXX_AUTO_TRACE(logger_);
- std::map<uint32_t, TcpDevice*> devices;
- for (ServiceRecords::const_iterator it = service_records_.begin();
- it != service_records_.end(); ++it) {
- const DnssdServiceRecord& service_record = *it;
- if (service_record.host_name.empty()) {
- continue;
- }
- if (devices[service_record.addr] == 0) {
- devices[service_record.addr] = new TcpDevice(service_record.addr,
- service_record.host_name);
- }
- if (devices[service_record.addr] != 0) {
- devices[service_record.addr]->AddDiscoveredApplication(
- service_record.port);
- }
- }
- DeviceVector device_vector;
- device_vector.reserve(devices.size());
- for (std::map<uint32_t, TcpDevice*>::const_iterator it = devices.begin();
- it != devices.end(); ++it) {
- device_vector.push_back(DeviceSptr(it->second));
- }
- return device_vector;
-}
-
-} // namespace transport_adapter
-} // namespace transport_manager
diff --git a/src/components/transport_manager/src/tcp/tcp_device.cc b/src/components/transport_manager/src/tcp/tcp_device.cc
index 2dacd9e8a2..3bd2a9a06a 100644
--- a/src/components/transport_manager/src/tcp/tcp_device.cc
+++ b/src/components/transport_manager/src/tcp/tcp_device.cc
@@ -37,7 +37,6 @@
namespace transport_manager {
namespace transport_adapter {
-//CREATE_LOGGERPTR_LOCAL(logger_, "TransportManager")
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
diff --git a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
index 3998c02ab9..b7f52ff4a6 100644
--- a/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
+++ b/src/components/transport_manager/src/tcp/tcp_transport_adapter.cc
@@ -47,22 +47,14 @@
#include "transport_manager/tcp/tcp_connection_factory.h"
#include "transport_manager/tcp/tcp_device.h"
-#ifdef AVAHI_SUPPORT
-#include "transport_manager/tcp/dnssd_service_browser.h"
-#endif
-
namespace transport_manager {
namespace transport_adapter {
-CREATE_LOGGERPTR_GLOBAL(logger_, "TransportAdapterImpl")
+CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
TcpTransportAdapter::TcpTransportAdapter(const uint16_t port)
: TransportAdapterImpl(
-#ifdef AVAHI_SUPPORT
- new DnssdServiceBrowser(this),
-#else
NULL,
-#endif
new TcpConnectionFactory(this),
new TcpClientListener(this, port, true)) {
}
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
index 170cb7b734..2ae8776a3e 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_impl.cc
@@ -32,6 +32,7 @@
#include "config_profile/profile.h"
#include "utils/logger.h"
+#include "utils/helpers.h"
#include "transport_manager/transport_adapter/transport_adapter_impl.h"
#include "transport_manager/transport_adapter/transport_adapter_listener.h"
@@ -45,9 +46,9 @@ namespace transport_adapter {
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
namespace {
DeviceTypes devicesType = {
- std::make_pair(AOA, std::string("USB")),
- std::make_pair(PASA_AOA, std::string("USB")),
- std::make_pair(MME, std::string("USB")),
+ std::make_pair(AOA, std::string("USB_AOA")),
+ std::make_pair(PASA_AOA, std::string("USB_AOA")),
+ std::make_pair(MME, std::string("USB_IOS")),
std::make_pair(BLUETOOTH, std::string("BLUETOOTH")),
std::make_pair(PASA_BLUETOOTH, std::string("BLUETOOTH")),
std::make_pair(TCP, std::string("WIFI"))
@@ -64,9 +65,9 @@ TransportAdapterImpl::TransportAdapterImpl(
devices_mutex_(),
connections_(),
connections_lock_(),
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
metric_observer_(NULL),
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
device_scanner_(device_scanner),
server_connection_factory_(server_connection_factory),
client_connection_listener_(client_connection_listener) {
@@ -114,8 +115,8 @@ void TransportAdapterImpl::Terminate() {
LOG4CXX_DEBUG(logger_, "Connections deleted");
- devices_mutex_.Acquire();
DeviceMap devices;
+ devices_mutex_.Acquire();
std::swap(devices, devices_);
devices_mutex_.Release();
devices.clear();
@@ -315,6 +316,7 @@ TransportAdapter::Error TransportAdapterImpl::StopClientListening() {
return BAD_STATE;
}
TransportAdapter::Error err = client_connection_listener_->StopListening();
+ sync_primitives::AutoLock locker(devices_mutex_);
for(DeviceMap::iterator it = devices_.begin();
it != devices_.end();
++it) {
@@ -479,7 +481,7 @@ bool TransportAdapterImpl::IsServerOriginatedConnectSupported() const {
}
bool TransportAdapterImpl::IsClientOriginatedConnectSupported() const {
- LOG4CXX_TRACE(logger_, "IsClientOriginatedConnectSupported");
+ LOG4CXX_AUTO_TRACE(logger_);
return client_connection_listener_ != 0;
}
@@ -587,11 +589,12 @@ void TransportAdapterImpl::DataReceiveDone(const DeviceUID& device_id,
LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id << ", app_handle: " <<
&app_handle << ", message: " << message);
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
metric_observer_->StartRawMsg(message.get());
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
+
for (TransportAdapterListenerList::iterator it = listeners_.begin();
it != listeners_.end(); ++it) {
(*it)->OnDataReceiveDone(this, device_id, app_handle, message);
@@ -636,8 +639,8 @@ void TransportAdapterImpl::DataSendFailed(const DeviceUID& device_id,
DeviceSptr TransportAdapterImpl::FindDevice(const DeviceUID& device_id) const {
LOG4CXX_TRACE(logger_, "enter. device_id: " << &device_id);
DeviceSptr ret;
- LOG4CXX_DEBUG(logger_, "devices_.size() = " << devices_.size());
sync_primitives::AutoLock locker(devices_mutex_);
+ LOG4CXX_DEBUG(logger_, "devices_.size() = " << devices_.size());
DeviceMap::const_iterator it = devices_.find(device_id);
if (it != devices_.end()) {
ret = it->second;
@@ -770,17 +773,17 @@ std::string TransportAdapterImpl::GetConnectionType() const {
return devicesType[GetDeviceType()];
}
-#ifdef TIME_TESTER
-void TransportAdapterImpl::SetTimeMetricObserver(TMMetricObserver* observer) {
+#ifdef TELEMETRY_MONITOR
+void TransportAdapterImpl::SetTelemetryObserver(TMTelemetryObserver* observer) {
metric_observer_ = observer;
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
-#ifdef TIME_TESTER
-TMMetricObserver* TransportAdapterImpl::GetTimeMetricObserver() {
+#ifdef TELEMETRY_MONITOR
+TMTelemetryObserver* TransportAdapterImpl::GetTelemetryObserver() {
return metric_observer_;
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
void TransportAdapterImpl::Store() const {
}
diff --git a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
index f73748de52..b11358144a 100644
--- a/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
+++ b/src/components/transport_manager/src/transport_adapter/transport_adapter_listener_impl.cc
@@ -42,8 +42,8 @@ namespace transport_manager {
CREATE_LOGGERPTR_GLOBAL(logger_, "TransportManager")
TransportAdapterListenerImpl::TransportAdapterListenerImpl(
- TransportManagerImpl* manager, TransportAdapter* adapter) :
- transport_manager_impl_(manager), transport_adapter_(adapter) {
+ TransportManager* manager, TransportAdapter* adapter) :
+ transport_manager_(manager), transport_adapter_(adapter) {
}
void TransportAdapterListenerImpl::OnSearchDeviceDone(
@@ -52,8 +52,8 @@ void TransportAdapterListenerImpl::OnSearchDeviceDone(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE,
transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr());
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -66,8 +66,8 @@ void TransportAdapterListenerImpl::OnSearchDeviceFailed(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL,
transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -79,8 +79,8 @@ void TransportAdapterListenerImpl::OnDeviceListUpdated(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED,
transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr());
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -92,8 +92,8 @@ void TransportAdapterListenerImpl::OnFindNewApplicationsRequest(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::ON_FIND_NEW_APPLICATIONS_REQUEST,
transport_adapter_, "", 0, ::protocol_handler::RawMessagePtr(), BaseErrorPtr());
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -108,8 +108,8 @@ void TransportAdapterListenerImpl::OnConnectDone(
TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE,
transport_adapter_, device, application_id, ::protocol_handler::RawMessagePtr(),
BaseErrorPtr(new BaseError()));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -124,8 +124,8 @@ void TransportAdapterListenerImpl::OnConnectFailed(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL,
transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -140,8 +140,8 @@ void TransportAdapterListenerImpl::OnDisconnectDone(
TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE,
transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(),
BaseErrorPtr(new BaseError()));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -156,8 +156,8 @@ void TransportAdapterListenerImpl::OnDisconnectFailed(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL,
transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -181,8 +181,8 @@ void TransportAdapterListenerImpl::OnDataReceiveDone(
TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE,
transport_adapter_, device, app_id, data_container,
BaseErrorPtr(new BaseError()));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -197,8 +197,8 @@ void TransportAdapterListenerImpl::OnDataReceiveFailed(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL,
transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -213,8 +213,8 @@ void TransportAdapterListenerImpl::OnDataSendDone(
TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE,
transport_adapter_, device, app_id, data_container,
new BaseError());
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -231,8 +231,8 @@ void TransportAdapterListenerImpl::OnDataSendFailed(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL,
transport_adapter_, device, app_id, data_container, BaseErrorPtr(err));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -252,8 +252,8 @@ void TransportAdapterListenerImpl::OnUnexpectedDisconnect(
const TransportAdapterEvent event(
TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT,
transport_adapter_, device, application, ::protocol_handler::RawMessagePtr(), BaseErrorPtr(err));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
@@ -268,8 +268,8 @@ void TransportAdapterListenerImpl::OnCommunicationError(
TransportAdapterListenerImpl::EventTypeEnum::ON_COMMUNICATION_ERROR,
transport_adapter_, device, app_id, ::protocol_handler::RawMessagePtr(),
BaseErrorPtr(new BaseError()));
- if (transport_manager::E_SUCCESS
- != transport_manager_impl_->ReceiveEventFromDevice(event)) {
+ if (transport_manager_!= NULL && transport_manager::E_SUCCESS
+ != transport_manager_->ReceiveEventFromDevice(event)) {
LOG4CXX_WARN(logger_, "Failed to receive event from device");
}
LOG4CXX_TRACE(logger_, "exit");
diff --git a/src/components/transport_manager/src/transport_manager_default.cc b/src/components/transport_manager/src/transport_manager_default.cc
index 835c2c17ed..41e43a1aff 100644
--- a/src/components/transport_manager/src/transport_manager_default.cc
+++ b/src/components/transport_manager/src/transport_manager_default.cc
@@ -64,32 +64,32 @@ int TransportManagerDefault::Init() {
ta = new transport_adapter::BluetoothTransportAdapter;
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- ta->SetTimeMetricObserver(metric_observer_);
+ ta->SetTelemetryObserver(metric_observer_);
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta);
#endif
uint16_t port = profile::Profile::instance()->transport_manager_tcp_adapter_port();
ta = new transport_adapter::TcpTransportAdapter(port);
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- ta->SetTimeMetricObserver(metric_observer_);
+ ta->SetTelemetryObserver(metric_observer_);
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta);
#if defined(USB_SUPPORT)
ta = new transport_adapter::UsbAoaAdapter();
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
- ta->SetTimeMetricObserver(metric_observer_);
+ ta->SetTelemetryObserver(metric_observer_);
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
AddTransportAdapter(ta);
#endif // USB_SUPPORT
diff --git a/src/components/transport_manager/src/transport_manager_impl.cc b/src/components/transport_manager/src/transport_manager_impl.cc
index 6c3edd7b91..cbae02d4b3 100644
--- a/src/components/transport_manager/src/transport_manager_impl.cc
+++ b/src/components/transport_manager/src/transport_manager_impl.cc
@@ -43,6 +43,8 @@
#include "utils/macro.h"
#include "utils/logger.h"
+#include "utils/make_shared.h"
+#include "utils/timer_task_impl.h"
#include "transport_manager/common.h"
#include "transport_manager/transport_manager_listener.h"
#include "transport_manager/transport_manager_listener_empty.h"
@@ -70,9 +72,9 @@ TransportManagerImpl::Connection TransportManagerImpl::convert(
TransportManagerImpl::TransportManagerImpl()
: is_initialized_(false),
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
metric_observer_(NULL),
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
connection_id_counter_(0),
message_queue_("TM MessageQueue", this),
event_queue_("TM EventQueue", this) {
@@ -99,7 +101,7 @@ TransportManagerImpl::~TransportManagerImpl() {
LOG4CXX_INFO(logger_, "TransportManager object destroyed");
}
-int TransportManagerImpl::ConnectDevice(const DeviceHandle& device_handle) {
+int TransportManagerImpl::ConnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
@@ -109,14 +111,16 @@ int TransportManagerImpl::ConnectDevice(const DeviceHandle& device_handle) {
}
DeviceUID device_id = converter_.HandleToUid(device_handle);
- LOG4CXX_DEBUG(logger_, "Convert handle to id " << device_id);
+ LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id);
- transport_adapter::TransportAdapter* ta = device_to_adapter_map_[device_id];
- if (NULL == ta) {
+ sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
+ DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id);
+ if (it == device_to_adapter_map_.end()) {
LOG4CXX_ERROR(logger_, "No device adapter found by id " << device_id);
LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
return E_INVALID_HANDLE;
}
+ transport_adapter::TransportAdapter* ta = it->second;
TransportAdapter::Error ta_error = ta->ConnectDevice(device_id);
int err = (TransportAdapter::OK == ta_error) ? E_SUCCESS : E_INTERNAL_ERROR;
@@ -124,7 +128,7 @@ int TransportManagerImpl::ConnectDevice(const DeviceHandle& device_handle) {
return err;
}
-int TransportManagerImpl::DisconnectDevice(const DeviceHandle& device_handle) {
+int TransportManagerImpl::DisconnectDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
if (!this->is_initialized_) {
LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
@@ -133,20 +137,22 @@ int TransportManagerImpl::DisconnectDevice(const DeviceHandle& device_handle) {
return E_TM_IS_NOT_INITIALIZED;
}
DeviceUID device_id = converter_.HandleToUid(device_handle);
- LOG4CXX_DEBUG(logger_, "Convert handle to id" << device_id);
+ LOG4CXX_DEBUG(logger_, "Convert handle to id:" << device_id);
- transport_adapter::TransportAdapter* ta = device_to_adapter_map_[device_id];
- if (NULL == ta) {
+ sync_primitives::AutoReadLock lock(device_to_adapter_map_lock_);
+ DeviceToAdapterMap::iterator it = device_to_adapter_map_.find(device_id);
+ if (it == device_to_adapter_map_.end()) {
LOG4CXX_WARN(logger_, "No device adapter found by id " << device_id);
LOG4CXX_TRACE(logger_, "exit with E_INVALID_HANDLE. Condition: NULL == ta");
return E_INVALID_HANDLE;
}
+ transport_adapter::TransportAdapter* ta = it->second;
ta->DisconnectDevice(device_id);
LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
return E_SUCCESS;
}
-int TransportManagerImpl::Disconnect(const ConnectionUID& cid) {
+int TransportManagerImpl::Disconnect(const ConnectionUID cid) {
LOG4CXX_TRACE(logger_, "enter. ConnectionUID: " << &cid);
if (!this->is_initialized_) {
LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
@@ -155,6 +161,7 @@ int TransportManagerImpl::Disconnect(const ConnectionUID& cid) {
return E_TM_IS_NOT_INITIALIZED;
}
+ sync_primitives::AutoReadLock lock(connections_lock_);
ConnectionInternal* connection = GetConnection(cid);
if (NULL == connection) {
LOG4CXX_ERROR(logger_, "TransportManagerImpl::Disconnect: Connection does not exist.");
@@ -193,7 +200,7 @@ int TransportManagerImpl::Disconnect(const ConnectionUID& cid) {
return E_SUCCESS;
}
-int TransportManagerImpl::DisconnectForce(const ConnectionUID& cid) {
+int TransportManagerImpl::DisconnectForce(const ConnectionUID cid) {
LOG4CXX_TRACE(logger_, "enter ConnectionUID: " << &cid);
if (false == this->is_initialized_) {
LOG4CXX_ERROR(logger_, "TransportManager is not initialized.");
@@ -201,6 +208,7 @@ int TransportManagerImpl::DisconnectForce(const ConnectionUID& cid) {
"exit with E_TM_IS_NOT_INITIALIZED. Condition: false == this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
+ sync_primitives::AutoReadLock lock(connections_lock_);
const ConnectionInternal* connection = GetConnection(cid);
if (NULL == connection) {
LOG4CXX_ERROR(
@@ -224,6 +232,7 @@ int TransportManagerImpl::AddEventListener(TransportManagerListener* listener) {
void TransportManagerImpl::DisconnectAllDevices() {
LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoReadLock lock(device_list_lock_);
for (DeviceInfoList::iterator i = device_list_.begin();
i != device_list_.end(); ++i) {
DeviceInfo& device = i->second;
@@ -278,8 +287,9 @@ int TransportManagerImpl::SendMessageToDevice(const ::protocol_handler::RawMessa
return E_TM_IS_NOT_INITIALIZED;
}
- const ConnectionInternal* connection =
- GetConnection(message->connection_key());
+ {
+ sync_primitives::AutoReadLock lock(connections_lock_);
+ const ConnectionInternal* connection = GetConnection(message->connection_key());
if (NULL == connection) {
LOG4CXX_ERROR(logger_, "Connection with id " << message->connection_key()
<< " does not exist.");
@@ -287,17 +297,18 @@ int TransportManagerImpl::SendMessageToDevice(const ::protocol_handler::RawMessa
return E_INVALID_HANDLE;
}
- if (connection->shutDown) {
+ if (connection->shut_down) {
LOG4CXX_ERROR(logger_, "TransportManagerImpl::Disconnect: Connection is to shut down.");
LOG4CXX_TRACE(logger_,
"exit with E_CONNECTION_IS_TO_SHUTDOWN. Condition: connection->shutDown");
return E_CONNECTION_IS_TO_SHUTDOWN;
}
-#ifdef TIME_TESTER
+ }
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
metric_observer_->StartRawMsg(message.get());
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
this->PostMessage(message);
LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
return E_SUCCESS;
@@ -316,7 +327,7 @@ int TransportManagerImpl::ReceiveEventFromDevice(const TransportAdapterEvent& ev
return E_SUCCESS;
}
-int TransportManagerImpl::RemoveDevice(const DeviceHandle& device_handle) {
+int TransportManagerImpl::RemoveDevice(const DeviceHandle device_handle) {
LOG4CXX_TRACE(logger_, "enter. DeviceHandle: " << &device_handle);
DeviceUID device_id = converter_.HandleToUid(device_handle);
if (false == this->is_initialized_) {
@@ -325,6 +336,7 @@ int TransportManagerImpl::RemoveDevice(const DeviceHandle& device_handle) {
"exit with E_TM_IS_NOT_INITIALIZED. Condition: false == this->is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
+ sync_primitives::AutoWriteLock lock(device_to_adapter_map_lock_);
device_to_adapter_map_.erase(device_id);
LOG4CXX_TRACE(logger_, "exit with E_SUCCESS");
return E_SUCCESS;
@@ -434,10 +446,10 @@ int TransportManagerImpl::Visibility(const bool& on_off) const {
TransportAdapter::Error ret;
LOG4CXX_DEBUG(logger_, "Visibility change requested to " << on_off);
- if (false == this->is_initialized_) {
+ if (!is_initialized_) {
LOG4CXX_ERROR(logger_, "TM is not initialized");
LOG4CXX_TRACE(logger_,
- "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == this->is_initialized_");
+ "exit with E_TM_IS_NOT_INITIALIZED. Condition: false == is_initialized_");
return E_TM_IS_NOT_INITIALIZED;
}
@@ -461,6 +473,9 @@ int TransportManagerImpl::Visibility(const bool& on_off) const {
void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta);
std::set<DeviceInfo> old_devices;
+ std::set<DeviceInfo> new_devices;
+ {
+ sync_primitives::AutoWriteLock lock(device_list_lock_);
for (DeviceInfoList::iterator it = device_list_.begin();
it != device_list_.end();) {
if (it->first == ta) {
@@ -471,7 +486,6 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
}
}
- std::set<DeviceInfo> new_devices;
const DeviceList dev_list = ta->GetDeviceList();
for (DeviceList::const_iterator it = dev_list.begin();
it != dev_list.end(); ++it) {
@@ -480,6 +494,7 @@ void TransportManagerImpl::UpdateDeviceList(TransportAdapter* ta) {
device_list_.push_back(std::make_pair(ta, info));
new_devices.insert(info);
}
+ }
std::set<DeviceInfo> added_devices;
std::set_difference(new_devices.begin(), new_devices.end(),
@@ -517,13 +532,16 @@ void TransportManagerImpl::PostEvent(const TransportAdapterEvent& event) {
}
void TransportManagerImpl::AddConnection(const ConnectionInternal& c) {
- LOG4CXX_TRACE(logger_, "enter ConnectionInternal: " << &c);
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "ConnectionInternal: " << &c);
+ sync_primitives::AutoWriteLock lock(connections_lock_);
connections_.push_back(c);
- LOG4CXX_TRACE(logger_, "exit");
}
void TransportManagerImpl::RemoveConnection(uint32_t id) {
- LOG4CXX_TRACE(logger_, "enter Id: " << id);
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Id: " << id);
+ sync_primitives::AutoWriteLock lock(connections_lock_);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end(); ++it) {
if (it->id == id) {
@@ -531,62 +549,64 @@ void TransportManagerImpl::RemoveConnection(uint32_t id) {
break;
}
}
- LOG4CXX_TRACE(logger_, "exit");
}
TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
- const ConnectionUID& id) {
- LOG4CXX_TRACE(logger_, "enter. ConnectionUID: " << &id);
+ const ConnectionUID id) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "ConnectionUID: " << &id);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end(); ++it) {
if (it->id == id) {
- LOG4CXX_TRACE(logger_, "exit with ConnectionInternal. It's address: " << &*it);
+ LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
- LOG4CXX_TRACE(logger_, "exit with NULL");
return NULL;
}
TransportManagerImpl::ConnectionInternal* TransportManagerImpl::GetConnection(
const DeviceUID& device, const ApplicationHandle& application) {
- LOG4CXX_TRACE(logger_, "enter DeviceUID: " << &device << "ApplicationHandle: " <<
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "DeviceUID: " << &device << "ApplicationHandle: " <<
&application);
for (std::vector<ConnectionInternal>::iterator it = connections_.begin();
it != connections_.end(); ++it) {
if (it->device == device && it->application == application) {
- LOG4CXX_TRACE(logger_, "exit with ConnectionInternal. It's address: " << &*it);
+ LOG4CXX_DEBUG(logger_, "ConnectionInternal. It's address: " << &*it);
return &*it;
}
}
- LOG4CXX_TRACE(logger_, "exit with NULL");
return NULL;
}
void TransportManagerImpl::OnDeviceListUpdated(TransportAdapter* ta) {
LOG4CXX_TRACE(logger_, "enter. TransportAdapter: " << ta);
const DeviceList device_list = ta->GetDeviceList();
- LOG4CXX_INFO(logger_, "DEVICE_LIST_UPDATED " << device_list.size());
+ LOG4CXX_DEBUG(logger_, "DEVICE_LIST_UPDATED " << device_list.size());
for (DeviceList::const_iterator it = device_list.begin();
it != device_list.end(); ++it) {
+ device_to_adapter_map_lock_.AcquireForWriting();
device_to_adapter_map_.insert(std::make_pair(*it, ta));
+ device_to_adapter_map_lock_.Release();
DeviceHandle device_handle = converter_.UidToHandle(*it);
DeviceInfo info(device_handle, *it, ta->DeviceName(*it), ta->GetConnectionType());
RaiseEvent(&TransportManagerListener::OnDeviceFound, info);
}
UpdateDeviceList(ta);
std::vector<DeviceInfo> device_infos;
+ device_list_lock_.AcquireForReading();
for (DeviceInfoList::const_iterator it = device_list_.begin();
it != device_list_.end(); ++it) {
device_infos.push_back(it->second);
}
+ device_list_lock_.Release();
RaiseEvent(&TransportManagerListener::OnDeviceListUpdated, device_infos);
LOG4CXX_TRACE(logger_, "exit");
}
void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_TRACE(logger_, "enter");
- ConnectionInternal* connection = GetConnection(event.device_uid, event.application_id);
switch (event.event_type) {
case TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE: {
RaiseEvent(&TransportManagerListener::OnScanDevicesFinished);
@@ -633,15 +653,21 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
break;
}
case TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE: {
+ connections_lock_.AcquireForReading();
+ ConnectionInternal* connection =
+ GetConnection(event.device_uid, event.application_id);
if (NULL == connection) {
LOG4CXX_ERROR(logger_, "Connection not found");
LOG4CXX_DEBUG(logger_,
"event_type = ON_DISCONNECT_DONE && NULL == connection");
+ connections_lock_.Release();
break;
}
- RaiseEvent(&TransportManagerListener::OnConnectionClosed,
- connection->id);
- RemoveConnection(connection->id);
+ const ConnectionUID id = connection->id;
+ connections_lock_.Release();
+
+ RaiseEvent(&TransportManagerListener::OnConnectionClosed, id);
+ RemoveConnection(id);
LOG4CXX_DEBUG(logger_, "event_type = ON_DISCONNECT_DONE");
break;
}
@@ -653,21 +679,25 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
break;
}
case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE: {
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
metric_observer_->StopRawMsg(event.event_data.get());
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
+ sync_primitives::AutoReadLock lock(connections_lock_);
+ ConnectionInternal* connection =
+ GetConnection(event.device_uid, event.application_id);
if (connection == NULL) {
LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
- LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_DONE. Condition: NULL == connection");
+ LOG4CXX_DEBUG(logger_,
+ "event_type = ON_SEND_DONE. Condition: NULL == connection");
break;
}
RaiseEvent(&TransportManagerListener::OnTMMessageSend, event.event_data);
- if (connection->shutDown && --connection->messages_count == 0) {
- connection->timer->stop();
+ if (connection->shut_down && --connection->messages_count == 0) {
+ connection->timer->Stop();
connection->transport_adapter->Disconnect(connection->device,
connection->application);
}
@@ -675,18 +705,24 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
break;
}
case TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL: {
-#ifdef TIME_TESTER
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
metric_observer_->StopRawMsg(event.event_data.get());
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
+ {
+ sync_primitives::AutoReadLock lock(connections_lock_);
+ ConnectionInternal* connection =
+ GetConnection(event.device_uid, event.application_id);
if (connection == NULL) {
LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
- LOG4CXX_DEBUG(logger_, "event_type = ON_SEND_FAIL. Condition: NULL == connection");
+ LOG4CXX_DEBUG(logger_,
+ "event_type = ON_SEND_FAIL. Condition: NULL == connection");
break;
}
+ }
// TODO(YK): start timer here to wait before notify caller
// and remove unsent messages
@@ -702,34 +738,45 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
break;
}
case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE: {
+ {
+ sync_primitives::AutoReadLock lock(connections_lock_);
+ ConnectionInternal* connection =
+ GetConnection(event.device_uid, event.application_id);
if (connection == NULL) {
LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
- LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE. Condition: NULL == connection");
+ LOG4CXX_DEBUG(logger_,
+ "event_type = ON_RECEIVED_DONE. Condition: NULL == connection");
break;
}
event.event_data->set_connection_key(connection->id);
-#ifdef TIME_TESTER
+ }
+#ifdef TELEMETRY_MONITOR
if (metric_observer_) {
metric_observer_->StopRawMsg(event.event_data.get());
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
RaiseEvent(&TransportManagerListener::OnTMMessageReceived, event.event_data);
LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_DONE");
break;
}
case TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL: {
LOG4CXX_DEBUG(logger_, "Event ON_RECEIVED_FAIL");
+ connections_lock_.AcquireForReading();
+ ConnectionInternal* connection =
+ GetConnection(event.device_uid, event.application_id);
if (connection == NULL) {
LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
+ connections_lock_.Release();
break;
}
+ connections_lock_.Release();
RaiseEvent(&TransportManagerListener::OnTMMessageReceiveFailed,
- connection->id, *static_cast<DataReceiveError*>(event.event_error.get()));
+ *static_cast<DataReceiveError*>(event.event_error.get()));
LOG4CXX_DEBUG(logger_, "event_type = ON_RECEIVED_FAIL");
break;
}
@@ -738,12 +785,18 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
break;
}
case TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT: {
+ connections_lock_.AcquireForReading();
+ ConnectionInternal* connection =
+ GetConnection(event.device_uid, event.application_id);
if (connection) {
+ const ConnectionUID id = connection->id;
+ connections_lock_.Release();
RaiseEvent(&TransportManagerListener::OnUnexpectedDisconnect,
- connection->id,
+ id,
*static_cast<CommunicationError*>(event.event_error.get()));
- RemoveConnection(connection->id);
+ RemoveConnection(id);
} else {
+ connections_lock_.Release();
LOG4CXX_ERROR(logger_, "Connection ('" << event.device_uid << ", "
<< event.application_id
<< ") not found");
@@ -755,14 +808,15 @@ void TransportManagerImpl::Handle(TransportAdapterEvent event) {
LOG4CXX_TRACE(logger_, "exit");
}
-#ifdef TIME_TESTER
-void TransportManagerImpl::SetTimeMetricObserver(TMMetricObserver* observer) {
+#ifdef TELEMETRY_MONITOR
+void TransportManagerImpl::SetTelemetryObserver(TMTelemetryObserver* observer) {
metric_observer_ = observer;
}
-#endif // TIME_TESTER
+#endif // TELEMETRY_MONITOR
void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
LOG4CXX_TRACE(logger_, "enter");
+ sync_primitives::AutoReadLock lock(connections_lock_);
ConnectionInternal* connection = GetConnection(msg->connection_key());
if (connection == NULL) {
LOG4CXX_WARN(logger_, "Connection " << msg->connection_key() << " not found");
@@ -788,7 +842,7 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
if (TransportAdapter::OK ==
transport_adapter->SendData(
connection->device, connection->application, msg)) {
- LOG4CXX_INFO(logger_, "Data sent to adapter");
+ LOG4CXX_TRACE(logger_, "Data sent to adapter");
} else {
LOG4CXX_ERROR(logger_, "Data sent error");
RaiseEvent(&TransportManagerListener::OnTMMessageSendFailed,
@@ -799,16 +853,20 @@ void TransportManagerImpl::Handle(::protocol_handler::RawMessagePtr msg) {
LOG4CXX_TRACE(logger_, "exit");
}
-TransportManagerImpl::ConnectionInternal::ConnectionInternal(
- TransportManagerImpl* transport_manager, TransportAdapter* transport_adapter,
- const ConnectionUID& id, const DeviceUID& dev_id, const ApplicationHandle& app_id,
- const DeviceHandle& device_handle)
- : transport_manager(transport_manager),
- transport_adapter(transport_adapter),
- timer(new TimerInternal("TM DiscRoutine", this, &ConnectionInternal::DisconnectFailedRoutine)),
- shutDown(false),
- device_handle_(device_handle),
- messages_count(0) {
+TransportManagerImpl::ConnectionInternal::ConnectionInternal(TransportManagerImpl* transport_manager,
+ TransportAdapter* transport_adapter, const ConnectionUID id,
+ const DeviceUID& dev_id, const ApplicationHandle& app_id,
+ const DeviceHandle device_handle)
+ : transport_manager(transport_manager),
+ transport_adapter(transport_adapter),
+ timer(utils::MakeShared<timer::Timer>(
+ "TM DiscRoutine",
+ new ::timer::TimerTaskImpl<ConnectionInternal> (
+ this,
+ &ConnectionInternal::DisconnectFailedRoutine))),
+ shut_down(false),
+ device_handle_(device_handle),
+ messages_count(0) {
Connection::id = id;
Connection::device = dev_id;
Connection::application = app_id;
@@ -818,8 +876,8 @@ void TransportManagerImpl::ConnectionInternal::DisconnectFailedRoutine() {
LOG4CXX_TRACE(logger_, "enter");
transport_manager->RaiseEvent(&TransportManagerListener::OnDisconnectFailed,
device_handle_, DisconnectDeviceError());
- shutDown = false;
- timer->stop();
+ shut_down = false;
+ timer->Stop();
LOG4CXX_TRACE(logger_, "exit");
}
diff --git a/src/components/transport_manager/test/CMakeLists.txt b/src/components/transport_manager/test/CMakeLists.txt
index c38804e86c..251877cfd4 100644
--- a/src/components/transport_manager/test/CMakeLists.txt
+++ b/src/components/transport_manager/test/CMakeLists.txt
@@ -32,12 +32,12 @@ if(BUILD_TESTS)
set(TM_TEST_DIR ${COMPONENTS_DIR}/transport_manager/test)
include_directories(
+ include
${LOG4CXX_INCLUDE_DIRECTORY}
${GMOCK_INCLUDE_DIRECTORY}
${COMPONENTS_DIR}/smart_objects/include
${COMPONENTS_DIR}/transport_manager/include
${COMPONENTS_DIR}/utils/include
- ${COMPONENTS_DIR}/include
${COMPONENTS_DIR}/connection_handler/include
${JSONCPP_INCLUDE_DIRECTORY}
${CMAKE_BINARY_DIR}
@@ -62,19 +62,14 @@ if (BUILD_BT_SUPPORT)
list(APPEND LIBRARIES bluetooth)
endif()
-if (BUILD_AVAHI_SUPPORT)
- list(APPEND LIBRARIES avahi-client avahi-common)
-endif()
-
set(SOURCES
${TM_TEST_DIR}/transport_manager_default_test.cc
- #${TM_TEST_DIR}/transport_manager_impl_test.cc
- #${TM_TEST_DIR}/dnssd_service_browser_test.cc
+ ${TM_TEST_DIR}/transport_manager_impl_test.cc
${TM_TEST_DIR}/transport_adapter_test.cc
- #${TM_TEST_DIR}/transport_adapter_listener_test.cc
+ ${TM_TEST_DIR}/transport_adapter_listener_test.cc
${TM_TEST_DIR}/tcp_transport_adapter_test.cc
${TM_TEST_DIR}/tcp_device_test.cc
- #${TM_TEST_DIR}/tcp_client_listener_test.cc
+ ${TM_TEST_DIR}/tcp_client_listener_test.cc
)
create_test("transport_manager_test" "${SOURCES}" "${LIBRARIES}")
diff --git a/src/components/transport_manager/test/dnssd_service_browser_test.cc b/src/components/transport_manager/test/dnssd_service_browser_test.cc
deleted file mode 100644
index 6eb2ad45f6..0000000000
--- a/src/components/transport_manager/test/dnssd_service_browser_test.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "gmock/gmock.h"
-
-#include "transport_manager/transport_adapter/transport_adapter_controller.h"
-#include "transport_manager/tcp/dnssd_service_browser.h"
-
-namespace transport_manager {
-namespace transport_adapter {
-
-class MockTransportAdapterController : public TransportAdapterController {
- public:
- MOCK_METHOD1(AddDevice, DeviceSptr(DeviceSptr device));
- MOCK_METHOD1(SearchDeviceDone, void(const DeviceVector& devices));
- MOCK_METHOD1(SearchDeviceFailed, void(const SearchDeviceError& error));
- MOCK_CONST_METHOD1(FindDevice, DeviceSptr(const DeviceUID& device_handle));
- MOCK_METHOD3(ConnectionCreated,
- void(ConnectionSPtr connection, const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD2(ConnectDone, void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD3(ConnectFailed, void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ConnectError& error));
- MOCK_METHOD2(ConnectionFinished, void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD3(ConnectionAborted, void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const CommunicationError& error));
- MOCK_METHOD2(DisconnectDone, void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle));
- MOCK_METHOD3(DataReceiveDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ::protocol_handler::RawMessagePtr message));
- MOCK_METHOD3(DataReceiveFailed, void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const DataReceiveError& error));
- MOCK_METHOD3(DataSendDone,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ::protocol_handler::RawMessagePtr message));
- MOCK_METHOD4(DataSendFailed,
- void(const DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- const ::protocol_handler::RawMessagePtr message,
- const DataSendError& error));
- MOCK_METHOD0(FindNewApplicationsRequest, void());
- MOCK_METHOD0(AckDevices, void());
- MOCK_METHOD1(ApplicationListUpdated, void(const DeviceUID& device_handle));
- MOCK_METHOD2(DeviceDisconnected, void(const DeviceUID& device_handle,
- const DisconnectDeviceError& error));
-};
-
-TEST(DnssdServiceBrowser, DISABLED_Init) {
- // Arrange
- MockTransportAdapterController controller;
- DnssdServiceBrowser dnssd_service_browser(&controller);
- // Check values after creation. Nothing is initialized
- EXPECT_TRUE(NULL == dnssd_service_browser.avahi_service_browser());
- EXPECT_TRUE(NULL == dnssd_service_browser.avahi_threaded_poll());
- EXPECT_TRUE(NULL == dnssd_service_browser.avahi_client());
- // Act
- const TransportAdapter::Error error = dnssd_service_browser.Init();
- ASSERT_EQ(TransportAdapter::OK, error);
-
- while (!dnssd_service_browser.IsInitialised()) {
- sleep(0);
- }
- ASSERT_TRUE(dnssd_service_browser.IsInitialised());
- // Check values are initialized and threaded poll started
- EXPECT_FALSE(NULL == dnssd_service_browser.avahi_service_browser());
- EXPECT_FALSE(NULL == dnssd_service_browser.avahi_threaded_poll());
- EXPECT_FALSE(NULL == dnssd_service_browser.avahi_client());
-}
-
-TEST(DnssdServiceBrowser, DISABLED_IsInitialized_ExpectFalse) {
- // Arrange
- MockTransportAdapterController controller;
- DnssdServiceBrowser dnssd_service_browser(&controller);
- // Check
- EXPECT_FALSE(dnssd_service_browser.IsInitialised());
-}
-
-TEST(DnssdServiceBrowser, DISABLED_Terminate_ExpectTerminated) {
- // Arrange
- MockTransportAdapterController controller;
- DnssdServiceBrowser dnssd_service_browser(&controller);
- // Init service browser and client
- const TransportAdapter::Error error = dnssd_service_browser.Init();
- ASSERT_EQ(TransportAdapter::OK, error);
-
- while (!dnssd_service_browser.IsInitialised()) {
- sleep(0);
- }
- ASSERT_TRUE(dnssd_service_browser.IsInitialised());
- // Client & browser are initialized and successfully started
- EXPECT_FALSE(NULL == dnssd_service_browser.avahi_service_browser());
- EXPECT_FALSE(NULL == dnssd_service_browser.avahi_threaded_poll());
- EXPECT_FALSE(NULL == dnssd_service_browser.avahi_client());
- dnssd_service_browser.Terminate();
- // Checks everything successfully terminated
- EXPECT_TRUE(NULL == dnssd_service_browser.avahi_service_browser());
- EXPECT_TRUE(NULL == dnssd_service_browser.avahi_threaded_poll());
- EXPECT_TRUE(NULL == dnssd_service_browser.avahi_client());
-}
-
-TEST(DnssdServiceBrowser, DISABLED_Scan_ExpectNotSupported) {
- // Arrange
- MockTransportAdapterController controller;
- DnssdServiceBrowser dnssd_service_browser(&controller);
- // At this moment Scan() can only return NOT SUPPORTED value
- EXPECT_EQ(TransportAdapter::NOT_SUPPORTED, dnssd_service_browser.Scan());
-}
-
-} // namespace transport_adapter
-} // namespace transport_manager
diff --git a/src/components/transport_manager/test/include/mock_connection.h b/src/components/transport_manager/test/include/mock_connection.h
deleted file mode 100644
index 8f67107065..0000000000
--- a/src/components/transport_manager/test/include/mock_connection.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * \file mock_connection.h
- * \brief
- *
- * 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTION_H_
-#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTION_H_
-
-#include "transport_manager/common.h"
-#include "transport_manager/error.h"
-#include "transport_manager/transport_adapter/transport_adapter_impl.h"
-#include "transport_manager/transport_adapter/threaded_socket_connection.h"
-
-using ::transport_manager::ApplicationHandle;
-using ::transport_manager::DeviceHandle;
-using ::transport_manager::transport_adapter::Connection;
-using ::transport_manager::transport_adapter::TransportAdapterController;
-using ::transport_manager::ConnectError;
-using ::transport_manager::transport_adapter::ThreadedSocketConnection;
-using ::transport_manager::transport_adapter::TransportAdapter;
-namespace test {
-namespace components {
-namespace transport_manager {
-
-class MockTransportAdapter;
-
-class MockConnection : public ThreadedSocketConnection{
- public:
- MockConnection(const ::transport_manager::DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- TransportAdapterController* adapter);
- bool Establish(ConnectError **error);
-};
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
-
-#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKCONNECTION_H_ */
diff --git a/src/components/transport_manager/test/include/mock_device.h b/src/components/transport_manager/test/include/mock_device.h
deleted file mode 100644
index 1225f851d7..0000000000
--- a/src/components/transport_manager/test/include/mock_device.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * \file mock_device.h
- * \brief
- *
- * 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICE_H_
-#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICE_H_
-
-#include "transport_manager/common.h"
-#include "transport_manager/transport_adapter/transport_adapter_impl.h"
-
-#include "gtest/gtest.h"
-#include "gmock/gmock.h"
-#include <transport_manager/transport_adapter/transport_adapter_impl.h>
-#include <transport_manager/transport_manager_impl.h>
-#include "mock_device_scanner.h"
-#include "mock_application.h"
-
-using ::transport_manager::ApplicationList;
-using ::transport_manager::transport_adapter::Device;
-using ::transport_manager::transport_adapter::TransportAdapterController;
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-class MockDevice : public ::transport_manager::transport_adapter::Device {
-
- pthread_mutex_t device_started_mutex;
- std::vector<MockApplication> applications_;
- int applications_cnt_;
- TransportAdapterController *controller_;
- public:
- MockDevice(const std::string& name, const std::string& id,
- TransportAdapterController * controller)
- : Device(name, id),
- applications_cnt_(0),
- controller_(controller) {
- }
- const ApplicationHandle addApplication();
- void Start();
- void Stop();
- bool IsSameAs(const Device* other) const;
- ApplicationList GetApplicationList() const;
- bool operator == (const MockDevice &other);
-};
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
-
-#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICE_H_ */
diff --git a/src/components/transport_manager/test/include/mock_device_scanner.h b/src/components/transport_manager/test/include/mock_device_scanner.h
deleted file mode 100644
index 6ebae39a7c..0000000000
--- a/src/components/transport_manager/test/include/mock_device_scanner.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * \file mock_device_scanner.h
- * \brief
- *
- * 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 APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICESCANNER_H_
-#define APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICESCANNER_H_
-
-#include "transport_manager/transport_adapter/device_scanner.h"
-
-using ::transport_manager::transport_adapter::TransportAdapter;
-using ::transport_manager::transport_adapter::DeviceScanner;
-using ::transport_manager::transport_adapter::DeviceVector;
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-class MockTransportAdapter;
-
-class MockDeviceScanner : public DeviceScanner {
- public:
- MockDeviceScanner(MockTransportAdapter *adapter);
- void reset();
- void AddDevice(const std::string& name, const std::string& unique_id, bool start = true);
- void RemoveDevice(const std::string& name);
- void fail_further_search() { is_search_failed_ = true; }
-
- protected:
- TransportAdapter::Error Init();
- TransportAdapter::Error Scan();
- void Terminate();
- bool IsInitialised() const;
-
- private:
- MockTransportAdapter *controller_;
- DeviceVector devices_;
- bool is_initialized_;
- bool is_search_failed_;
-};
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
-
-#endif /* APPLINK_TEST_COMPONENTS_TRANSPORTMANAGER_INCLUDE_MOCKDEVICESCANNER_H_ */
diff --git a/src/components/time_tester/test/include/time_manager_mock.h b/src/components/transport_manager/test/include/mock_telemetry_observer.h
index dfdfa2da7b..e2c41f658e 100644
--- a/src/components/time_tester/test/include/time_manager_mock.h
+++ b/src/components/transport_manager/test/include/mock_telemetry_observer.h
@@ -30,28 +30,26 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef TEST_COMPONENTS_TIME_MANAGER_INCLUDE_TIME_MANAGER_MOCK_H_
-#define TEST_COMPONENTS_TIME_MANAGER_INCLUDE_TIME_MANAGER_MOCK_H_
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TEST_MOCK_TELEMETRY_OBSERVER_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TEST_MOCK_TELEMETRY_OBSERVER_H_
+
+#include "gmock/gmock.h"
+#include "transport_manager/telemetry_observer.h"
-#include <gmock/gmock.h>
-#include "time_manager.h"
-#include "metric_wrapper.h"
namespace test {
namespace components {
-namespace time_tester_test {
+namespace transport_manager_test {
-using namespace time_tester;
-/*
- * MOCK implementation of ::security_manager::SecurityManager
- */
-class TimeManagerMock : public time_tester::TimeManager {
+class MockTMTelemetryObserver
+ : public ::transport_manager::TMTelemetryObserver {
public:
- MOCK_METHOD1(Init, void(protocol_handler::ProtocolHandlerImpl* ph));
- MOCK_METHOD0(Stop, void());
- MOCK_METHOD0(Start, void());
- MOCK_METHOD1(SendMetric, void(utils::SharedPtr<MetricWrapper> metric));
+ MOCK_METHOD1(StartRawMsg,
+ void(const protocol_handler::RawMessage* ptr));
+ MOCK_METHOD1(StopRawMsg,
+ void(const protocol_handler::RawMessage* ptr));
};
-} // time_tester_test
+
+} // transport_manager_test
} // components
} // test
-#endif // TEST_COMPONENTS_TIME_MANAGER_INCLUDE_TIME_MANAGER_MOCK_H_
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_INCLUDE_TRANSPORT_MANAGER_TEST_MOCK_TELEMETRY_OBSERVER_H_
diff --git a/src/components/transport_manager/test/include/mock_transport_manager_listener.h b/src/components/transport_manager/test/include/mock_transport_manager_listener.h
deleted file mode 100644
index 9518e1a92a..0000000000
--- a/src/components/transport_manager/test/include/mock_transport_manager_listener.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * \file mock_transport_adapter_listener.h
- * \brief
- *
- * 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 MOCK_TRANSPORT_MANAGER_LISTENER_H
-#define MOCK_TRANSPORT_MANAGER_LISTENER_H
-
-#include <gmock/gmock.h>
-
-#include "transport_manager/common.h"
-#include "transport_manager/info.h"
-#include "transport_manager/transport_adapter/transport_adapter.h"
-#include "transport_manager/transport_manager_listener.h"
-
-using ::transport_manager::ApplicationList;
-using ::transport_manager::ApplicationHandle;
-using ::transport_manager::transport_adapter::TransportAdapter;
-using ::transport_manager::SearchDeviceError;
-using ::transport_manager::ConnectionUID;
-using ::transport_manager::ConnectError;
-using ::transport_manager::DisconnectError;
-using ::transport_manager::DisconnectDeviceError;
-using ::transport_manager::DataSendError;
-using ::transport_manager::DataReceiveError;
-using ::transport_manager::CommunicationError;
-using ::transport_manager::DeviceInfo;
-using ::transport_manager::DeviceHandle;
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-class MockTransportManagerListener :
- public ::transport_manager::TransportManagerListener {
- public:
- MOCK_METHOD1(OnDeviceListUpdated, void(const std::vector<DeviceInfo>&));
- MOCK_METHOD0(OnFindNewApplicationsRequest, void());
- MOCK_METHOD1(OnDeviceFound, void(const DeviceInfo &device_info));
- MOCK_METHOD1(OnDeviceAdded, void(const DeviceInfo &device_info));
- MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo &device_info));
- MOCK_METHOD0(OnNoDeviceFound, void());
- MOCK_METHOD0(OnScanDevicesFinished, void());
- MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
-
- MOCK_METHOD2(OnConnectionEstablished, void(const DeviceInfo& device_info,
- const ConnectionUID &connection_id));
- MOCK_METHOD2(OnConnectionFailed, void(const DeviceInfo& device_info,
- const ConnectError& error));
-
- MOCK_METHOD1(OnConnectionClosed, void(ConnectionUID connection_id));
- MOCK_METHOD2(OnConnectionClosedFailure, void (ConnectionUID connection_id,
- const DisconnectError& error));
- MOCK_METHOD2(OnUnexpectedDisconnect, void (ConnectionUID connection_id,
- const CommunicationError& error));
- MOCK_METHOD2(OnDeviceConnectionLost, void (const DeviceHandle& device,
- const DisconnectDeviceError& error));
- MOCK_METHOD2(OnDisconnectFailed, void (const DeviceHandle& device,
- const DisconnectDeviceError& error));
-
- MOCK_METHOD1(OnTMMessageReceived, void(const RawMessagePtr data_container));
- MOCK_METHOD2(OnTMMessageReceiveFailed, void(ConnectionUID connection_id,
- const DataReceiveError& error));
- MOCK_METHOD1(OnTMMessageSend, void(const RawMessagePtr message));
- MOCK_METHOD2(OnTMMessageSendFailed, void(const DataSendError& error,
- const RawMessagePtr message));
-};
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
-
-#endif /* MOCK_TRANSPORT_MANAGER_LISTENER_H */
diff --git a/src/components/transport_manager/test/include/transport_adapter_listener_mock.h b/src/components/transport_manager/test/include/transport_adapter_listener_mock.h
index 88b5cf4b66..4e1c2208b6 100644
--- a/src/components/transport_manager/test/include/transport_adapter_listener_mock.h
+++ b/src/components/transport_manager/test/include/transport_adapter_listener_mock.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -40,9 +40,19 @@ namespace test {
namespace components {
namespace transport_manager_test {
-using namespace transport_manager;
-using transport_adapter::TransportAdapter;
-using transport_adapter::TransportAdapterListener;
+namespace tm = transport_manager;
+namespace ta = tm::transport_adapter;
+using ta::TransportAdapter;
+using ta::TransportAdapterListener;
+using tm::SearchDeviceError;
+using tm::DeviceUID;
+using tm::ApplicationHandle;
+using tm::ConnectError;
+using tm::CommunicationError;
+using tm::DisconnectError;
+using tm::DisconnectDeviceError;
+using tm::DataSendError;
+using tm::DataReceiveError;
class TransportAdapterListenerMock : public TransportAdapterListener {
public:
diff --git a/src/components/transport_manager/test/include/transport_adapter_mock.h b/src/components/transport_manager/test/include/transport_adapter_mock.h
index 86e044d13b..599cec29df 100644
--- a/src/components/transport_manager/test/include/transport_adapter_mock.h
+++ b/src/components/transport_manager/test/include/transport_adapter_mock.h
@@ -92,9 +92,9 @@ class TransportAdapterMock
DeviceName,
std::string(const ::transport_manager::DeviceUID& device_handle));
-#ifdef TIME_TESTER
- MOCK_METHOD0(GetTimeMetricObserver, ::transport_manager::TMMetricObserver*());
-#endif // TIME_TESTER
+#ifdef TELEMETRY_MONITOR
+ MOCK_METHOD0(GetTelemetryObserver, ::transport_manager::TMTelemetryObserver*());
+#endif // TELEMETRY_MONITOR
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h
new file mode 100644
index 0000000000..8e01b319ab
--- /dev/null
+++ b/src/components/transport_manager/test/include/transport_manager/mock_transport_manager_impl.h
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_
+#define SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_
+
+#include "gmock/gmock.h"
+#include "transport_manager/transport_manager_impl.h"
+
+namespace test {
+namespace components {
+namespace transport_manager_test {
+
+class MockTransportManagerImpl
+ : public transport_manager::TransportManagerImpl {
+ public:
+ int TestReceiveEventFromDevice(
+ const transport_manager::TransportAdapterEvent& event) {
+ return TransportManagerImpl::ReceiveEventFromDevice(event);
+ }
+
+ void TestHandle(transport_manager::TransportAdapterEvent test_event) {
+ Handle(test_event);
+ }
+
+ void TestHandle(::protocol_handler::RawMessagePtr msg) {
+ Handle(msg);
+ }
+};
+
+} // namespace transport_manager_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_TRANSPORT_MANAGER_TEST_INCLUDE_TRANSPORT_MANAGER_MOCK_TRANSPORT_MANAGER_IMPL_H_
diff --git a/src/components/transport_manager/test/include/transport_manager_listener_mock.h b/src/components/transport_manager/test/include/transport_manager_listener_mock.h
index 29758159f1..5ae6495db2 100644
--- a/src/components/transport_manager/test/include/transport_manager_listener_mock.h
+++ b/src/components/transport_manager/test/include/transport_manager_listener_mock.h
@@ -48,38 +48,42 @@ using ::protocol_handler::RawMessagePtr;
class TransportManagerListenerMock : public TransportManagerListener {
public:
- MOCK_METHOD1(OnDeviceListUpdated, void(const std::vector<DeviceInfo>&));
- MOCK_METHOD0(OnFindNewApplicationsRequest, void());
- MOCK_METHOD1(OnDeviceFound, void(const DeviceInfo& device_info));
- MOCK_METHOD1(OnDeviceAdded, void(const DeviceInfo& device_info));
- MOCK_METHOD1(OnDeviceRemoved, void(const DeviceInfo& device_info));
- MOCK_METHOD0(OnNoDeviceFound, void());
- MOCK_METHOD0(OnScanDevicesFinished, void());
- MOCK_METHOD1(OnScanDevicesFailed, void(const SearchDeviceError& error));
-
+ MOCK_METHOD1(OnDeviceListUpdated,
+ void(const std::vector<DeviceInfo>& device_info));
+ MOCK_METHOD0(OnFindNewApplicationsRequest,
+ void());
+ MOCK_METHOD1(OnDeviceFound,
+ void(const DeviceInfo& device_info));
+ MOCK_METHOD1(OnDeviceAdded,
+ void(const DeviceInfo& device_info));
+ MOCK_METHOD1(OnDeviceRemoved,
+ void(const DeviceInfo& device_info));
+ MOCK_METHOD0(OnScanDevicesFinished,
+ void());
+ MOCK_METHOD1(OnScanDevicesFailed,
+ void(const SearchDeviceError& error));
MOCK_METHOD2(OnConnectionEstablished,
- void(const DeviceInfo& device_info,
- const ConnectionUID& connection_id));
+ void(const DeviceInfo& device_info, const ConnectionUID connection_id));
MOCK_METHOD2(OnConnectionFailed,
- void(const DeviceInfo& device_info, const ConnectError& error));
-
- MOCK_METHOD1(OnConnectionClosed, void(ConnectionUID connection_id));
+ void(const DeviceInfo& device_info, const ConnectError& error));
+ MOCK_METHOD1(OnConnectionClosed,
+ void(const ConnectionUID connection_id));
+ MOCK_METHOD2(OnUnexpectedDisconnect,
+ void(const ConnectionUID connection_id, const CommunicationError& error));
MOCK_METHOD2(OnConnectionClosedFailure,
- void(ConnectionUID connection_id, const DisconnectError& error));
- MOCK_METHOD2(OnUnexpectedDisconnect, void(ConnectionUID connection_id,
- const CommunicationError& error));
+ void(const ConnectionUID connection_id, const DisconnectError& error));
MOCK_METHOD2(OnDeviceConnectionLost,
- void(const DeviceHandle& device,
- const DisconnectDeviceError& error));
- MOCK_METHOD2(OnDisconnectFailed, void(const DeviceHandle& device,
- const DisconnectDeviceError& error));
-
- MOCK_METHOD1(OnTMMessageReceived, void(const RawMessagePtr data_container));
- MOCK_METHOD2(OnTMMessageReceiveFailed, void(ConnectionUID connection_id,
- const DataReceiveError& error));
- MOCK_METHOD1(OnTMMessageSend, void(const RawMessagePtr message));
+ void(const DeviceHandle& device, const DisconnectDeviceError& error));
+ MOCK_METHOD2(OnDisconnectFailed,
+ void(const DeviceHandle& device, const DisconnectDeviceError& error));
+ MOCK_METHOD1(OnTMMessageReceived,
+ void(const ::protocol_handler::RawMessagePtr message));
+ MOCK_METHOD1(OnTMMessageReceiveFailed,
+ void(const DataReceiveError& error));
+ MOCK_METHOD1(OnTMMessageSend,
+ void(const ::protocol_handler::RawMessagePtr message));
MOCK_METHOD2(OnTMMessageSendFailed,
- void(const DataSendError& error, const RawMessagePtr message));
+ void(const DataSendError& error, const ::protocol_handler::RawMessagePtr message));
};
} // namespace transport_manager_test
diff --git a/src/components/transport_manager/test/mock_application.cc b/src/components/transport_manager/test/mock_application.cc
deleted file mode 100644
index 72f99cb744..0000000000
--- a/src/components/transport_manager/test/mock_application.cc
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <sys/socket.h>
-#include <sys/un.h>
-
-#include "include/mock_application.h"
-#include "include/mock_device.h"
-
-namespace {
-
-struct workerData {
- int sockfd;
-};
-
-void *applicationWorker(void *p) {
- workerData *data = static_cast<workerData*>(p);
- char *buf = new char[2 * 1024 * 1024];
- ssize_t len;
-
- while (true) {
- len = recv(data->sockfd, buf, 2 * 1024 * 1024, 0);
- if (len == 0)
- break;
- send(data->sockfd, buf, len, 0);
- }
- delete[] buf;
- delete data;
- return NULL;
-}
-
-void * applicationListener(void *p) {
- using test::components::transport_manager::MockApplication;
- MockApplication *app = static_cast<MockApplication*>(p);
-
- unlink(app->socket_name().c_str());
-
- app->sockfd = socket(AF_UNIX, SOCK_STREAM, 0);
- if (app->sockfd == -1) {
- // TODO: indicate error
- return NULL;
- }
- sockaddr_un my_addr;
- memset(&my_addr, 0, sizeof(my_addr));
- strcpy(my_addr.sun_path, app->socket_name().c_str());
- my_addr.sun_family = AF_UNIX;
- int res = bind(app->sockfd, reinterpret_cast<sockaddr*>(&my_addr),
- sizeof(my_addr));
- if (res == -1) {
- return NULL;
- }
-
- res = listen(app->sockfd, 5);
- if (res == -1) {
- return NULL;
- }
-
- pthread_mutex_lock(&app->ready_mutex);
- app->active = true;
- pthread_cond_signal(&app->ready_cond);
- pthread_mutex_unlock(&app->ready_mutex);
-
- while (app->active) {
- socklen_t addr_size;
- sockaddr peer_addr;
-
- int peer_socket = accept(app->sockfd, &peer_addr, &addr_size);
- if (peer_socket != -1) {
- pthread_t t;
- workerData* data = new workerData();
- data->sockfd = peer_socket;
- pthread_create(&t, NULL, &applicationWorker, data);
- }
- }
-
- unlink(app->socket_name().c_str());
-
- return NULL;
-}
-}
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-MockApplication::MockApplication(const MockDevice *device, ApplicationHandle id)
- : device(device),
- handle(id),
- workerThread(0),
- sockfd(-1),
- active(false) {
- std::ostringstream oss;
- oss << "mockDevice" << device->unique_device_id() << "-" << id;
- socket_name_ = oss.str();
-}
-
-void MockApplication::Start() {
-
- pthread_cond_init(&ready_cond, NULL);
- pthread_mutex_init(&ready_mutex, NULL);
-
- pthread_mutex_lock(&ready_mutex);
- pthread_create(&workerThread, NULL, &applicationListener, this);
- pthread_cond_wait(&ready_cond, &ready_mutex);
- pthread_mutex_unlock(&ready_mutex);
-}
-
-void MockApplication::Stop() {
- active = false;
- shutdown(sockfd, SHUT_RDWR);
- close(sockfd);
- pthread_join(workerThread, NULL);
-}
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
diff --git a/src/components/transport_manager/test/mock_device.cc b/src/components/transport_manager/test/mock_device.cc
deleted file mode 100644
index 8e346e9d54..0000000000
--- a/src/components/transport_manager/test/mock_device.cc
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "include/mock_device.h"
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-const ApplicationHandle MockDevice::addApplication() {
- MockApplication app(this, applications_cnt_++);
- app.device = this;
- app.active = false;
- applications_.push_back(app);
- return app.handle;
-}
-
-void MockDevice::Start() {
- for (std::vector<MockApplication>::iterator it = applications_.begin();
- it != applications_.end();
- ++it) {
- it->Start();
- }
-}
-
-void MockDevice::Stop() {
- for (std::vector<MockApplication>::iterator it = applications_.begin();
- it != applications_.end();
- ++it) {
- it->Stop();
- }
-}
-
-bool MockDevice::IsSameAs(const Device* other) const {
- return unique_device_id() == other->unique_device_id();
-}
-
-static ApplicationHandle get_handle(const MockApplication& app) {
- return app.handle;
-}
-
-ApplicationList MockDevice::GetApplicationList() const {
- ApplicationList rc(applications_.size());
- std::transform(
- applications_.begin(), applications_.end(), rc.begin(),
- &get_handle);
- return rc;
-}
-
-bool MockDevice::operator ==(const MockDevice& other) {
- return IsSameAs(&other);
-}
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
diff --git a/src/components/transport_manager/test/mock_device_scanner.cc b/src/components/transport_manager/test/mock_device_scanner.cc
deleted file mode 100644
index a243162668..0000000000
--- a/src/components/transport_manager/test/mock_device_scanner.cc
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright (c) 2014, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "include/mock_device_scanner.h"
-#include "include/mock_transport_adapter.h"
-#include "include/mock_device.h"
-
-using ::transport_manager::SearchDeviceError;
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-MockDeviceScanner::MockDeviceScanner(MockTransportAdapter *controller)
- : controller_(controller),
- is_initialized_(false),
- is_search_failed_(false) {
-}
-
-TransportAdapter::Error MockDeviceScanner::Init() {
- is_initialized_ = true;
- return TransportAdapter::OK;
-}
-
-TransportAdapter::Error MockDeviceScanner::Scan() {
- if (is_search_failed_) {
- controller_->SearchDeviceFailed(SearchDeviceError());
- } else {
- controller_->SearchDeviceDone(devices_);
- }
- return TransportAdapter::OK;
-}
-
-void MockDeviceScanner::Terminate() {
-}
-
-void MockDeviceScanner::reset() {
- is_search_failed_ = false;
- for (DeviceVector::iterator it = devices_.begin();
- it != devices_.end();
- ++it) {
- static_cast<MockDevice*>(it->get())->Stop();
- }
- devices_.clear();
-}
-
-bool MockDeviceScanner::IsInitialised() const {
- return is_initialized_;
-}
-
-void MockDeviceScanner::AddDevice(const std::string& name,
- const std::string& unique_id, bool start) {
- MockDevice* dev = new MockDevice(name, unique_id, controller_);
- dev->addApplication();
- if (start) {
- dev->Start();
- }
- devices_.push_back(dev);
-}
-
-void MockDeviceScanner::RemoveDevice(const std::string& name) {
- for (DeviceVector::iterator t = devices_.begin(); t != devices_.end(); ++t) {
- if ((*t)->name() == name) {
- devices_.erase(t);
- break;
- }
- }
-}
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
-
-// vim: set ts=2 sw=2 et:
diff --git a/src/components/transport_manager/test/tcp_client_listener_test.cc b/src/components/transport_manager/test/tcp_client_listener_test.cc
index 916f8bac58..f0c4b06b6c 100644
--- a/src/components/transport_manager/test/tcp_client_listener_test.cc
+++ b/src/components/transport_manager/test/tcp_client_listener_test.cc
@@ -33,7 +33,7 @@
#include "gtest/gtest.h"
#include "include/transport_adapter_mock.h"
#include "transport_manager/tcp/tcp_client_listener.h"
-#include "include/transport_manager_mock.h"
+#include "transport_manager/transport_manager_mock.h"
#include "transport_manager/transport_adapter/transport_adapter_controller.h"
#include "transport_manager/transport_adapter/device.h"
diff --git a/src/components/transport_manager/test/tcp_transport_adapter_test.cc b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
index d849d94d48..ecbbc6603b 100644
--- a/src/components/transport_manager/test/tcp_transport_adapter_test.cc
+++ b/src/components/transport_manager/test/tcp_transport_adapter_test.cc
@@ -85,7 +85,7 @@ class TcpAdapterTest : public ::testing::Test {
const std::string string_port = "12345";
};
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDeviceAndOneApplication) {
+TEST_F(TcpAdapterTest, StoreDataWithOneDeviceAndOneApplication) {
// Prepare
TestTCPTransportAdapter transport_adapter(port);
std::string uniq_id = "unique_device_name";
@@ -123,7 +123,7 @@ TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDeviceAndOneApplication) {
EXPECT_EQ(uniq_id, tcp_dict["devices"][0]["name"].asString());
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevicesAndOneApplication) {
+TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndOneApplication) {
// Prepare
TestTCPTransportAdapter transport_adapter(port);
const uint32_t count_dev = 10;
@@ -175,7 +175,7 @@ TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevicesAndOneApplication) {
}
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevicesAndSeveralApplications) {
+TEST_F(TcpAdapterTest, StoreDataWithSeveralDevicesAndSeveralApplications) {
// Prepare
TestTCPTransportAdapter transport_adapter(port);
const uint32_t count_dev = 10;
@@ -269,7 +269,7 @@ TEST_F(TcpAdapterTest, RestoreData_DataNotStored) {
EXPECT_TRUE(transport_adapter.CallRestore());
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDevice_RestoreData) {
+TEST_F(TcpAdapterTest, StoreDataWithOneDevice_RestoreData) {
TestTCPTransportAdapter transport_adapter(port);
std::string uniq_id = "unique_device_name";
utils::SharedPtr<TCPDeviceMock> mockdev = new TCPDeviceMock(port, uniq_id);
@@ -302,7 +302,7 @@ TEST_F(TcpAdapterTest, DISABLED_StoreDataWithOneDevice_RestoreData) {
EXPECT_EQ(uniq_id, devList[0]);
}
-TEST_F(TcpAdapterTest, DISABLED_StoreDataWithSeveralDevices_RestoreData) {
+TEST_F(TcpAdapterTest, StoreDataWithSeveralDevices_RestoreData) {
TestTCPTransportAdapter transport_adapter(port);
const uint32_t count_dev = 10;
diff --git a/src/components/transport_manager/test/transport_adapter_listener_test.cc b/src/components/transport_manager/test/transport_adapter_listener_test.cc
index 4d0ff4ec20..918304772a 100644
--- a/src/components/transport_manager/test/transport_adapter_listener_test.cc
+++ b/src/components/transport_manager/test/transport_adapter_listener_test.cc
@@ -33,7 +33,7 @@
#include "gtest/gtest.h"
#include "include/transport_adapter_mock.h"
#include "transport_manager/transport_adapter/transport_adapter_listener_impl.h"
-#include "include/transport_manager_mock.h"
+#include "transport_manager/transport_manager_mock.h"
namespace test {
namespace components {
@@ -52,7 +52,7 @@ class TransportAdapterListenerTest : public ::testing::Test {
protected:
const int app_handle;
const std::string dev_id;
- TransportManagerMock tr_mock;
+ MockTransportManager tr_mock;
TransportAdapterMock adapter_mock;
TransportAdapterListenerImpl transport_listener;
};
diff --git a/src/components/transport_manager/test/transport_manager_impl_test.cc b/src/components/transport_manager/test/transport_manager_impl_test.cc
index 8ee1d70887..62fb4875a3 100644
--- a/src/components/transport_manager/test/transport_manager_impl_test.cc
+++ b/src/components/transport_manager/test/transport_manager_impl_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,6 +30,7 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <string>
#include "gtest/gtest.h"
#include "protocol/raw_message.h"
#include "transport_manager/common.h"
@@ -38,9 +39,13 @@
#include "include/transport_adapter_mock.h"
#include "include/transport_manager_listener_mock.h"
#include "include/transport_adapter_listener_mock.h"
-#include "include/time_metric_observer_mock.h"
+#include "include/mock_telemetry_observer.h"
#include "transport_manager/transport_adapter/transport_adapter_event.h"
+#include "transport_manager/mock_transport_manager_impl.h"
+#include "telemetry_monitor/mock_telemetry_observer.h"
+#include "utils/make_shared.h"
+#include "utils/shared_ptr.h"
using ::testing::_;
using ::testing::AtLeast;
@@ -49,377 +54,407 @@ using ::testing::Return;
using ::protocol_handler::RawMessage;
using ::protocol_handler::RawMessagePtr;
+using utils::MakeShared;
+
namespace test {
namespace components {
namespace transport_manager_test {
-using namespace ::transport_manager;
-
-class TransportManagerTest : public TransportManagerImpl {
- public:
- void TestHandle(TransportAdapterEvent test_event) { Handle(test_event); }
-};
-
class TransportManagerImplTest : public ::testing::Test {
protected:
- virtual void SetUp() {
- tm.Init();
- mock_adapter = new TransportAdapterMock();
- tm_listener = new TransportManagerListenerMock();
-
- EXPECT_EQ(E_SUCCESS, tm.AddEventListener(tm_listener));
- EXPECT_CALL(*mock_adapter, AddListener(_));
- EXPECT_CALL(*mock_adapter, IsInitialised()).WillOnce(Return(true));
- EXPECT_EQ(::transport_manager::E_SUCCESS,
- tm.AddTransportAdapter(mock_adapter));
-
- device_handle_ = 1;
+ TransportManagerImplTest()
+ : device_handle_(1)
+ , mac_address_("MA:CA:DR:ES:S")
+ , dev_info_(device_handle_, mac_address_, "TestDeviceName", "BTMAC") {}
+
+ void SetUp() OVERRIDE {
+ mock_transport_manager_.Init();
+ mock_adapter_ = new TransportAdapterMock();
+ mock_transport_manager_listener_ = MakeShared<TransportManagerListenerMock>();
+
+#ifdef TELEMETRY_MONITOR
+ mock_transport_manager_.SetTelemetryObserver(&mock_metric_observer_);
+#endif // TELEMETRY_MONITOR
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.AddEventListener(mock_transport_manager_listener_.get()));
+ EXPECT_CALL(*mock_adapter_, AddListener(_));
+ EXPECT_CALL(*mock_adapter_, IsInitialised()).WillOnce(Return(true));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.AddTransportAdapter(mock_adapter_));
+
connection_key_ = 1;
- mac_address_ = "MA:CA:DR:ES:S";
- error_ = new BaseError();
+ error_ = MakeShared<BaseError>();
const unsigned int version_protocol_ = 1;
const unsigned int kSize = 12;
- unsigned char data[kSize] = {0x20, 0x07, 0x01, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
+ unsigned char data[kSize] = {
+ 0x20, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
test_message_ =
- new RawMessage(connection_key_, version_protocol_, data, kSize);
+ MakeShared<RawMessage>(connection_key_, version_protocol_, data, kSize);
}
- virtual void TearDown() { delete tm_listener; }
-
- void HandleDeviceListUpdated();
- void HandleConnection();
- void HandleSendDone();
- void HandleSendFailed();
- void HandleSearchDone();
- void HandleSearchFail();
- void HandleFindNewApplicationsRequest();
- void HandleConnectionFailed();
- void HandleConnectionClosed();
- void HandleDisconnectionFailed();
- void HandleReceiveDone();
-
- TransportManagerTest tm;
- TransportAdapterMock* mock_adapter;
-
- TransportManagerListenerMock* tm_listener;
-
- const ApplicationHandle application_id = 1;
-
- // count of connections
- ConnectionUID connection_key_;
- RawMessagePtr test_message_;
- DeviceHandle device_handle_;
- std::string mac_address_;
-
- DeviceList dev;
- BaseErrorPtr error_;
-};
-
-void TransportManagerImplTest::HandleDeviceListUpdated() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED);
- const DeviceInfo dev_info(device_handle_, mac_address_, "TestDeviceName",
- "BTMAC");
-
- TransportAdapterEvent test_event(type, mock_adapter, dev_info.mac_address(),
- application_id, test_message_, error_);
- dev.push_back(dev_info.mac_address());
- std::vector<DeviceInfo> vector_dev_info;
- std::vector<DeviceInfo>::iterator it = vector_dev_info.begin();
- vector_dev_info.insert(it, dev_info);
-
- EXPECT_CALL(*mock_adapter, GetDeviceList())
- .Times(AtLeast(1))
- .WillRepeatedly(Return(dev));
- EXPECT_CALL(*mock_adapter, DeviceName(dev_info.mac_address()))
- .Times(AtLeast(1))
- .WillRepeatedly(Return(dev_info.name()));
- EXPECT_CALL(*mock_adapter, GetConnectionType())
- .Times(AtLeast(1))
- .WillRepeatedly(Return(dev_info.connection_type()));
-
- EXPECT_CALL(*tm_listener, OnDeviceFound(dev_info));
- EXPECT_CALL(*tm_listener, OnDeviceAdded(dev_info));
- EXPECT_CALL(*tm_listener, OnDeviceListUpdated(vector_dev_info));
-
- tm.TestHandle(test_event);
- dev.pop_back();
-}
-
-void TransportManagerImplTest::HandleConnection() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE);
- const DeviceInfo dev_info(device_handle_, mac_address_, "TestDeviceName",
- "BTMAC");
+ void HandleDeviceListUpdated() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED);
+
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_,
+ test_message_,
+ error_);
+ device_list_.push_back(dev_info_.mac_address());
+ std::vector<DeviceInfo> vector_dev_info;
+ vector_dev_info.push_back(dev_info_);
+
+ EXPECT_CALL(*mock_adapter_, GetDeviceList())
+ .Times(AtLeast(1))
+ .WillRepeatedly(Return(device_list_));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .Times(AtLeast(1))
+ .WillRepeatedly(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .Times(AtLeast(1))
+ .WillRepeatedly(Return(dev_info_.connection_type()));
+
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceFound(dev_info_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceListUpdated(vector_dev_info));
+
+ mock_transport_manager_.TestHandle(test_event);
+ device_list_.pop_back();
+ }
- TransportAdapterEvent test_event(type, mock_adapter, dev_info.mac_address(),
- application_id, test_message_, error_);
+ void HandleConnection() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_DONE);
- EXPECT_CALL(*mock_adapter, DeviceName(dev_info.mac_address()))
- .WillOnce(Return(dev_info.name()));
- EXPECT_CALL(*mock_adapter, GetConnectionType())
- .WillOnce(Return(dev_info.connection_type()));
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_,
+ test_message_,
+ error_);
- EXPECT_CALL(*tm_listener, OnConnectionEstablished(dev_info, connection_key_));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
- tm.TestHandle(test_event);
-}
+ EXPECT_CALL(*mock_transport_manager_listener_,
+ OnConnectionEstablished(dev_info_, connection_key_));
-void TransportManagerImplTest::HandleConnectionFailed() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL);
+ mock_transport_manager_.TestHandle(test_event);
+ }
- const DeviceInfo dev_info(device_handle_, mac_address_, "TestDeviceName",
- "BTMAC");
+ void HandleConnectionFailed() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_CONNECT_FAIL);
- TransportAdapterEvent test_event(type, mock_adapter, dev_info.mac_address(),
- application_id, test_message_, error_);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_,
+ test_message_,
+ error_);
- EXPECT_CALL(*mock_adapter, DeviceName(dev_info.mac_address()))
- .WillOnce(Return(dev_info.name()));
- EXPECT_CALL(*mock_adapter, GetConnectionType())
- .WillOnce(Return(dev_info.connection_type()));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
- EXPECT_CALL(*tm_listener, OnConnectionFailed(dev_info, _));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnConnectionFailed(dev_info_, _));
- tm.TestHandle(test_event);
-}
+ mock_transport_manager_.TestHandle(test_event);
+ }
-void TransportManagerImplTest::HandleSendDone() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE);
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ void HandleSendDone() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StopRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSend(test_message_));
+
+ mock_transport_manager_.TestHandle(test_event);
+ }
- EXPECT_CALL(*tm_listener, OnTMMessageSend(test_message_));
+ void HandleReceiveDone() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StopRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageReceived(test_message_));
+
+ mock_transport_manager_.TestHandle(test_event);
+ }
- tm.TestHandle(test_event);
-}
+ void HandleSendFailed() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL);
+
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StopRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ mock_transport_manager_.TestHandle(test_event);
+ }
-void TransportManagerImplTest::HandleReceiveDone() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE);
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ void HandleSearchDone() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE);
- EXPECT_CALL(*tm_listener, OnTMMessageReceived(test_message_));
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
- tm.TestHandle(test_event);
-}
+ EXPECT_CALL(*mock_transport_manager_listener_, OnScanDevicesFinished());
-void TransportManagerImplTest::HandleSendFailed() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_FAIL);
+ mock_transport_manager_.TestHandle(test_event);
+ }
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ void HandleSearchFail() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL);
- tm.TestHandle(test_event);
-}
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
-void TransportManagerImplTest::HandleSearchDone() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnScanDevicesFailed(_));
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ mock_transport_manager_.TestHandle(test_event);
+ }
- EXPECT_CALL(*tm_listener, OnScanDevicesFinished());
+ void HandleFindNewApplicationsRequest() {
+ const int type =
+ static_cast<int>(TransportAdapterListenerImpl::EventTypeEnum::
+ ON_FIND_NEW_APPLICATIONS_REQUEST);
- tm.TestHandle(test_event);
-}
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
-void TransportManagerImplTest::HandleSearchFail() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnFindNewApplicationsRequest());
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ mock_transport_manager_.TestHandle(test_event);
+ }
- EXPECT_CALL(*tm_listener, OnScanDevicesFailed(_));
+ void HandleConnectionClosed() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE);
- tm.TestHandle(test_event);
-}
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
-void TransportManagerImplTest::HandleFindNewApplicationsRequest() {
- int type = static_cast<int>(TransportAdapterListenerImpl::EventTypeEnum::
- ON_FIND_NEW_APPLICATIONS_REQUEST);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnConnectionClosed(application_id_));
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ mock_transport_manager_.TestHandle(test_event);
+ }
- EXPECT_CALL(*tm_listener, OnFindNewApplicationsRequest());
+ void HandleDisconnectionFailed() {
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL);
- tm.TestHandle(test_event);
-}
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
-void TransportManagerImplTest::HandleConnectionClosed() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDisconnectFailed(device_handle_, _));
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ mock_transport_manager_.TestHandle(test_event);
+ }
- EXPECT_CALL(*tm_listener, OnConnectionClosed(application_id));
+ void UninitializeTM() {
+ EXPECT_CALL(*mock_adapter_, Terminate());
+ ASSERT_EQ(E_SUCCESS, mock_transport_manager_.Stop());
+ }
- tm.TestHandle(test_event);
-}
+ MockTransportManagerImpl mock_transport_manager_;
+#ifdef TELEMETRY_MONITOR
+ TMTelemetryObserverMock mock_metric_observer_;
+#endif // TELEMETRY_MONITOR
+ TransportAdapterMock* mock_adapter_;
-void TransportManagerImplTest::HandleDisconnectionFailed() {
- int type = static_cast<int>(
- TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_FAIL);
+ utils::SharedPtr<TransportManagerListenerMock> mock_transport_manager_listener_;
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ const ApplicationHandle application_id_ = 1;
- EXPECT_CALL(*tm_listener, OnDisconnectFailed(device_handle_, _));
+ ConnectionUID connection_key_;
+ RawMessagePtr test_message_;
+ DeviceHandle device_handle_;
+ std::string mac_address_;
- tm.TestHandle(test_event);
-}
+ const DeviceInfo dev_info_;
+ DeviceList device_list_;
+ BaseErrorPtr error_;
+};
TEST(TransportManagerTest, SearchDevices_AdaptersNotAdded) {
- TransportManagerTest tm;
+ MockTransportManagerImpl tm;
tm.Init();
EXPECT_EQ(E_SUCCESS, tm.SearchDevices());
}
TEST(TransportManagerTest, AddTransportAdapter) {
- TransportManagerTest tm;
+ MockTransportManagerImpl tm;
tm.Init();
TransportAdapterMock* mock_adapter = new TransportAdapterMock();
- TransportManagerListenerMock* tm_listener =
- new TransportManagerListenerMock();
+ utils::SharedPtr<TransportManagerListenerMock> mock_transport_manager_listener =
+ MakeShared<TransportManagerListenerMock>();
- EXPECT_EQ(E_SUCCESS, tm.AddEventListener(tm_listener));
+ EXPECT_EQ(E_SUCCESS, tm.AddEventListener(mock_transport_manager_listener.get()));
EXPECT_CALL(*mock_adapter, AddListener(_));
EXPECT_CALL(*mock_adapter, IsInitialised()).WillOnce(Return(false));
EXPECT_CALL(*mock_adapter, Init()).WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(::transport_manager::E_SUCCESS,
- tm.AddTransportAdapter(mock_adapter));
+ EXPECT_EQ(E_SUCCESS, tm.AddTransportAdapter(mock_adapter));
}
TEST_F(TransportManagerImplTest, AddTransportAdapterSecondTime) {
- EXPECT_EQ(E_ADAPTER_EXISTS, tm.AddTransportAdapter(mock_adapter));
+ EXPECT_EQ(E_ADAPTER_EXISTS, mock_transport_manager_.AddTransportAdapter(mock_adapter_));
}
TEST_F(TransportManagerImplTest, ConnectDevice) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.ConnectDevice(device_handle_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.ConnectDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, ConnectDevice_DeviceNotHandled) {
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_)).Times(0);
- EXPECT_EQ(E_INVALID_HANDLE, tm.ConnectDevice(device_handle_));
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_)).Times(0);
+ EXPECT_EQ(E_INVALID_HANDLE, mock_transport_manager_.ConnectDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, ConnectDevice_DeviceNotConnected) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_EQ(E_INTERNAL_ERROR, tm.ConnectDevice(device_handle_));
+ EXPECT_EQ(E_INTERNAL_ERROR, mock_transport_manager_.ConnectDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, DisconnectDevice) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.ConnectDevice(device_handle_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.ConnectDevice(device_handle_));
- EXPECT_CALL(*mock_adapter, DisconnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, DisconnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.DisconnectDevice(device_handle_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.DisconnectDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, DisconnectDevice_ConnectionFailed) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_EQ(E_INTERNAL_ERROR, tm.ConnectDevice(device_handle_));
+ EXPECT_EQ(E_INTERNAL_ERROR, mock_transport_manager_.ConnectDevice(device_handle_));
- EXPECT_CALL(*mock_adapter, DisconnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, DisconnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_EQ(E_INTERNAL_ERROR, tm.DisconnectDevice(device_handle_));
+ // Even with fail, we get Success
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.DisconnectDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, DisconnectDevice_DeviceNotConnected) {
- EXPECT_CALL(*mock_adapter, DisconnectDevice(mac_address_)).Times(0);
- EXPECT_EQ(E_INVALID_HANDLE, tm.DisconnectDevice(device_handle_));
+ EXPECT_CALL(*mock_adapter_, DisconnectDevice(mac_address_)).Times(0);
+ EXPECT_EQ(E_INVALID_HANDLE, mock_transport_manager_.DisconnectDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, Disconnect) {
// Arrange
HandleConnection();
- EXPECT_CALL(*mock_adapter, Disconnect(mac_address_, application_id))
+ EXPECT_CALL(*mock_adapter_, Disconnect(mac_address_, application_id_))
.WillOnce(Return(TransportAdapter::OK));
// Assert
- EXPECT_EQ(E_SUCCESS, tm.Disconnect(connection_key_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Disconnect(connection_key_));
}
TEST_F(TransportManagerImplTest, Disconnect_DisconnectionFailed) {
// Arrange
HandleConnection();
- EXPECT_CALL(*mock_adapter, Disconnect(mac_address_, application_id))
+ EXPECT_CALL(*mock_adapter_, Disconnect(mac_address_, application_id_))
.WillOnce(Return(TransportAdapter::FAIL));
// Assert
- EXPECT_EQ(E_INTERNAL_ERROR, tm.Disconnect(connection_key_));
+ // Even with fail, we get Success
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Disconnect(connection_key_));
}
TEST_F(TransportManagerImplTest, Disconnect_ConnectionNotExist) {
- EXPECT_CALL(*mock_adapter, Disconnect(mac_address_, application_id)).Times(0);
+ EXPECT_CALL(*mock_adapter_, Disconnect(mac_address_, application_id_))
+ .Times(0);
// Assert
- EXPECT_EQ(E_INVALID_HANDLE, tm.Disconnect(connection_key_));
+ EXPECT_EQ(E_INVALID_HANDLE, mock_transport_manager_.Disconnect(connection_key_));
}
TEST_F(TransportManagerImplTest, Disconnect_ConnectionDoesNotExists) {
// Arrange
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillRepeatedly(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.ConnectDevice(device_handle_));
-
- EXPECT_CALL(*mock_adapter, Disconnect(mac_address_, application_id))
- .WillRepeatedly(Return(TransportAdapter::OK));
- // Assert
- EXPECT_EQ(E_INVALID_HANDLE, tm.Disconnect(connection_key_));
-}
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.ConnectDevice(device_handle_));
-TEST_F(TransportManagerImplTest, DisconnectForce) {
- // Arrange
- HandleConnection();
-
- EXPECT_CALL(*mock_adapter, Disconnect(mac_address_, application_id))
+ EXPECT_CALL(*mock_adapter_, Disconnect(mac_address_, application_id_))
.WillRepeatedly(Return(TransportAdapter::OK));
// Assert
- EXPECT_EQ(E_SUCCESS, tm.DisconnectForce(connection_key_));
+ EXPECT_EQ(E_INVALID_HANDLE, mock_transport_manager_.Disconnect(connection_key_));
}
-TEST_F(TransportManagerImplTest, DisconnectForce_) {
+TEST_F(TransportManagerImplTest, DisconnectForce_TMIsInitialized) {
// Arrange
HandleConnection();
- EXPECT_CALL(*mock_adapter, Disconnect(mac_address_, application_id))
+ EXPECT_CALL(*mock_adapter_, Disconnect(mac_address_, application_id_))
.WillRepeatedly(Return(TransportAdapter::OK));
// Assert
- EXPECT_EQ(E_SUCCESS, tm.DisconnectForce(connection_key_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.DisconnectForce(connection_key_));
}
TEST_F(TransportManagerImplTest, SearchDevices_DeviceConnected) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, SearchDevices())
+ EXPECT_CALL(*mock_adapter_, SearchDevices())
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.SearchDevices());
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.SearchDevices());
HandleSearchDone();
}
@@ -427,57 +462,56 @@ TEST_F(TransportManagerImplTest, SearchDevices_DeviceConnected) {
TEST_F(TransportManagerImplTest, SearchDevices_DeviceNotFound) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, SearchDevices())
+ EXPECT_CALL(*mock_adapter_, SearchDevices())
.WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_EQ(E_ADAPTERS_FAIL, tm.SearchDevices());
+ EXPECT_EQ(E_ADAPTERS_FAIL, mock_transport_manager_.SearchDevices());
}
TEST_F(TransportManagerImplTest, SearchDevices_AdapterNotSupported) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, SearchDevices())
+ EXPECT_CALL(*mock_adapter_, SearchDevices())
.WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
- EXPECT_EQ(E_ADAPTERS_FAIL, tm.SearchDevices());
+ EXPECT_EQ(E_ADAPTERS_FAIL, mock_transport_manager_.SearchDevices());
}
TEST_F(TransportManagerImplTest, SearchDevices_AdapterWithBadState) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, SearchDevices())
+ EXPECT_CALL(*mock_adapter_, SearchDevices())
.WillOnce(Return(TransportAdapter::BAD_STATE));
- EXPECT_EQ(E_ADAPTERS_FAIL, tm.SearchDevices());
+ EXPECT_EQ(E_ADAPTERS_FAIL, mock_transport_manager_.SearchDevices());
}
TEST_F(TransportManagerImplTest, SendMessageToDevice) {
// Arrange
HandleConnection();
- EXPECT_CALL(*mock_adapter,
- SendData(mac_address_, application_id, test_message_))
+ EXPECT_CALL(*mock_adapter_,
+ SendData(mac_address_, application_id_, test_message_))
.WillOnce(Return(TransportAdapter::OK));
-
- EXPECT_EQ(E_SUCCESS, tm.SendMessageToDevice(test_message_));
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.SendMessageToDevice(test_message_));
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(TransportManagerImplTest, SendMessageToDevice_SendingFailed) {
// Arrange
HandleConnection();
-
- TMMetricObserverMock* mock_metric_observer = new TMMetricObserverMock();
- tm.SetTimeMetricObserver(mock_metric_observer);
- EXPECT_CALL(*mock_metric_observer, StartRawMsg(_));
-
- EXPECT_CALL(*mock_adapter,
- SendData(mac_address_, application_id, test_message_))
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_CALL(*mock_adapter_,
+ SendData(mac_address_, application_id_, test_message_))
.WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_CALL(*tm_listener, OnTMMessageSendFailed(_, test_message_));
- EXPECT_EQ(E_SUCCESS, tm.SendMessageToDevice(test_message_));
-
- EXPECT_CALL(*mock_metric_observer, StopRawMsg(_)).Times(0);
-
- delete mock_metric_observer;
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSendFailed(_, test_message_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.SendMessageToDevice(test_message_));
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StopRawMsg(_)).Times(0);
+#endif // TELEMETRY_MONITOR
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
@@ -485,15 +519,13 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_StartTimeObserver) {
// Arrange
HandleConnection();
- TMMetricObserverMock* mock_metric_observer = new TMMetricObserverMock();
- tm.SetTimeMetricObserver(mock_metric_observer);
- EXPECT_CALL(*mock_adapter,
- SendData(mac_address_, application_id, test_message_))
+ EXPECT_CALL(*mock_adapter_,
+ SendData(mac_address_, application_id_, test_message_))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_CALL(*mock_metric_observer, StartRawMsg(_));
-
- EXPECT_EQ(E_SUCCESS, tm.SendMessageToDevice(test_message_));
- delete mock_metric_observer;
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.SendMessageToDevice(test_message_));
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
@@ -501,195 +533,183 @@ TEST_F(TransportManagerImplTest, SendMessageToDevice_SendDone) {
// Arrange
HandleConnection();
- TMMetricObserverMock* mock_metric_observer = new TMMetricObserverMock();
- tm.SetTimeMetricObserver(mock_metric_observer);
- EXPECT_CALL(*mock_adapter,
- SendData(mac_address_, application_id, test_message_))
+ EXPECT_CALL(*mock_adapter_,
+ SendData(mac_address_, application_id_, test_message_))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_CALL(*mock_metric_observer, StartRawMsg(_));
-
- EXPECT_EQ(E_SUCCESS, tm.SendMessageToDevice(test_message_));
-
- EXPECT_CALL(*mock_metric_observer, StopRawMsg(_));
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.SendMessageToDevice(test_message_));
HandleSendDone();
- delete mock_metric_observer;
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(TransportManagerImplTest, SendMessageFailed_GetHandleSendFailed) {
// Arrange
HandleConnection();
-
- TMMetricObserverMock* mock_metric_observer = new TMMetricObserverMock();
- tm.SetTimeMetricObserver(mock_metric_observer);
- EXPECT_CALL(*mock_metric_observer, StartRawMsg(_));
-
- EXPECT_CALL(*mock_adapter,
- SendData(mac_address_, application_id, test_message_))
+#ifdef TELEMETRY_MONITOR
+ EXPECT_CALL(mock_metric_observer_, StartRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_CALL(*mock_adapter_,
+ SendData(mac_address_, application_id_, test_message_))
.WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_CALL(*tm_listener, OnTMMessageSendFailed(_, test_message_));
- EXPECT_EQ(E_SUCCESS, tm.SendMessageToDevice(test_message_));
-
- EXPECT_CALL(*mock_metric_observer, StopRawMsg(_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSendFailed(_, test_message_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.SendMessageToDevice(test_message_));
HandleSendFailed();
- delete mock_metric_observer;
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(TransportManagerImplTest, RemoveDevice_DeviceWasAdded) {
// Arrange
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.ConnectDevice(device_handle_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.ConnectDevice(device_handle_));
// Assert
- EXPECT_EQ(E_SUCCESS, tm.RemoveDevice(device_handle_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.RemoveDevice(device_handle_));
}
TEST_F(TransportManagerImplTest, SetVisibilityOn_StartClientListening) {
- EXPECT_CALL(*mock_adapter, StartClientListening())
+ EXPECT_CALL(*mock_adapter_, StartClientListening())
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(::transport_manager::E_SUCCESS, tm.Visibility(true));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Visibility(true));
}
TEST_F(TransportManagerImplTest, SetVisibilityOff_StopClientListening) {
- EXPECT_CALL(*mock_adapter, StopClientListening())
+ EXPECT_CALL(*mock_adapter_, StopClientListening())
.WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(::transport_manager::E_SUCCESS, tm.Visibility(false));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Visibility(false));
}
TEST_F(TransportManagerImplTest, StopTransportManager) {
HandleDeviceListUpdated();
- EXPECT_CALL(*mock_adapter, ConnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(mac_address_))
.WillRepeatedly(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.ConnectDevice(device_handle_));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.ConnectDevice(device_handle_));
- EXPECT_CALL(*mock_adapter, DisconnectDevice(mac_address_))
+ EXPECT_CALL(*mock_adapter_, DisconnectDevice(mac_address_))
.WillRepeatedly(Return(TransportAdapter::OK));
- EXPECT_CALL(*mock_adapter, Terminate());
- EXPECT_EQ(E_SUCCESS, tm.Stop());
+ EXPECT_CALL(*mock_adapter_, Terminate());
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Stop());
}
TEST_F(TransportManagerImplTest, Reinit) {
- EXPECT_CALL(*mock_adapter, Terminate());
- EXPECT_CALL(*mock_adapter, Init()).WillOnce(Return(TransportAdapter::OK));
- EXPECT_EQ(E_SUCCESS, tm.Reinit());
+ EXPECT_CALL(*mock_adapter_, Terminate());
+ EXPECT_CALL(*mock_adapter_, Init()).WillOnce(Return(TransportAdapter::OK));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Reinit());
}
TEST_F(TransportManagerImplTest, Reinit_InitAdapterFailed) {
- EXPECT_CALL(*mock_adapter, Terminate());
- EXPECT_CALL(*mock_adapter, Init()).WillOnce(Return(TransportAdapter::FAIL));
- EXPECT_EQ(E_ADAPTERS_FAIL, tm.Reinit());
+ EXPECT_CALL(*mock_adapter_, Terminate());
+ EXPECT_CALL(*mock_adapter_, Init()).WillOnce(Return(TransportAdapter::FAIL));
+ EXPECT_EQ(E_ADAPTERS_FAIL, mock_transport_manager_.Reinit());
}
TEST_F(TransportManagerImplTest, UpdateDeviceList_AddNewDevice) {
- const DeviceInfo dev_info(device_handle_, mac_address_, "TestDeviceName",
- "BTMAC");
+ device_list_.push_back(dev_info_.mac_address());
- dev.push_back(dev_info.mac_address());
- std::vector<DeviceInfo> vector_dev_info;
- std::vector<DeviceInfo>::iterator it = vector_dev_info.begin();
- vector_dev_info.insert(it, dev_info);
+ EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
- EXPECT_CALL(*mock_adapter, GetDeviceList()).WillOnce(Return(dev));
- EXPECT_CALL(*mock_adapter, DeviceName(dev_info.mac_address()))
- .WillOnce(Return(dev_info.name()));
- EXPECT_CALL(*mock_adapter, GetConnectionType())
- .WillOnce(Return(dev_info.connection_type()));
- EXPECT_CALL(*tm_listener, OnDeviceAdded(dev_info));
-
- tm.UpdateDeviceList(mock_adapter);
- dev.pop_back();
+ mock_transport_manager_.UpdateDeviceList(mock_adapter_);
+ device_list_.pop_back();
}
TEST_F(TransportManagerImplTest, UpdateDeviceList_RemoveDevice) {
- const DeviceInfo dev_info(device_handle_, mac_address_, "TestDeviceName",
- "BTMAC");
-
- dev.push_back(dev_info.mac_address());
- std::vector<DeviceInfo> vector_dev_info;
- std::vector<DeviceInfo>::iterator it = vector_dev_info.begin();
- vector_dev_info.insert(it, dev_info);
+ device_list_.push_back(dev_info_.mac_address());
::testing::InSequence seq;
- EXPECT_CALL(*mock_adapter, GetDeviceList()).WillOnce(Return(dev));
- EXPECT_CALL(*mock_adapter, GetConnectionType())
- .WillOnce(Return(dev_info.connection_type()));
- EXPECT_CALL(*mock_adapter, DeviceName(dev_info.mac_address()))
- .WillOnce(Return(dev_info.name()));
- EXPECT_CALL(*tm_listener, OnDeviceAdded(dev_info));
- tm.UpdateDeviceList(mock_adapter);
- dev.pop_back();
+ EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(mock_adapter_);
+ device_list_.pop_back();
// Device list is empty now
- EXPECT_CALL(*mock_adapter, GetDeviceList()).WillOnce(Return(dev));
- EXPECT_CALL(*tm_listener, OnDeviceRemoved(dev_info));
- tm.UpdateDeviceList(mock_adapter);
+ EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceRemoved(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(mock_adapter_);
}
/*
* Tests which check correct handling and receiving events
*/
TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceDone) {
- int type = static_cast<int>(
+ const int type = static_cast<int>(
TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE);
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
- EXPECT_CALL(*tm_listener, OnScanDevicesFinished());
+ EXPECT_CALL(*mock_transport_manager_listener_, OnScanDevicesFinished());
- tm.ReceiveEventFromDevice(test_event);
+ mock_transport_manager_.TestReceiveEventFromDevice(test_event);
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_OnSearchDeviceFail) {
- int type = static_cast<int>(
+ const int type = static_cast<int>(
TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_FAIL);
- TransportAdapterEvent test_event(type, mock_adapter, mac_address_,
- application_id, test_message_, error_);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
- EXPECT_CALL(*tm_listener, OnScanDevicesFailed(_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnScanDevicesFailed(_));
- tm.ReceiveEventFromDevice(test_event);
+ mock_transport_manager_.TestReceiveEventFromDevice(test_event);
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_DeviceListUpdated) {
- int type = static_cast<int>(
+ const int type = static_cast<int>(
TransportAdapterListenerImpl::EventTypeEnum::ON_DEVICE_LIST_UPDATED);
- const DeviceInfo dev_info(device_handle_, mac_address_, "TestDeviceName",
- "BTMAC");
- TransportAdapterEvent test_event(type, mock_adapter, dev_info.mac_address(),
- application_id, test_message_, error_);
- dev.push_back(dev_info.mac_address());
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ dev_info_.mac_address(),
+ application_id_,
+ test_message_,
+ error_);
+ device_list_.push_back(dev_info_.mac_address());
std::vector<DeviceInfo> vector_dev_info;
- std::vector<DeviceInfo>::iterator it = vector_dev_info.begin();
- vector_dev_info.insert(it, dev_info);
+ vector_dev_info.push_back(dev_info_);
- EXPECT_CALL(*mock_adapter, GetDeviceList())
+ EXPECT_CALL(*mock_adapter_, GetDeviceList())
.Times(AtLeast(1))
- .WillRepeatedly(Return(dev));
- EXPECT_CALL(*mock_adapter, DeviceName(dev_info.mac_address()))
+ .WillRepeatedly(Return(device_list_));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
.Times(AtLeast(1))
- .WillRepeatedly(Return(dev_info.name()));
- EXPECT_CALL(*mock_adapter, GetConnectionType())
+ .WillRepeatedly(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
.Times(AtLeast(1))
- .WillRepeatedly(Return(dev_info.connection_type()));
+ .WillRepeatedly(Return(dev_info_.connection_type()));
- EXPECT_CALL(*tm_listener, OnDeviceFound(dev_info));
- EXPECT_CALL(*tm_listener, OnDeviceAdded(dev_info));
- EXPECT_CALL(*tm_listener, OnDeviceListUpdated(vector_dev_info));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceFound(dev_info_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceListUpdated(vector_dev_info));
- tm.ReceiveEventFromDevice(test_event);
- dev.pop_back();
+ mock_transport_manager_.TestReceiveEventFromDevice(test_event);
+ device_list_.pop_back();
testing::Mock::AsyncVerifyAndClearExpectations(10000);
}
@@ -712,6 +732,331 @@ TEST_F(TransportManagerImplTest, CheckReceiveEvent) {
HandleReceiveDone();
}
+TEST_F(TransportManagerImplTest, CheckReceiveFailedEvent) {
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL);
+
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+ // Check before act
+ HandleConnection();
+ // Act and Assert
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageReceiveFailed(_));
+ mock_transport_manager_.TestHandle(test_event);
+}
+
+TEST_F(TransportManagerImplTest, CheckUnexpectedDisconnect) {
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT);
+
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+ // Check before act
+ HandleConnection();
+ // Act and Assert
+ EXPECT_CALL(*mock_transport_manager_listener_, OnUnexpectedDisconnect(connection_key_, _));
+ mock_transport_manager_.TestHandle(test_event);
+}
+
+TEST_F(TransportManagerImplTest, ConnectDevice_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, ConnectDevice(_)).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.ConnectDevice(device_handle_));
+}
+
+TEST_F(TransportManagerImplTest, DisconnectDevice_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, DisconnectDevice(_)).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.DisconnectDevice(device_handle_));
+}
+
+TEST_F(TransportManagerImplTest, Disconnect_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, Disconnect(_, _)).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.Disconnect(connection_key_));
+}
+
+TEST_F(TransportManagerImplTest, DisconnectForce_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, Disconnect(_, _)).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.DisconnectForce(connection_key_));
+}
+
+TEST_F(TransportManagerImplTest, DisconnectForce_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, Disconnect(_, _)).Times(0);
+ EXPECT_EQ(E_INVALID_HANDLE, mock_transport_manager_.DisconnectForce(connection_key_));
+}
+
+TEST_F(TransportManagerImplTest, Stop_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, DisconnectDevice(_)).Times(0);
+ EXPECT_CALL(*mock_adapter_, Terminate()).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.Stop());
+}
+
+TEST_F(TransportManagerImplTest, SendMessageToDevice_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, SendData(_, _, _)).Times(0);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSendFailed(_, _)).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.SendMessageToDevice(test_message_));
+}
+
+TEST_F(TransportManagerImplTest, SendMessageToDevice_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, SendData(_, _, _)).Times(0);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSendFailed(_, _)).Times(0);
+ EXPECT_EQ(E_INVALID_HANDLE, mock_transport_manager_.SendMessageToDevice(test_message_));
+}
+
+TEST_F(TransportManagerImplTest, ReceiveEventFromDevice_TMIsNotInitialized) {
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_SEARCH_DONE);
+ TransportAdapterEvent test_event(
+ type, NULL, mac_address_, application_id_, test_message_, error_);
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_transport_manager_listener_, OnScanDevicesFinished()).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.ReceiveEventFromDevice(test_event));
+}
+
+TEST_F(TransportManagerImplTest, RemoveDevice_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.RemoveDevice(device_handle_));
+}
+
+TEST_F(TransportManagerImplTest, Visibility_TMIsNotInitialized) {
+ // Arrange
+ const bool visible = true;
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, StartClientListening()).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.Visibility(visible));
+}
+
+TEST_F(TransportManagerImplTest, HandleMessage_ConnectionNotExist) {
+ EXPECT_CALL(*mock_adapter_,
+ SendData(mac_address_, application_id_, test_message_)).Times(0);
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSendFailed(_, test_message_));
+
+ mock_transport_manager_.TestHandle(test_message_);
+ testing::Mock::AsyncVerifyAndClearExpectations(10000);
+}
+
+TEST_F(TransportManagerImplTest, SearchDevices_TMIsNotInitialized) {
+ // Check before Act
+ UninitializeTM();
+ // Act and Assert
+ EXPECT_CALL(*mock_adapter_, SearchDevices()).Times(0);
+ EXPECT_EQ(E_TM_IS_NOT_INITIALIZED, mock_transport_manager_.SearchDevices());
+}
+
+TEST_F(TransportManagerImplTest, SetVisibilityOn_TransportAdapterNotSupported) {
+ EXPECT_CALL(*mock_adapter_, StartClientListening())
+ .WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Visibility(true));
+}
+
+TEST_F(TransportManagerImplTest,
+ SetVisibilityOff_TransportAdapterNotSupported) {
+ EXPECT_CALL(*mock_adapter_, StopClientListening())
+ .WillOnce(Return(TransportAdapter::NOT_SUPPORTED));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.Visibility(false));
+}
+
+TEST_F(TransportManagerImplTest,
+ UpdateDeviceList_AddDevices_TwoTransportAdapters) {
+ // Arrange
+ TransportAdapterMock* second_mock_adapter = new TransportAdapterMock();
+ device_list_.push_back(dev_info_.mac_address());
+ // Check before Act
+ EXPECT_CALL(*second_mock_adapter, AddListener(_));
+ EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.AddTransportAdapter(second_mock_adapter));
+
+ // Act and Assert
+ EXPECT_CALL(*second_mock_adapter, GetDeviceList())
+ .WillOnce(Return(device_list_));
+ EXPECT_CALL(*second_mock_adapter, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*second_mock_adapter, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(second_mock_adapter);
+
+ EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(mock_adapter_);
+
+ device_list_.pop_back();
+}
+
+TEST_F(TransportManagerImplTest,
+ UpdateDeviceList_RemoveDevices_TwoTransportAdapters) {
+ // Arrange
+ TransportAdapterMock* second_mock_adapter = new TransportAdapterMock();
+ device_list_.push_back(dev_info_.mac_address());
+ // Check before Act
+ EXPECT_CALL(*second_mock_adapter, AddListener(_));
+ EXPECT_CALL(*second_mock_adapter, IsInitialised()).WillOnce(Return(true));
+ EXPECT_EQ(E_SUCCESS, mock_transport_manager_.AddTransportAdapter(second_mock_adapter));
+
+ // Act and Assert
+ EXPECT_CALL(*second_mock_adapter, GetDeviceList())
+ .WillOnce(Return(device_list_));
+ EXPECT_CALL(*second_mock_adapter, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*second_mock_adapter, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(second_mock_adapter);
+
+ EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_adapter_, DeviceName(dev_info_.mac_address()))
+ .WillOnce(Return(dev_info_.name()));
+ EXPECT_CALL(*mock_adapter_, GetConnectionType())
+ .WillOnce(Return(dev_info_.connection_type()));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceAdded(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(mock_adapter_);
+
+ device_list_.pop_back();
+
+ EXPECT_CALL(*second_mock_adapter, GetDeviceList())
+ .WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceRemoved(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(second_mock_adapter);
+
+ EXPECT_CALL(*mock_adapter_, GetDeviceList()).WillOnce(Return(device_list_));
+ EXPECT_CALL(*mock_transport_manager_listener_, OnDeviceRemoved(dev_info_));
+ mock_transport_manager_.UpdateDeviceList(mock_adapter_);
+}
+
+TEST_F(TransportManagerImplTest,
+ CheckEventOnDisconnectDone_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_DISCONNECT_DONE);
+
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+
+ // Act and Assert
+ EXPECT_CALL(*mock_transport_manager_listener_, OnConnectionClosed(_)).Times(0);
+
+ mock_transport_manager_.TestHandle(test_event);
+}
+
+TEST_F(TransportManagerImplTest, CheckEventOnSendDone_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_SEND_DONE);
+
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+#ifdef TELEMETRY_MONITOR
+ // Act and Assert
+ EXPECT_CALL(mock_metric_observer_, StopRawMsg(_));
+#endif // TELEMETRY_MONITOR
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageSend(_)).Times(0);
+
+ mock_transport_manager_.TestHandle(test_event);
+}
+
+TEST_F(TransportManagerImplTest, CheckEventOnReceivedDone_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_DONE);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+#ifdef TELEMETRY_MONITOR
+ // Act and Assert
+ EXPECT_CALL(mock_metric_observer_, StopRawMsg(_)).Times(0);
+#endif // TELEMETRY_MONITOR
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageReceived(_)).Times(0);
+ mock_transport_manager_.TestHandle(test_event);
+}
+
+TEST_F(TransportManagerImplTest, CheckEventOnReceivedFail_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_RECEIVED_FAIL);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+ // Act and Assert
+ EXPECT_CALL(*mock_transport_manager_listener_, OnTMMessageReceiveFailed(_)).Times(0);
+ mock_transport_manager_.TestHandle(test_event);
+}
+
+TEST_F(TransportManagerImplTest,
+ CheckEventOnUnexpectedDisconnect_ConnectionNotExist) {
+ // SetUp does not add connections
+ // Arrange
+ const int type = static_cast<int>(
+ TransportAdapterListenerImpl::EventTypeEnum::ON_UNEXPECTED_DISCONNECT);
+ TransportAdapterEvent test_event(type,
+ mock_adapter_,
+ mac_address_,
+ application_id_,
+ test_message_,
+ error_);
+ // Act and Assert
+ EXPECT_CALL(*mock_transport_manager_listener_, OnUnexpectedDisconnect(_, _)).Times(0);
+ mock_transport_manager_.TestHandle(test_event);
+}
+
} // namespace transport_manager_test
} // namespace components
} // namespace test
diff --git a/src/components/transport_manager/test/transport_manager_test.cc b/src/components/transport_manager/test/transport_manager_test.cc
deleted file mode 100644
index 551931788c..0000000000
--- a/src/components/transport_manager/test/transport_manager_test.cc
+++ /dev/null
@@ -1,394 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-#include <pthread.h>
-
-#include "protocol/common.h"
-#include "transport_manager/info.h"
-#include "transport_manager/common.h"
-#include "transport_manager/transport_manager_impl.h"
-
-#include "include/raw_message_matcher.h"
-#include "include/mock_transport_adapter.h"
-#include "include/mock_device.h"
-#include "include/mock_transport_manager_listener.h"
-#include "transport_manager/transport_manager_listener_empty.h"
-
-//for instance test
-#include "transport_manager/transport_manager.h"
-#include "transport_manager/transport_adapter/transport_adapter.h"
-#include "transport_manager/transport_manager_default.h"
-#include "connection_handler/connection_handler.h"
-
-using ::testing::_;
-using ::testing::AtLeast;
-
-using ::transport_manager::ApplicationHandle;
-using ::transport_manager::DeviceHandle;
-using ::transport_manager::TransportManager;
-using ::transport_manager::TransportManagerImpl;
-using ::transport_manager::DeviceUID;
-using ::transport_manager::DeviceInfo;
-
-namespace test {
-namespace components {
-namespace transport_manager {
-
-ACTION_P(SignalTest, test) {
- if (test->thread_id != pthread_self()) {
- pthread_mutex_lock(&test->test_mutex);
- pthread_cond_signal(&test->test_cond);
- pthread_mutex_unlock(&test->test_mutex);
- } else {
- test->one_thread = true;
- }
-}
-
-class TransportManagerTest : public ::testing::Test {
- public:
- volatile bool one_thread;
- pthread_t thread_id;
- static pthread_mutex_t test_mutex;
- static pthread_cond_t test_cond;
- int number;
-
- protected:
- static TransportManagerImpl *tm;
- static MockTransportAdapter *mock_adapter;
- static MockTransportManagerListener *tm_listener;
-
- static void SetUpTestCase() {
- pthread_mutex_init(&test_mutex, NULL);
- pthread_cond_init(&test_cond, NULL);
- mock_adapter = new MockTransportAdapter();
- mock_adapter->Init();
- //TransportManagerAttr cfg{0};
- tm = new TransportManagerImpl();
-
- tm_listener = new MockTransportManagerListener();
- tm->AddEventListener(tm_listener);
- tm->AddTransportAdapter(mock_adapter);
- tm->Init();
- }
-
- static void TearDownTestCase() {
- tm->Stop();
- delete tm_listener;
- pthread_cond_destroy(&test_cond);
- pthread_mutex_destroy(&test_mutex);
- }
-
- virtual void SetUp() {
- one_thread = false;
- thread_id = pthread_self();
- mock_adapter->reset();
- pthread_mutex_lock(&test_mutex);
- }
-
- virtual void TearDown() { pthread_mutex_unlock(&test_mutex); }
-
- bool waitCond(int seconds) {
- if (one_thread) return true;
- timespec elapsed;
- clock_gettime(CLOCK_REALTIME, &elapsed);
- elapsed.tv_sec += seconds;
- return pthread_cond_timedwait(&test_cond, &test_mutex, &elapsed) !=
- ETIMEDOUT;
- }
-};
-
-TransportManagerImpl *TransportManagerTest::tm;
-
-class MyTransportListener
- : public ::transport_manager::TransportManagerListenerEmpty {
- public:
- explicit MyTransportListener(TransportManagerTest *test)
- : TransportManagerListenerEmpty(),
- connection(0),
- device_handle(0),
- test(test) {}
- ConnectionUID connection;
- DeviceHandle device_handle;
- void OnConnectionEstablished(const DeviceInfo &device,
- const ConnectionUID &connection_id) {
- connection = connection_id;
-
- pthread_mutex_lock(&test->test_mutex);
- pthread_cond_signal(&test->test_cond);
- pthread_mutex_unlock(&test->test_mutex);
- }
-
- void OnDeviceFound(const DeviceInfo &device_info) {
- device_handle = device_info.device_handle();
- }
-
- void OnScanDevicesFinished() {
- pthread_mutex_lock(&test->test_mutex);
- pthread_cond_signal(&test->test_cond);
- pthread_mutex_unlock(&test->test_mutex);
- }
-
- void OnTMMessageReceived(const RawMessagePtr message) {
- static int count = 0;
- if (++count == 100) {
- pthread_mutex_lock(&test->test_mutex);
- pthread_cond_signal(&test->test_cond);
- pthread_mutex_unlock(&test->test_mutex);
- }
- }
-
- void OnTMMessageSend(const RawMessagePtr message) {
- }
-
- private:
- TransportManagerTest *test;
-};
-
-pthread_mutex_t TransportManagerTest::test_mutex;
-pthread_cond_t TransportManagerTest::test_cond;
-
-MockTransportAdapter *TransportManagerTest::mock_adapter = NULL;
-MockTransportManagerListener *TransportManagerTest::tm_listener = NULL;
-
-
-
-TEST_F(TransportManagerTest, ScanDeviceFailed) {
-
- //assert
- EXPECT_CALL(*tm_listener, OnDeviceFound(_)).Times(0);
- EXPECT_CALL(*tm_listener, OnScanDevicesFailed(_)).WillOnce(
- SignalTest(this));
-
- //act
- mock_adapter->get_device_scanner()->fail_further_search();
- tm->SearchDevices();
-
- //assert
- EXPECT_TRUE(waitCond(1));
-
- //act
- mock_adapter->get_device_scanner()->reset();
-}
-
-TEST_F(TransportManagerTest, ScanDeviceNoFound) {
-
- //assert
- EXPECT_CALL(*tm_listener, OnScanDevicesFailed(_)).Times(0);
- EXPECT_CALL(*tm_listener, OnDeviceFound(_)).Times(0);
- EXPECT_CALL(*tm_listener, OnScanDevicesFinished()).WillOnce(SignalTest(this));
-
- EXPECT_CALL(*tm_listener, OnDeviceListUpdated(_));
-
- //act
- tm->SearchDevices();
-
- //assert
- EXPECT_TRUE(waitCond(1));
-
- //act
- mock_adapter->get_device_scanner()->reset();
-}
-
-TEST_F(TransportManagerTest, ScanDeviceDone) {
-
- //assert
- EXPECT_CALL(*tm_listener, OnScanDevicesFailed(_)).Times(0);
- EXPECT_CALL(*tm_listener, OnDeviceFound(_));
- EXPECT_CALL(*tm_listener, OnScanDevicesFinished()).WillOnce(SignalTest(this));
-
- //added to fixed warnings
- EXPECT_CALL(*tm_listener, OnDeviceAdded(_)).Times(3);
- EXPECT_CALL(*tm_listener, OnDeviceListUpdated(_));
- EXPECT_CALL(*tm_listener, OnDeviceRemoved(_)).Times(3);
-
- //act
- mock_adapter->get_device_scanner()->AddDevice("TestDevice", "MA:CA:DR:ES:S");
- tm->SearchDevices();
-
- //assert
- EXPECT_TRUE(waitCond(1));
-
- //act
- mock_adapter->get_device_scanner()->reset();
-}
-
-TEST_F(TransportManagerTest, ScanManyDeviceDone) {
-
-
- //assert
- EXPECT_CALL(*tm_listener, OnScanDevicesFailed(_)).Times(0);
- EXPECT_CALL(*tm_listener, OnDeviceFound(_)).Times(2);
- EXPECT_CALL(*tm_listener, OnScanDevicesFinished()).WillOnce(SignalTest(this));
-
- //assert
- EXPECT_CALL(*tm_listener, OnDeviceListUpdated(_));
- //act
- mock_adapter->get_device_scanner()->AddDevice("TestDevice1",
- "MA:CA:DR:ES:S1");
- mock_adapter->get_device_scanner()->AddDevice("TestDevice2",
- "MA:CA:DR:ES:S2");
- tm->SearchDevices();
-
- //assert
- EXPECT_TRUE(waitCond(1));
-
- //act
- mock_adapter->get_device_scanner()->reset();
-}
-
-
-TEST_F(TransportManagerTest, ConnectAddDeviceCannotFailConnection) {
-
- //arrange
- const DeviceInfo kInfo(1, "MA:CA:DR:ES:S", "TestDeviceName", "BTMAC");
- const ConnectionUID kConnection = 1;
-
- //assert
- EXPECT_CALL(*tm_listener, OnDeviceFound(_));
- EXPECT_CALL(*tm_listener, OnScanDevicesFinished());
-
- EXPECT_CALL(*tm_listener, OnDeviceAdded(_));
- EXPECT_CALL(*tm_listener, OnDeviceListUpdated(_));
-
- //act
- MyTransportListener *myListener = new MyTransportListener(this);
- mock_adapter->get_device_scanner()->AddDevice(kInfo.name(),
- kInfo.mac_address());
- tm->AddEventListener(myListener);
- tm->SearchDevices();
-
- //assert
- EXPECT_TRUE(waitCond(10));
-
- EXPECT_CALL(*tm_listener, OnConnectionFailed(_, _)).Times(0);
- EXPECT_CALL(*tm_listener, OnConnectionEstablished(kInfo, kConnection));
-
- //act
- tm->ConnectDevice(kInfo.device_handle());
-
- //assert
- EXPECT_TRUE(waitCond(10));
-
- //act
- mock_adapter->get_device_scanner()->reset();
-}
-
-
-//TODO{ALeshin}: APPLINK-10846
-//TEST_F(TransportManagerTest, ConnectDeviceSendReciveMessage) {
-
-// //arrange
-// const ConnectionUID kConnection = 1;
-// const int kTimes = 99; // Times of send message //if kTimes>99 OnTMMessageSend will fail
-// const unsigned int kVersionProtocol = 1;
-
-
-// //assert
-// EXPECT_CALL(*tm_listener, OnTMMessageSendFailed(_, _)).Times(0);
-// EXPECT_CALL(*tm_listener, OnTMMessageReceiveFailed(_, _)).Times(0);
-// EXPECT_CALL(*tm_listener, OnConnectionClosed(kConnection)).Times(0);
-
-// EXPECT_CALL(*tm_listener, OnTMMessageSend(_)).Times(kTimes);
-// EXPECT_CALL(*tm_listener, OnTMMessageReceived(_)).Times(kTimes);
-
-// //act
-// const unsigned int kSize = 12;
-// unsigned char data[kSize] = {0x20, 0x07, 0x01, 0x00, 0x00, 0x00,
-// 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
-// for (int i = 0; i < kTimes; ++i) {
-// const RawMessagePtr kMessage =
-// new RawMessage(kConnection, kVersionProtocol, data, kSize);
-// tm->SendMessageToDevice(kMessage);
-// usleep(1000);
-// }
-
-// //assert
-// EXPECT_TRUE(waitCond(10));
-
-// //act
-// mock_adapter->get_device_scanner()->reset();
-//}
-
-//TODO{ALeshin}: APPLINK-10846
-//TEST_F(TransportManagerTest, ConnectAddDeviceCannotFailClose) {
-
-// //arrange
-// const DeviceInfo kInfo(1, "MA:CA:DR:ES:S", "TestDeviceName", "BTMAC");
-// const ConnectionUID kConnection = 1;
-
-// //assert
-// EXPECT_CALL(*tm_listener, OnDeviceFound(_));
-// EXPECT_CALL(*tm_listener, OnScanDevicesFinished());
-// EXPECT_CALL(*tm_listener, OnDeviceListUpdated(_));
-
-
-// //act
-// MyTransportListener *myListener = new MyTransportListener(this);
-// mock_adapter->get_device_scanner()->AddDevice(kInfo.name(),
-// kInfo.mac_address());
-// tm->AddEventListener(myListener);
-// tm->SearchDevices();
-
-// //assert
-// EXPECT_TRUE(waitCond(10));
-
-// EXPECT_CALL(*tm_listener, OnConnectionClosedFailure(_, _)).Times(0);
-// EXPECT_CALL(*tm_listener, OnDisconnectFailed(kInfo.device_handle(), _))
-// .Times(0);
-// EXPECT_CALL(*tm_listener, OnConnectionClosed(kConnection)).WillOnce(SignalTest(this));
-
-// //act
-// tm->DisconnectDevice(kInfo.device_handle());
-
-// //assert
-// EXPECT_TRUE(waitCond(10));
-
-// //act
-// tm->Stop();
-// delete myListener;
-// mock_adapter->get_device_scanner()->reset();
-//}
-
-
-} // namespace transport_manager
-} // namespace components
-} // namespace test
-
-
-namespace test{
-namespace test_transport_manager_instance {
-TEST(testTransportManager, CreateOnlyInstance)
-{
- transport_manager::TransportManager *Instance = transport_manager::TransportManagerDefault::instance();
- ASSERT_EQ(Instance, transport_manager::TransportManagerDefault::instance());
- delete Instance;
-}
-}}
diff --git a/src/components/utils/CMakeLists.txt b/src/components/utils/CMakeLists.txt
index 3ebabe9043..f72d43e546 100644
--- a/src/components/utils/CMakeLists.txt
+++ b/src/components/utils/CMakeLists.txt
@@ -56,6 +56,9 @@ set (SOURCES
${UTILS_SRC_DIR}/resource_usage.cc
${UTILS_SRC_DIR}/appenders_loader.cc
${UTILS_SRC_DIR}/gen_hash.cc
+ ${UTILS_SRC_DIR}/convert_utils.cc
+ ${UTILS_SRC_DIR}/custom_string.cc
+ ${UTILS_SRC_DIR}/timer.cc
)
if(ENABLE_LOG)
@@ -80,7 +83,15 @@ if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
)
endif()
-add_library("Utils" SHARED ${SOURCES})
+add_library("Utils" ${SOURCES})
+
+if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
+ # --- QDB Wrapper
+ add_subdirectory(./src/qdb_wrapper)
+else ()
+ # --- SQLite Wrapper
+ add_subdirectory(./src/sqlite_wrapper)
+endif ()
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
list(APPEND LIBRARIES dl)
@@ -91,6 +102,8 @@ if(ENABLE_LOG)
list(APPEND LIBRARIES log4cxx -L${LOG4CXX_LIBS_DIRECTORY})
list(APPEND LIBRARIES apr-1 -L${APR_LIBS_DIRECTORY})
list(APPEND LIBRARIES aprutil-1 -L${APR_UTIL_LIBS_DIRECTORY})
+ list(APPEND LIBRARIES ConfigProfile)
+
ADD_DEPENDENCIES(Utils install-3rd_party_logger)
endif()
@@ -100,6 +113,7 @@ endif()
target_link_libraries("Utils" ${LIBRARIES})
+
if(BUILD_TESTS)
add_subdirectory(test)
endif()
diff --git a/src/components/utils/include/utils/convert_utils.h b/src/components/utils/include/utils/convert_utils.h
new file mode 100644
index 0000000000..b3e849d6bd
--- /dev/null
+++ b/src/components/utils/include/utils/convert_utils.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_CONVERT_UTILS_H_
+#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_CONVERT_UTILS_H_
+
+#include <stdint.h>
+#include <limits>
+
+namespace utils {
+
+/**
+ * Convert int64 value to long long int value
+ * Using when int64 value should be assign to JSON value
+ */
+long long int ConvertInt64ToLongLongInt(const int64_t value);
+
+/**
+ * Convert long long int value to int64 value
+ */
+int64_t ConvertLongLongIntToInt64(const long long int value);
+
+/**
+ * Convert uint64 value to unsigned long long int value
+ * Using when uint64 value should be assign to JSON value
+ */
+unsigned long long int ConvertUInt64ToLongLongUInt(const uint64_t value);
+
+/**
+ * Convert unsigned long long int value to uint64 value
+ */
+uint64_t ConvertLongLongUIntToUInt64(const unsigned long long int value);
+
+
+/**
+ * Convert one number value to another type value
+ */
+template <typename InputType, typename OutputType>
+OutputType SafeStaticCast(const InputType value) {
+ DCHECK_OR_RETURN(value >= std::numeric_limits<OutputType>::min(),
+ std::numeric_limits<OutputType>::min());
+ DCHECK_OR_RETURN(value <= std::numeric_limits<OutputType>::max(),
+ std::numeric_limits<OutputType>::max());
+ return static_cast<OutputType>(value);
+}
+
+} // namespace utils
+
+#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_CONVERT_UTILS_H_
diff --git a/src/components/utils/include/utils/file_system.h b/src/components/utils/include/utils/file_system.h
index a132837ca0..0757a17110 100644
--- a/src/components/utils/include/utils/file_system.h
+++ b/src/components/utils/include/utils/file_system.h
@@ -147,6 +147,13 @@ void Close(std::ofstream* file_stream);
std::string CurrentWorkingDirectory();
/**
+ * @brief Allows to obtaine absolute path for certain path.
+ * @param path the file name for which absolute path have to be calculated.
+ * @return absolute path for certain path.
+ */
+std::string GetAbsolutePath(const std::string& path);
+
+/**
* @brief Removes file
*
* @param name path to file
@@ -260,6 +267,7 @@ bool CopyFile(const std::string& src,
*/
bool MoveFile(const std::string& src,
const std::string& dst);
+
void remove_directory_content(const std::string& directory_name);
} // namespace file_system
diff --git a/src/components/utils/include/utils/gen_hash.h b/src/components/utils/include/utils/gen_hash.h
index e4102d36db..acb2e28a1d 100644
--- a/src/components/utils/include/utils/gen_hash.h
+++ b/src/components/utils/include/utils/gen_hash.h
@@ -37,6 +37,10 @@
namespace utils {
+namespace custom_string {
+class CustomString;
+}
+
/**
* @brief generate random alphanumeric string of specified length
* @param size length of random string
@@ -45,6 +49,32 @@ namespace utils {
const std::string gen_hash(size_t size);
+/**
+ * @brief Allows to generate hash from the specified string.
+ * The djb2 algorithm uses for hash generation.
+ * @param str_to_hash - the string from which hash should be generated.
+ * @return integer hash for the specified string.
+ */
+int32_t Djb2HashFromString(const std::string& str_to_hash);
+
+/**
+ * @brief Generates hash.
+ * The faq6 algorithm uses for hash generation.
+ * @param str_to_hash - the CustomSting contains ASCII or UTF8 string from which
+ * hash should be generated.
+ * @return uint32_t hash for the specified string.
+ */
+uint32_t CaseInsensitiveFaq6HashFromString(
+ const custom_string::CustomString& str_to_hash);
+
+/**
+ * @brief Transforms input string to lower case and then generates hash.
+ * The faq6 algorithm uses for hash generation.
+ * @param str_to_hash - the string from which hash should be generated.
+ * @return uint32_t hash for the specified string.
+ */
+uint32_t CaseInsensitiveFaq6HashFromString(const char* cstr);
+
} // namespace utils
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_GEN_HASH_H_
diff --git a/src/components/utils/include/utils/helpers.h b/src/components/utils/include/utils/helpers.h
index e616dd56c1..f16acfc90a 100644
--- a/src/components/utils/include/utils/helpers.h
+++ b/src/components/utils/include/utils/helpers.h
@@ -31,7 +31,7 @@
*/
#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_HELPERS_H
#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_HELPERS_H
-
+#include<algorithm>
/**
* These helpers allows to simplify compare strategy between some objects.
* Suppose user has some enum with value E with some numbers of possible values
@@ -114,6 +114,13 @@ namespace helpers {
return CmpStrategy(Compare<T, CompareType, CmpStrategy>(what, to, to1, to2, to3),
Compare<T, CompareType, CmpStrategy>(what, to4));
}
+
+
+ template<typename Container>
+ bool in_range(const Container& container, const typename Container::value_type& value) {
+ return
+ std::find(container.begin(), container.end(), value) != container.end();
+ }
}
#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_HELPERS_H
diff --git a/src/components/utils/include/utils/log_message_loop_thread.h b/src/components/utils/include/utils/log_message_loop_thread.h
index 87b6c7e531..80816877b6 100644
--- a/src/components/utils/include/utils/log_message_loop_thread.h
+++ b/src/components/utils/include/utils/log_message_loop_thread.h
@@ -39,7 +39,6 @@
#include "utils/macro.h"
#include "utils/threads/message_loop_thread.h"
-#include "utils/singleton.h"
namespace logger {
@@ -62,18 +61,13 @@ class LogMessageHandler : public LogMessageLoopThreadTemplate::Handler {
};
class LogMessageLoopThread :
- public LogMessageLoopThreadTemplate,
- public utils::Singleton<LogMessageLoopThread> {
+ public LogMessageLoopThreadTemplate {
public:
- ~LogMessageLoopThread();
-
- private:
LogMessageLoopThread();
+ ~LogMessageLoopThread();
DISALLOW_COPY_AND_ASSIGN(LogMessageLoopThread);
-FRIEND_BASE_SINGLETON_CLASS(LogMessageLoopThread);
-
};
} // namespace logger
diff --git a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_database.h b/src/components/utils/include/utils/qdb_wrapper/sql_database.h
index caf954e1d2..54c89f678c 100644
--- a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_database.h
+++ b/src/components/utils/include/utils/qdb_wrapper/sql_database.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -38,7 +38,7 @@
#include "qdb_wrapper/sql_error.h"
#include "utils/lock.h"
-namespace policy {
+namespace utils {
namespace dbms {
class SQLQuery;
@@ -129,6 +129,6 @@ class SQLDatabase {
};
} // namespace dbms
-} // namespace policy
+} // namespace utils
#endif // SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_DATABASE_H_
diff --git a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_error.h b/src/components/utils/include/utils/qdb_wrapper/sql_error.h
index cf21a66ff4..79706cc0ef 100644
--- a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_error.h
+++ b/src/components/utils/include/utils/qdb_wrapper/sql_error.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#include <string>
-namespace policy {
+namespace utils {
namespace dbms {
typedef enum Error {
@@ -75,6 +75,6 @@ class SQLError {
};
} // namespace dbms
-} // namespace policy
+} // namespace utils
#endif // SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_ERROR_H_
diff --git a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_query.h b/src/components/utils/include/utils/qdb_wrapper/sql_query.h
index af46402c8e..34fbfc61c7 100644
--- a/src/components/policy/src/policy/qdb_wrapper/include/qdb_wrapper/sql_query.h
+++ b/src/components/utils/include/utils/qdb_wrapper/sql_query.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -41,7 +41,7 @@
#include "qdb_wrapper/sql_error.h"
#include "utils/lock.h"
-namespace policy {
+namespace utils {
namespace dbms {
class SQLDatabase;
@@ -151,6 +151,20 @@ class SQLQuery {
/**
* Gets value in the result record
* @param pos position of value
+ * @return unsigned integer value
+ */
+ uint32_t GetUInteger(int pos) const;
+
+ /**
+ * Gets value in the result record
+ * @param pos position of value
+ * @return int64_t value
+ */
+ int64_t GetLongInt(int pos) const;
+
+ /**
+ * Gets value in the result record
+ * @param pos position of value
* @return double value
*/
double GetDouble(int pos) const;
@@ -246,6 +260,6 @@ class SQLQuery {
};
} // namespace dbms
-} // namespace policy
+} // namespace utils
#endif // SRC_COMPONENTS_POLICY_QDB_WRAPPER_INCLUDE_QDB_WRAPPER_SQL_QUERY_H_
diff --git a/src/components/utils/include/utils/signals.h b/src/components/utils/include/utils/signals.h
index 6c91836309..b8b71b95e3 100644
--- a/src/components/utils/include/utils/signals.h
+++ b/src/components/utils/include/utils/signals.h
@@ -41,8 +41,8 @@ typedef void (*sighandler_t) (int);
namespace utils {
-bool SubscribeToTerminateSignal(sighandler_t func);
-bool SubscribeToFaultSignal(sighandler_t func);
+bool UnsibscribeFromTermination();
+bool WaitTerminationSignals(sighandler_t sig_handler);
} // namespace utils
diff --git a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_database.h b/src/components/utils/include/utils/sqlite_wrapper/sql_database.h
index 274c64bef4..720628ef3c 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_database.h
+++ b/src/components/utils/include/utils/sqlite_wrapper/sql_database.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -34,12 +34,12 @@
#define SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_DATABASE_H_
#include <string>
-#include "sqlite_wrapper/sql_error.h"
+#include "utils/sqlite_wrapper/sql_error.h"
#include "utils/lock.h"
struct sqlite3;
-namespace policy {
+namespace utils {
namespace dbms {
class SQLQuery;
@@ -95,6 +95,13 @@ class SQLDatabase {
void set_path(const std::string& path);
/**
+ * @brief get_path databse location path.
+ *
+ * @return the path to the database location
+ */
+ std::string get_path() const;
+
+ /**
* Checks if database is read/write
* @return true if database is read/write
*/
@@ -155,6 +162,6 @@ class SQLDatabase {
};
} // namespace dbms
-} // namespace policy
+} // namespace utils
#endif // SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_DATABASE_H_
diff --git a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_error.h b/src/components/utils/include/utils/sqlite_wrapper/sql_error.h
index 578b3990c9..70e73820f8 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_error.h
+++ b/src/components/utils/include/utils/sqlite_wrapper/sql_error.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,7 +35,7 @@
#include <string>
-namespace policy {
+namespace utils {
namespace dbms {
typedef enum Error {
@@ -104,6 +104,6 @@ class SQLError {
};
} // namespace dbms
-} // namespace policy
+} // namespace utils
#endif // SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_ERROR_H_
diff --git a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_query.h b/src/components/utils/include/utils/sqlite_wrapper/sql_query.h
index b477a812da..de75e37c62 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/include/sqlite_wrapper/sql_query.h
+++ b/src/components/utils/include/utils/sqlite_wrapper/sql_query.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,12 +35,12 @@
#include <stdint.h>
#include <string>
-#include "sqlite_wrapper/sql_error.h"
+#include "utils/sqlite_wrapper/sql_error.h"
#include "utils/lock.h"
struct sqlite3_stmt;
-namespace policy {
+namespace utils {
namespace dbms {
class SQLDatabase;
@@ -150,6 +150,20 @@ class SQLQuery {
/**
* Gets value in the result record
* @param pos position of value
+ * @return unsigned integer value
+ */
+ uint32_t GetUInteger(int pos) const;
+
+ /**
+ * Gets value in the result record
+ * @param pos position of value
+ * @return int64_t value
+ */
+ int64_t GetLongInt(int pos) const;
+
+ /**
+ * Gets value in the result record
+ * @param pos position of value
* @return double value
*/
double GetDouble(int pos) const;
@@ -214,6 +228,6 @@ class SQLQuery {
};
} // namespace dbms
-} // namespace policy
+} // namespace utils
#endif // SRC_COMPONENTS_POLICY_SQLITE_WRAPPER_INCLUDE_SQLITE_WRAPPER_SQL_QUERY_H_
diff --git a/src/components/utils/include/utils/timer.h b/src/components/utils/include/utils/timer.h
new file mode 100644
index 0000000000..0cf555d27f
--- /dev/null
+++ b/src/components/utils/include/utils/timer.h
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_H_
+#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_H_
+
+#include <stdint.h>
+
+#ifdef __QNX__
+#include <sys/siginfo.h>
+#else
+#include <signal.h>
+typedef sigval_t sigval;
+#endif
+
+#include <time.h>
+#include <string>
+
+#include "utils/lock.h"
+#include "utils/timer_task.h"
+
+namespace timer {
+typedef uint32_t Milliseconds;
+/**
+ * @brief The Timer is class for calling any method after out of internal time.
+ * Time setups in ::Start(uint,bool) method and starts time out steps.
+ * User can call Start, Stop, IsRunning, GetTimeout.
+ */
+class Timer {
+ public:
+ /**
+ * @brief constructor
+ * @param name for indentify of current timer
+ * @param task_for_tracking is SPtr to trackable task
+ */
+ Timer(const std::string& name, const TimerTask* task_for_tracking);
+
+ /**
+ * @brief destructor - if timer running : call stop in the body
+ */
+ ~Timer();
+ /**
+ * @brief starts timer with new timeout
+ * @param timeout - time to call method from trackable class
+ * @param repeatable - should timer repeat after calling callback, or no
+ */
+ void Start(const Milliseconds timeout, const bool repeatable);
+ /**
+ * @brief stops timer without calling callback
+ */
+ void Stop();
+ /**
+ * @brief method which know about Timer state: is running or not
+ * @return true when timer runned, false when timer stand
+ */
+ bool IsRunning() const;
+ /**
+ * @brief GetTimeout
+ * @return returns timeout
+ */
+ Milliseconds GetTimeout() const;
+
+ private:
+ const std::string name_;
+ const TimerTask* task_;
+ bool repeatable_;
+ uint32_t timeout_ms_;
+ bool is_running_;
+ timer_t timer_;
+ mutable sync_primitives::Lock lock_;
+ sync_primitives::Lock task_lock_;
+
+ /**
+ * @brief method called from friend handler_wrapper and call run() from task.
+ */
+ void OnTimeout();
+
+ /**
+ * @brief method for setting correct timeout.
+ * @param timeout - if it`s value = 0, timeout will be setted to 1
+ * There would be no way to stop thread if timeout in lopper will be 0
+ * and if we puts to timer_create zero timeout then we get sys error(22)
+ */
+ void SetTimeoutUnsafe(const Milliseconds timeout);
+
+ /**
+ * @brief startUnsafe, stopUnsafe - methods used for correct synchronization
+ * and must be used only with sync_primitive (auto_lock e.g.)
+ * @return true if start/stop successfull, false if unsuccessfull
+ */
+ void StartUnsafe();
+ bool StopUnsafe();
+
+ /**
+ * @brief alone function which sends to posix_timer as callee
+ * @param signal_value - structure with parameters of posix_timer callee
+ */
+ friend void HandlePosixTimer(sigval signal_value);
+
+ DISALLOW_COPY_AND_ASSIGN(Timer);
+};
+} // namespace timer
+
+#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_H_
diff --git a/src/components/utils/include/utils/timer_task.h b/src/components/utils/include/utils/timer_task.h
new file mode 100644
index 0000000000..199fd804de
--- /dev/null
+++ b/src/components/utils/include/utils/timer_task.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_H_
+#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_H_
+
+namespace timer {
+
+/**
+ * @brief The TimerTask interface
+ */
+class TimerTask {
+ public:
+ /**
+ * @brief this method calls callback from callee
+ */
+ virtual void run() const = 0;
+
+ virtual ~TimerTask() {}
+};
+
+} // namespace timer
+
+#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_H_
diff --git a/src/components/utils/include/utils/timer_task_impl.h b/src/components/utils/include/utils/timer_task_impl.h
new file mode 100644
index 0000000000..28618551ec
--- /dev/null
+++ b/src/components/utils/include/utils/timer_task_impl.h
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_IMPL_H_
+#define SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_IMPL_H_
+
+#include "utils/timer_task.h"
+#include "utils/macro.h"
+
+namespace timer {
+
+/**
+ * @brief The TaskImpl is proxy-template class for calling callback from Timer
+ */
+template <typename Trackable>
+class TimerTaskImpl : public TimerTask {
+ public:
+ typedef void (Trackable::*CallbackFunction)();
+
+ TimerTaskImpl(Trackable* trackable, CallbackFunction callback);
+ ~TimerTaskImpl();
+ /**
+ * @brief run method which call callback function from callee
+ */
+ void run() const OVERRIDE;
+
+ private:
+ Trackable* callee_;
+ CallbackFunction callback_;
+};
+
+// Implementation
+template <typename Trackable>
+TimerTaskImpl<Trackable>::TimerTaskImpl(Trackable* trackable,
+ CallbackFunction callback)
+ : callee_(trackable), callback_(callback) {}
+
+template <typename Trackable>
+TimerTaskImpl<Trackable>::~TimerTaskImpl() {
+ callee_ = NULL;
+}
+
+template <typename Trackable>
+void TimerTaskImpl<Trackable>::run() const {
+ DCHECK_OR_RETURN_VOID(callee_ && callback_)
+ (callee_->*callback_)();
+}
+} // namespace timer
+
+#endif // SRC_COMPONENTS_UTILS_INCLUDE_UTILS_TIMER_TASK_IMPL_H_
diff --git a/src/components/utils/src/auto_trace.cc b/src/components/utils/src/auto_trace.cc
index 5104851a51..606e8330cb 100644
--- a/src/components/utils/src/auto_trace.cc
+++ b/src/components/utils/src/auto_trace.cc
@@ -42,7 +42,8 @@ AutoTrace::AutoTrace(
log4cxx::LoggerPtr logger,
const log4cxx::spi::LocationInfo& location) :
logger_(logger), location_(location) {
- if (logger_->isTraceEnabled()) {
+ if (logger::logs_enabled() &&
+ logger_->isTraceEnabled()) {
push_log(logger_,
::log4cxx::Level::getTrace(),
"Enter",
@@ -54,7 +55,8 @@ AutoTrace::AutoTrace(
}
AutoTrace::~AutoTrace() {
- if (logger_->isTraceEnabled()) {
+ if (logger::logs_enabled() &&
+ logger_->isTraceEnabled()) {
push_log(logger_,
::log4cxx::Level::getTrace(),
"Exit",
diff --git a/src/components/transport_manager/test/mock_connection.cc b/src/components/utils/src/convert_utils.cc
index 8f385764a0..50a32f3da0 100644
--- a/src/components/transport_manager/test/mock_connection.cc
+++ b/src/components/utils/src/convert_utils.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,49 +30,41 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <cstring>
-
-#include <sys/socket.h>
-#include <sys/un.h>
-#include <sstream>
-#include "transport_manager/common.h"
-#include "include/mock_connection.h"
-
+#include "utils/convert_utils.h"
+#include <stdint.h>
+#include <limits>
#include <algorithm>
+#include "utils/macro.h"
-#include "include/mock_transport_adapter.h"
-
-using ::transport_manager::transport_adapter::TransportAdapterController;
-
-namespace test {
-namespace components {
-namespace transport_manager {
+long long int utils::ConvertInt64ToLongLongInt(const int64_t value) {
+ DCHECK(value >= std::numeric_limits<long long int>::min());
+ DCHECK(value <= std::numeric_limits<long long int>::max());
+ return static_cast<long long int>(value);
+}
-MockConnection::MockConnection(const ::transport_manager::DeviceUID& device_handle,
- const ApplicationHandle& app_handle,
- TransportAdapterController* controller)
- : ThreadedSocketConnection(device_handle, app_handle, controller) {
+int64_t utils::ConvertLongLongIntToInt64(const long long int value) {
+ DCHECK_OR_RETURN(
+ value >= std::numeric_limits<int64_t>::min(),
+ std::min<int64_t>(value, std::numeric_limits<int64_t>::min()));
+ DCHECK_OR_RETURN(
+ value <= std::numeric_limits<int64_t>::max(),
+ std::max<int64_t>(value, std::numeric_limits<int64_t>::max()));
+ return static_cast<int64_t>(value);
}
-bool MockConnection::Establish(ConnectError **error) {
- int peer_sock = socket(AF_UNIX, SOCK_STREAM, 0);
- sockaddr_un my_addr;
- memset(&my_addr, 0, sizeof(my_addr));
- std::ostringstream iss;
- iss << "mockDevice" << device_handle() << "-" << application_handle();
- strcpy(my_addr.sun_path, iss.str().c_str());
- my_addr.sun_family = AF_UNIX;
- int res = ::connect(peer_sock, reinterpret_cast<sockaddr*>(&my_addr),
- sizeof(my_addr));
- if (res != -1) {
- set_socket(peer_sock);
- return true;
- }
- *error = new ConnectError();
- return false;
+unsigned long long int utils::ConvertUInt64ToLongLongUInt(const uint64_t value) {
+ DCHECK(value >= std::numeric_limits<unsigned long long int>::min());
+ DCHECK(value <= std::numeric_limits<unsigned long long int>::max());
+ return static_cast<unsigned long long int>(value);
}
-} // namespace transport_manager
-} // namespace components
-} // namespace test
+uint64_t utils::ConvertLongLongUIntToUInt64(const unsigned long long int value) {
+ DCHECK_OR_RETURN(
+ value >= std::numeric_limits<uint64_t>::min(),
+ std::min<uint64_t>(value, std::numeric_limits<uint64_t>::min()));
+ DCHECK_OR_RETURN(
+ value <= std::numeric_limits<uint64_t>::max(),
+ std::max<uint64_t>(value, std::numeric_limits<uint64_t>::max()));
+ return static_cast<uint64_t>(value);
+}
diff --git a/src/components/utils/src/custom_string.cc b/src/components/utils/src/custom_string.cc
new file mode 100644
index 0000000000..e7fc4cfd6a
--- /dev/null
+++ b/src/components/utils/src/custom_string.cc
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/custom_string.h"
+#include <cwchar>
+#include <cstdlib>
+#include <clocale>
+#include <cwctype>
+#include <new>
+#include <algorithm>
+#include <string.h>
+#include "utils/logger.h"
+#include "utils/macro.h"
+
+namespace {
+namespace custom_str = utils::custom_string;
+
+// Calculates amount of characters in UTF string
+size_t CalculateLengthOfString(const char* str) {
+ size_t length_of_string = 0;
+ for (size_t i = 0; str[i] != '\0'; ++i) {
+ if ((str[i] & custom_str::kHigestByteOfUTF8Byte2) !=
+ custom_str::kByteOfUTF8) {
+ ++length_of_string;
+ }
+ }
+ return length_of_string;
+}
+
+// Converts string to unicode string.
+std::wstring ConvertUTFToWString(const char* str) {
+ size_t size = CalculateLengthOfString(str);
+ std::vector<wchar_t> wchar_array(size + 1, L'\0');
+
+ std::string current_locale = setlocale(LC_ALL, NULL);
+ setlocale(LC_ALL, ""); // system locale
+ mbstowcs(&(wchar_array.front()), str, size);
+ setlocale(LC_ALL, current_locale.c_str());
+ return std::wstring(&(wchar_array.front()));
+}
+
+// Converts string to lower case unicode string.
+void ConvertWStringToLowerCase(std::wstring& str) {
+ const std::string current_locale = setlocale(LC_ALL, NULL);
+ setlocale(LC_ALL, "");
+ std::transform(str.begin(), str.end(), str.begin(), towlower);
+ setlocale(LC_ALL, current_locale.c_str());
+}
+}
+
+namespace utils {
+namespace custom_string {
+
+CustomString::CustomString() : amount_characters_(0), is_ascii_string_(true) {}
+
+CustomString::CustomString(const std::string& str)
+ : mb_string_(str), amount_characters_(0), is_ascii_string_(true) {
+ InitData();
+}
+
+CustomString::CustomString(const char* str)
+ : mb_string_(str), amount_characters_(0), is_ascii_string_(true) {
+ InitData();
+}
+
+CustomString::CustomString(size_t n, char c)
+ : mb_string_(n, c), amount_characters_(0), is_ascii_string_(true) {
+ InitData();
+}
+
+size_t CustomString::size() const {
+ return amount_characters_;
+}
+
+size_t CustomString::length() const {
+ return amount_characters_;
+}
+
+size_t CustomString::length_bytes() const {
+ return mb_string_.size();
+}
+
+bool CustomString::is_ascii_string() const {
+ return is_ascii_string_;
+}
+
+bool CustomString::empty() const {
+ return 0 == amount_characters_;
+}
+
+bool CustomString::operator==(const CustomString& str) const {
+ return mb_string_ == str.mb_string_;
+}
+
+bool CustomString::operator==(const std::string& str) const {
+ return mb_string_ == str;
+}
+
+CustomString& CustomString::operator=(const char* str) {
+ mb_string_ = str;
+ InitData();
+ return *this;
+}
+
+CustomString CustomString::operator+(const CustomString& str) const {
+ return *this + str.AsMBString();
+}
+
+CustomString CustomString::operator+(const std::string& str) const {
+ if (!str.empty()) {
+ CustomString result_str(mb_string_ + str);
+ return result_str;
+ }
+ return *this;
+}
+
+char CustomString::at(size_t pos) const {
+ DCHECK_OR_RETURN((is_ascii_string_ && pos < amount_characters_), '\0');
+ return mb_string_.at(pos);
+}
+
+int CustomString::compare(const char* str) const {
+ return mb_string_.compare(str);
+}
+
+int CustomString::compare(const std::string& str) const {
+ return mb_string_.compare(str);
+}
+
+bool CustomString::CompareIgnoreCase(const CustomString& str) const {
+ if (is_ascii_string() && str.is_ascii_string()) {
+ return !strcasecmp(c_str(), str.c_str());
+ }
+ std::wstring wstr_first(ConvertUTFToWString(mb_string_.c_str()));
+ std::wstring wstr_second(ConvertUTFToWString(str.c_str()));
+ ConvertWStringToLowerCase(wstr_first);
+ ConvertWStringToLowerCase(wstr_second);
+ return wstr_first == wstr_second;
+}
+
+bool CustomString::CompareIgnoreCase(const char* str) const {
+ return CompareIgnoreCase(CustomString(str));
+}
+
+const char* CustomString::c_str() const {
+ return mb_string_.c_str();
+}
+
+std::wstring CustomString::ToWString() const {
+ return ConvertUTFToWString(mb_string_.c_str());
+}
+
+std::string CustomString::AsMBString() const {
+ return mb_string_;
+}
+
+std::wstring CustomString::ToWStringLowerCase() const {
+ std::wstring wstr(ConvertUTFToWString(mb_string_.c_str()));
+ ConvertWStringToLowerCase(wstr);
+ return wstr;
+}
+
+void CustomString::InitData() {
+ if (mb_string_.empty()) {
+ return;
+ }
+ amount_characters_ = CalculateLengthOfString(mb_string_.c_str());
+ is_ascii_string_ = amount_characters_ == mb_string_.size();
+}
+
+} // namespace custom_string
+} // namespace utils
diff --git a/src/components/utils/src/date_time.cc b/src/components/utils/src/date_time.cc
index 42a199e0fb..9313874f48 100644
--- a/src/components/utils/src/date_time.cc
+++ b/src/components/utils/src/date_time.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,17 +47,20 @@ namespace date_time {
}
int64_t date_time::DateTime::getSecs(const TimevalStruct &time) {
- return static_cast<int64_t>(time.tv_sec);
+ const TimevalStruct times = ConvertionUsecs(time);
+ return static_cast<int64_t>(times.tv_sec);
}
int64_t DateTime::getmSecs(const TimevalStruct &time) {
- return static_cast<int64_t>(time.tv_sec) * MILLISECONDS_IN_SECOND
- + time.tv_usec / MICROSECONDS_IN_MILLISECONDS;
+ const TimevalStruct times = ConvertionUsecs(time);
+ return static_cast<int64_t>(times.tv_sec) * MILLISECONDS_IN_SECOND
+ + times.tv_usec / MICROSECONDS_IN_MILLISECOND;
}
int64_t DateTime::getuSecs(const TimevalStruct &time) {
- return static_cast<int64_t>(time.tv_sec) * MILLISECONDS_IN_SECOND
- * MICROSECONDS_IN_MILLISECONDS + time.tv_usec;
+ const TimevalStruct times = ConvertionUsecs(time);
+ return static_cast<int64_t>(times.tv_sec) * MILLISECONDS_IN_SECOND
+ * MICROSECONDS_IN_MILLISECOND + times.tv_usec;
}
int64_t DateTime::calculateTimeSpan(const TimevalStruct& sinceTime) {
@@ -66,32 +69,51 @@ int64_t DateTime::calculateTimeSpan(const TimevalStruct& sinceTime) {
int64_t DateTime::calculateTimeDiff(const TimevalStruct &time1,
const TimevalStruct &time2){
+ const TimevalStruct times1 = ConvertionUsecs(time1);
+ const TimevalStruct times2 = ConvertionUsecs(time2);
TimevalStruct ret;
- if (Greater(time1, time2)) {
- ret = Sub(time1, time2);
+ if (Greater(times1, times2)) {
+ ret = Sub(times1, times2);
} else {
- ret = Sub(time2, time1);
+ ret = Sub(times2, times1);
}
return getmSecs(ret);
}
+void DateTime::AddMilliseconds(TimevalStruct& time,
+ uint32_t milliseconds) {
+ const uint32_t sec = milliseconds/MILLISECONDS_IN_SECOND;
+ const uint32_t usec = (milliseconds%MILLISECONDS_IN_SECOND)*MICROSECONDS_IN_MILLISECOND;
+ time.tv_sec += sec;
+ time.tv_usec += usec;
+ time = ConvertionUsecs(time);
+}
+
TimevalStruct DateTime::Sub(const TimevalStruct& time1,
const TimevalStruct& time2) {
+ const TimevalStruct times1 = ConvertionUsecs(time1);
+ const TimevalStruct times2 = ConvertionUsecs(time2);
TimevalStruct ret;
- timersub(&time1, &time2, &ret);
+ timersub(&times1, &times2, &ret);
return ret;
}
bool DateTime::Greater(const TimevalStruct& time1, const TimevalStruct& time2) {
- return timercmp(&time1, &time2, >);
+ const TimevalStruct times1 = ConvertionUsecs(time1);
+ const TimevalStruct times2 = ConvertionUsecs(time2);
+ return timercmp(&times1, &times2, >);
}
bool DateTime::Less(const TimevalStruct& time1, const TimevalStruct& time2) {
- return timercmp(&time1, &time2, <);
+ const TimevalStruct times1 = ConvertionUsecs(time1);
+ const TimevalStruct times2 = ConvertionUsecs(time2);
+ return timercmp(&times1, &times2, <);
}
bool DateTime::Equal(const TimevalStruct& time1, const TimevalStruct& time2) {
- return !timercmp(&time1, &time2, !=);
+ const TimevalStruct times1 = ConvertionUsecs(time1);
+ const TimevalStruct times2 = ConvertionUsecs(time2);
+ return !timercmp(&times1, &times2, !=);
}
TimeCompare date_time::DateTime::compareTime(const TimevalStruct &time1, const TimevalStruct &time2) {
@@ -100,6 +122,16 @@ TimeCompare date_time::DateTime::compareTime(const TimevalStruct &time1, const T
return EQUAL;
}
+TimevalStruct date_time::DateTime::ConvertionUsecs(const TimevalStruct &time){
+ if (time.tv_usec >= MICROSECONDS_IN_SECOND) {
+ TimevalStruct time1;
+ time1.tv_sec = static_cast<int64_t>(time.tv_sec) + (time.tv_usec/MICROSECONDS_IN_SECOND);
+ time1.tv_usec = static_cast<int64_t>(time.tv_usec) % MICROSECONDS_IN_SECOND;
+ return time1;
+ }
+ return time;
+}
+
} // namespace date_time
bool operator<(const TimevalStruct& time1, const TimevalStruct& time2) {
@@ -109,3 +141,7 @@ bool operator<(const TimevalStruct& time1, const TimevalStruct& time2) {
bool operator==(const TimevalStruct& time1, const TimevalStruct& time2) {
return date_time::DateTime::Equal(time1, time2);
}
+
+const TimevalStruct operator-(const TimevalStruct& time1, const TimevalStruct& time2) {
+ return date_time::DateTime::Sub(time1, time2);
+}
diff --git a/src/components/utils/src/file_system.cc b/src/components/utils/src/file_system.cc
index f9e3bb2dbc..91ff0c3b07 100644
--- a/src/components/utils/src/file_system.cc
+++ b/src/components/utils/src/file_system.cc
@@ -43,12 +43,13 @@
// TODO(VS): lint error: Streams are highly discouraged.
#include <fstream>
#include <cstddef>
+#include <cstdio>
#include <algorithm>
CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
uint64_t file_system::GetAvailableDiskSpace(const std::string& path) {
- struct statvfs fsInfo = { 0 };
+ struct statvfs fsInfo = {0};
if (statvfs(path.c_str(), &fsInfo) == 0) {
return fsInfo.f_bsize * fsInfo.f_bfree;
} else {
@@ -56,9 +57,9 @@ uint64_t file_system::GetAvailableDiskSpace(const std::string& path) {
}
}
-int64_t file_system::FileSize(const std::string &path) {
+int64_t file_system::FileSize(const std::string& path) {
if (file_system::FileExists(path)) {
- struct stat file_info = { 0 };
+ struct stat file_info = {0};
stat(path.c_str(), &file_info);
return file_info.st_size;
}
@@ -74,20 +75,19 @@ size_t file_system::DirectorySize(const std::string& path) {
struct dirent dir_element_;
struct dirent* dir_element = &dir_element_;
#else
- char* direntbuffer =
- new char[offsetof(struct dirent, d_name) +
- pathconf(path.c_str(), _PC_NAME_MAX) + 1];
- struct dirent* dir_element = new(direntbuffer) dirent;
+ char* direntbuffer = new char[offsetof(struct dirent, d_name) +
+ pathconf(path.c_str(), _PC_NAME_MAX) + 1];
+ struct dirent* dir_element = new (direntbuffer) dirent;
#endif
struct dirent* result = NULL;
- struct stat file_info = { 0 };
+ struct stat file_info = {0};
directory = opendir(path.c_str());
if (NULL != directory) {
return_code = readdir_r(directory, dir_element, &result);
for (; NULL != result && 0 == return_code;
return_code = readdir_r(directory, dir_element, &result)) {
- if (0 == strcmp(result->d_name, "..")
- || 0 == strcmp(result->d_name, ".")) {
+ if (0 == strcmp(result->d_name, "..") ||
+ 0 == strcmp(result->d_name, ".")) {
continue;
}
std::string full_element_path = path + "/" + result->d_name;
@@ -131,7 +131,7 @@ bool file_system::CreateDirectoryRecursively(const std::string& path) {
}
bool file_system::IsDirectory(const std::string& name) {
- struct stat status = { 0 };
+ struct stat status = {0};
if (-1 == stat(name.c_str(), &status)) {
return false;
@@ -141,7 +141,7 @@ bool file_system::IsDirectory(const std::string& name) {
}
bool file_system::DirectoryExists(const std::string& name) {
- struct stat status = { 0 };
+ struct stat status = {0};
if (-1 == stat(name.c_str(), &status) || !S_ISDIR(status.st_mode)) {
return false;
@@ -151,7 +151,7 @@ bool file_system::DirectoryExists(const std::string& name) {
}
bool file_system::FileExists(const std::string& name) {
- struct stat status = { 0 };
+ struct stat status = {0};
if (-1 == stat(name.c_str(), &status)) {
return false;
@@ -159,9 +159,9 @@ bool file_system::FileExists(const std::string& name) {
return true;
}
-bool file_system::Write(
- const std::string& file_name, const std::vector<uint8_t>& data,
- std::ios_base::openmode mode) {
+bool file_system::Write(const std::string& file_name,
+ const std::vector<uint8_t>& data,
+ std::ios_base::openmode mode) {
std::ofstream file(file_name.c_str(), std::ios_base::binary | mode);
if (file.is_open()) {
for (uint32_t i = 0; i < data.size(); ++i) {
@@ -175,15 +175,13 @@ bool file_system::Write(
std::ofstream* file_system::Open(const std::string& file_name,
std::ios_base::openmode mode) {
-
-
std::ofstream* file = new std::ofstream();
- file->open( file_name.c_str(),std::ios_base::binary | mode);
+ file->open(file_name.c_str(), std::ios_base::binary | mode);
if (file->is_open()) {
-
return file;
}
+ delete file;
return NULL;
}
@@ -215,6 +213,15 @@ std::string file_system::CurrentWorkingDirectory() {
return std::string(path);
}
+std::string file_system::GetAbsolutePath(const std::string& path) {
+ char abs_path[PATH_MAX];
+ if (NULL == realpath(path.c_str(), abs_path)) {
+ return std::string();
+ }
+
+ return std::string(abs_path);
+}
+
bool file_system::DeleteFile(const std::string& name) {
if (FileExists(name) && IsAccessible(name, W_OK)) {
return !remove(name.c_str());
@@ -232,7 +239,7 @@ void file_system::remove_directory_content(const std::string& directory_name) {
char* direntbuffer =
new char[offsetof(struct dirent, d_name) +
pathconf(directory_name.c_str(), _PC_NAME_MAX) + 1];
- struct dirent* dir_element = new(direntbuffer) dirent;
+ struct dirent* dir_element = new (direntbuffer) dirent;
#endif
struct dirent* result = NULL;
@@ -243,8 +250,8 @@ void file_system::remove_directory_content(const std::string& directory_name) {
for (; NULL != result && 0 == return_code;
return_code = readdir_r(directory, dir_element, &result)) {
- if (0 == strcmp(result->d_name, "..")
- || 0 == strcmp(result->d_name, ".")) {
+ if (0 == strcmp(result->d_name, "..") ||
+ 0 == strcmp(result->d_name, ".")) {
continue;
}
@@ -267,8 +274,7 @@ void file_system::remove_directory_content(const std::string& directory_name) {
bool file_system::RemoveDirectory(const std::string& directory_name,
bool is_recursively) {
- if (DirectoryExists(directory_name)
- && IsAccessible(directory_name, W_OK)) {
+ if (DirectoryExists(directory_name) && IsAccessible(directory_name, W_OK)) {
if (is_recursively) {
remove_directory_content(directory_name);
}
@@ -291,7 +297,7 @@ bool file_system::IsReadingAllowed(const std::string& name) {
}
std::vector<std::string> file_system::ListFiles(
- const std::string& directory_name) {
+ const std::string& directory_name) {
std::vector<std::string> listFiles;
if (!DirectoryExists(directory_name)) {
return listFiles;
@@ -306,7 +312,7 @@ std::vector<std::string> file_system::ListFiles(
char* direntbuffer =
new char[offsetof(struct dirent, d_name) +
pathconf(directory_name.c_str(), _PC_NAME_MAX) + 1];
- struct dirent* dir_element = new(direntbuffer) dirent;
+ struct dirent* dir_element = new (direntbuffer) dirent;
#endif
struct dirent* result = NULL;
@@ -316,8 +322,8 @@ std::vector<std::string> file_system::ListFiles(
for (; NULL != result && 0 == return_code;
return_code = readdir_r(directory, dir_element, &result)) {
- if (0 == strcmp(result->d_name, "..")
- || 0 == strcmp(result->d_name, ".")) {
+ if (0 == strcmp(result->d_name, "..") ||
+ 0 == strcmp(result->d_name, ".")) {
continue;
}
@@ -325,7 +331,6 @@ std::vector<std::string> file_system::ListFiles(
}
closedir(directory);
-
}
#ifdef __QNXNTO__
@@ -338,7 +343,7 @@ std::vector<std::string> file_system::ListFiles(
bool file_system::WriteBinaryFile(const std::string& name,
const std::vector<uint8_t>& contents) {
using namespace std;
- ofstream output(name.c_str(), ios_base::binary|ios_base::trunc);
+ ofstream output(name.c_str(), ios_base::binary | ios_base::trunc);
output.write(reinterpret_cast<const char*>(&contents.front()),
contents.size());
return output.good();
@@ -353,7 +358,7 @@ bool file_system::ReadBinaryFile(const std::string& name,
std::ifstream file(name.c_str(), std::ios_base::binary);
std::ostringstream ss;
ss << file.rdbuf();
- const std::string& s = ss.str();
+ const std::string s = ss.str();
result.resize(s.length());
std::copy(s.begin(), s.end(), result.begin());
@@ -377,29 +382,20 @@ const std::string file_system::ConvertPathForURL(const std::string& path) {
std::string::const_iterator it_path_end = path.end();
const std::string reserved_symbols = "!#$&'()*+,:;=?@[] ";
- std::string::const_iterator it_sym = reserved_symbols.begin();
- std::string::const_iterator it_sym_end = reserved_symbols.end();
-
+ size_t pos = std::string::npos;
std::string converted_path;
- while (it_path != it_path_end) {
- it_sym = reserved_symbols.begin();
- for (; it_sym != it_sym_end; ++it_sym) {
-
- if (*it_path == *it_sym) {
- const size_t size = 100;
- char percent_value[size];
- snprintf(percent_value, size, "%%%x", *it_path);
- converted_path += percent_value;
- ++it_path;
- continue;
- }
+ for (; it_path != it_path_end; ++it_path) {
+ pos = reserved_symbols.find_first_of(*it_path);
+ if (pos != std::string::npos) {
+ const size_t size = 100;
+ char percent_value[size];
+ snprintf(percent_value, size, "%%%x", *it_path);
+ converted_path += percent_value;
+ } else {
+ converted_path += *it_path;
}
-
- converted_path += *it_path;
- ++it_path;
}
-
return converted_path;
}
@@ -413,7 +409,6 @@ bool file_system::CreateFile(const std::string& path) {
}
}
-
uint64_t file_system::GetFileModificationTime(const std::string& path) {
struct stat info;
stat(path.c_str(), &info);
@@ -424,8 +419,7 @@ uint64_t file_system::GetFileModificationTime(const std::string& path) {
#endif
}
-bool file_system::CopyFile(const std::string& src,
- const std::string& dst) {
+bool file_system::CopyFile(const std::string& src, const std::string& dst) {
if (!FileExists(src) || FileExists(dst) || !CreateFile(dst)) {
return false;
}
@@ -437,14 +431,27 @@ bool file_system::CopyFile(const std::string& src,
return true;
}
-bool file_system::MoveFile(const std::string& src,
- const std::string& dst) {
- if (!CopyFile(src, dst)) {
- return false;
- }
- if (!DeleteFile(src)) {
- DeleteFile(dst);
- return false;
+bool file_system::MoveFile(const std::string& src, const std::string& dst) {
+ if (std::rename(src.c_str(), dst.c_str()) == 0) {
+ return true;
+ } else {
+ // In case of src and dst on different file systems std::rename returns
+ // an error (at least on QNX).
+ // Seems, streams are not recommended for use, so have
+ // to find another way to do this.
+ std::ifstream s_src(src, std::ios::binary);
+ if (!s_src.good()) {
+ return false;
+ }
+ std::ofstream s_dst(dst, std::ios::binary);
+ if (!s_dst.good()) {
+ return false;
+ }
+ s_dst << s_src.rdbuf();
+ s_dst.close();
+ s_src.close();
+ DeleteFile(src);
+ return true;
}
- return true;
+ return false;
}
diff --git a/src/components/utils/src/gen_hash.cc b/src/components/utils/src/gen_hash.cc
index 6ac5c217c3..a43b8feb03 100644
--- a/src/components/utils/src/gen_hash.cc
+++ b/src/components/utils/src/gen_hash.cc
@@ -31,15 +31,18 @@
*/
#include "utils/gen_hash.h"
-
#include <cstdlib>
+#include <string>
+#include <locale>
+#include "utils/custom_string.h"
namespace utils {
const std::string gen_hash(size_t size) {
- static const char symbols[] = "0123456789"
- "abcdefghijklmnopqrstuvwxyz"
- "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ static const char symbols[] =
+ "0123456789"
+ "abcdefghijklmnopqrstuvwxyz"
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
static const size_t capacity = sizeof(symbols) - 1;
std::string hash(size, '\0');
@@ -50,4 +53,55 @@ const std::string gen_hash(size_t size) {
return hash;
}
+int32_t Djb2HashFromString(const std::string& str_to_hash) {
+ uint32_t hash = 5381U;
+ std::string::const_iterator it = str_to_hash.begin();
+ std::string::const_iterator it_end = str_to_hash.end();
+
+ for (; it != it_end; ++it) {
+ hash = ((hash << 5) + hash) + (*it);
+ }
+
+ // Reset sign bit in case it has been set.
+ // This is needed to avoid overflow for signed int.
+ const int32_t result = hash & 0x7FFFFFFF;
+ return result;
+}
+
+uint32_t CaseInsensitiveFaq6HashFromString(const char* cstr) {
+ uint32_t hash = 0;
+ std::locale loc;
+ for (; *cstr; ++cstr) {
+ char lower_char = std::tolower(*cstr, loc);
+ hash += static_cast<uint32_t>(lower_char);
+ hash += (hash << 10);
+ hash ^= (hash >> 6);
+ }
+ hash += (hash << 3);
+ hash ^= (hash >> 11);
+ hash += (hash << 15);
+
+ return hash;
+}
+
+uint32_t CaseInsensitiveFaq6HashFromString(
+ const custom_string::CustomString& str_to_hash) {
+ uint32_t hash = 0;
+ if (str_to_hash.is_ascii_string()) {
+ hash = CaseInsensitiveFaq6HashFromString(str_to_hash.c_str());
+ } else {
+ const std::wstring& wstr = str_to_hash.ToWStringLowerCase();
+ size_t size = wstr.size();
+ for (size_t i = 0; i < size; ++i) {
+ hash += static_cast<uint32_t>(wstr[i]);
+ hash += (hash << 10);
+ hash ^= (hash >> 6);
+ }
+ hash += (hash << 3);
+ hash ^= (hash >> 11);
+ hash += (hash << 15);
+ }
+ return hash;
+}
+
} // namespace utils
diff --git a/src/components/utils/src/lock_posix.cc b/src/components/utils/src/lock_posix.cc
index d2837708fa..8c943124b4 100644
--- a/src/components/utils/src/lock_posix.cc
+++ b/src/components/utils/src/lock_posix.cc
@@ -31,12 +31,11 @@
*/
#include "utils/lock.h"
-
#include <errno.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
-
+#include <cstring>
#include "utils/logger.h"
namespace sync_primitives {
@@ -49,34 +48,16 @@ Lock::Lock()
is_mutex_recursive_(false)
#endif // NDEBUG
{
- const int32_t status = pthread_mutex_init(&mutex_, NULL);
- if (status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to initialize mutex");
- }
+ Init(false);
}
-Lock::Lock(bool is_mutex_recursive)
+Lock::Lock(bool is_recursive)
#ifndef NDEBUG
: lock_taken_(0),
- is_mutex_recursive_(is_mutex_recursive)
+ is_mutex_recursive_(is_recursive)
#endif // NDEBUG
{
- int32_t status;
-
- if (is_mutex_recursive) {
- pthread_mutexattr_t attr;
-
- pthread_mutexattr_init(&attr);
- pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
- status = pthread_mutex_init(&mutex_, &attr);
- pthread_mutexattr_destroy(&attr);
- } else {
- status = pthread_mutex_init(&mutex_, NULL);
- }
-
- if (status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to initialize mutex");
- }
+ Init(is_recursive);
}
Lock::~Lock() {
@@ -87,14 +68,17 @@ Lock::~Lock() {
#endif
int32_t status = pthread_mutex_destroy(&mutex_);
if (status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to destroy mutex " << &mutex_ << ": " << strerror(status));
+ LOG4CXX_ERROR(logger_, "Failed to destroy mutex " << &mutex_ << ": "
+ << strerror(status));
}
}
void Lock::Acquire() {
const int32_t status = pthread_mutex_lock(&mutex_);
if (status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to acquire mutex " << &mutex_ << ": " << strerror(status));
+ LOG4CXX_FATAL(logger_, "Failed to acquire mutex " << &mutex_ << ": "
+ << strerror(status));
+ DCHECK(status != 0);
} else {
AssertFreeAndMarkTaken();
}
@@ -104,7 +88,8 @@ void Lock::Release() {
AssertTakenAndMarkFree();
const int32_t status = pthread_mutex_unlock(&mutex_);
if (status != 0) {
- LOG4CXX_ERROR(logger_, "Failed to unlock mutex" << &mutex_ << ": " << strerror(status));
+ LOG4CXX_ERROR(logger_, "Failed to unlock mutex" << &mutex_ << ": "
+ << strerror(status));
}
}
@@ -136,4 +121,24 @@ void Lock::AssertTakenAndMarkFree() {
}
#endif
+void Lock::Init(bool is_recursive) {
+ pthread_mutexattr_t attr;
+ pthread_mutexattr_init(&attr);
+
+ const int32_t mutex_type = is_recursive
+ ? PTHREAD_MUTEX_RECURSIVE
+ : PTHREAD_MUTEX_ERRORCHECK;
+
+ pthread_mutexattr_settype(&attr, mutex_type);
+ const int32_t status = pthread_mutex_init(&mutex_, &attr);
+
+ pthread_mutexattr_destroy(&attr);
+
+ if (status != 0) {
+ LOG4CXX_FATAL(logger_, "Failed to initialize mutex. "
+ << std::strerror(status));
+ DCHECK(status != 0);
+ }
+}
+
} // namespace sync_primitives
diff --git a/src/components/utils/src/logger.cc b/src/components/utils/src/logger.cc
index 72c85424d3..7d6eb6386a 100644
--- a/src/components/utils/src/logger.cc
+++ b/src/components/utils/src/logger.cc
@@ -32,12 +32,14 @@
#include "utils/logger.h"
#include "utils/log_message_loop_thread.h"
+#include "utils/logger_status.h"
#include <apr_time.h>
void deinit_logger () {
- CREATE_LOGGERPTR_LOCAL (logger_, "Logger");
+ CREATE_LOGGERPTR_LOCAL(logger_, "Utils")
LOG4CXX_DEBUG(logger_, "Logger deinitialization");
- logger::LogMessageLoopThread::destroy();
+ logger::set_logs_enabled(false);
+ logger::delete_log_message_loop_thread();
log4cxx::LoggerPtr rootLogger = log4cxx::Logger::getRootLogger();
log4cxx::spi::LoggerRepositoryPtr repository = rootLogger->getLoggerRepository();
log4cxx::LoggerList loggers = repository->getCurrentLoggers();
@@ -46,6 +48,7 @@ void deinit_logger () {
logger->removeAllAppenders();
}
rootLogger->removeAllAppenders();
+ logger::logger_status = logger::LoggerThreadNotCreated;
}
log4cxx_time_t time_now() {
diff --git a/src/components/utils/src/push_log.cc b/src/components/utils/src/push_log.cc
index 49525a4f27..9825ad9df4 100644
--- a/src/components/utils/src/push_log.cc
+++ b/src/components/utils/src/push_log.cc
@@ -36,6 +36,9 @@
namespace logger {
+static bool logs_enabled_ = false;
+static LogMessageLoopThread* log_message_loop_thread = NULL;
+
bool push_log(log4cxx::LoggerPtr logger,
log4cxx::LevelPtr level,
const std::string& entry,
@@ -45,16 +48,19 @@ bool push_log(log4cxx::LoggerPtr logger,
) {
if (LoggerThreadCreated == logger_status) {
LogMessage message = {logger, level, entry, timeStamp, location, threadName};
- LogMessageLoopThread::instance()->PostMessage(message);
- return true;
+ if (log_message_loop_thread) {
+ log_message_loop_thread->PostMessage(message);
+ return true;
+ }
}
if (LoggerThreadNotCreated == logger_status) {
logger_status = CreatingLoggerThread;
// we'll have to drop messages
// while creating logger thread
+ create_log_message_loop_thread();
LogMessage message = {logger, level, entry, timeStamp, location, threadName};
- LogMessageLoopThread::instance()->PostMessage(message);
+ log_message_loop_thread->PostMessage(message);
logger_status = LoggerThreadCreated;
return true;
}
@@ -65,4 +71,31 @@ bool push_log(log4cxx::LoggerPtr logger,
return false;
}
+bool logs_enabled() {
+ return logs_enabled_;
+}
+
+void set_logs_enabled(bool state) {
+ logs_enabled_ = state;
+}
+
+void create_log_message_loop_thread() {
+ if (!log_message_loop_thread) {
+ log_message_loop_thread = new LogMessageLoopThread();
+ }
+}
+
+void delete_log_message_loop_thread() {
+ delete log_message_loop_thread;
+ log_message_loop_thread = NULL;
+}
+
+void flush_logger() {
+ logger::LoggerStatus old_status = logger::logger_status;
+ // Stop pushing new messages to the log queue
+ logger::logger_status = logger::DeletingLoggerThread;
+ log_message_loop_thread->WaitDumpQueue();
+ logger::logger_status = old_status;
+}
+
} // namespace logger
diff --git a/src/components/policy/src/policy/qdb_wrapper/CMakeLists.txt b/src/components/utils/src/qdb_wrapper/CMakeLists.txt
index 8b06351e21..c19321568e 100644
--- a/src/components/policy/src/policy/qdb_wrapper/CMakeLists.txt
+++ b/src/components/utils/src/qdb_wrapper/CMakeLists.txt
@@ -30,12 +30,12 @@
set(target dbms)
-include_directories(include)
+include_directories(${COMPONENTS_DIR}/utils/include/utils)
set(SOURCES
- src/sql_database.cc
- src/sql_query.cc
- src/sql_error.cc
+ ./sql_database.cc
+ ./sql_query.cc
+ ./sql_error.cc
)
add_library(${target} ${SOURCES})
@@ -51,4 +51,4 @@ if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
install(FILES qdbserver.sh DESTINATION bin
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ
GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
-endif () \ No newline at end of file
+endif ()
diff --git a/src/components/policy/src/policy/qdb_wrapper/policy.ini b/src/components/utils/src/qdb_wrapper/policy.ini
index e22a07e815..e22a07e815 100644
--- a/src/components/policy/src/policy/qdb_wrapper/policy.ini
+++ b/src/components/utils/src/qdb_wrapper/policy.ini
diff --git a/src/components/policy/src/policy/qdb_wrapper/qdbserver.sh b/src/components/utils/src/qdb_wrapper/qdbserver.sh
index 40ecbea518..40ecbea518 100755
--- a/src/components/policy/src/policy/qdb_wrapper/qdbserver.sh
+++ b/src/components/utils/src/qdb_wrapper/qdbserver.sh
diff --git a/src/components/policy/src/policy/qdb_wrapper/src/sql_database.cc b/src/components/utils/src/qdb_wrapper/sql_database.cc
index ef26e64353..aabef97f3f 100644
--- a/src/components/policy/src/policy/qdb_wrapper/src/sql_database.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_database.cc
@@ -34,10 +34,10 @@
#include "qdb_wrapper/sql_database.h"
#include "utils/logger.h"
-namespace policy {
+namespace utils {
namespace dbms {
-CREATE_LOGGERPTR_GLOBAL(logger_, "SQLDatabase")
+CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
SQLDatabase::SQLDatabase(const std::string& db_name)
: conn_(NULL),
@@ -111,4 +111,4 @@ bool SQLDatabase::Backup() {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
diff --git a/src/components/policy/src/policy/qdb_wrapper/src/sql_error.cc b/src/components/utils/src/qdb_wrapper/sql_error.cc
index b8f836cc26..22b02a3452 100644
--- a/src/components/policy/src/policy/qdb_wrapper/src/sql_error.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_error.cc
@@ -32,7 +32,7 @@
#include "qdb_wrapper/sql_error.h"
-namespace policy {
+namespace utils {
namespace dbms {
SQLError::SQLError(Error number, const std::string& text)
@@ -62,5 +62,5 @@ std::string SQLError::text() const {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
diff --git a/src/components/policy/src/policy/qdb_wrapper/src/sql_query.cc b/src/components/utils/src/qdb_wrapper/sql_query.cc
index d3191193be..755a595515 100644
--- a/src/components/policy/src/policy/qdb_wrapper/src/sql_query.cc
+++ b/src/components/utils/src/qdb_wrapper/sql_query.cc
@@ -35,10 +35,14 @@
#include <cassert>
#include <algorithm>
#include "qdb_wrapper/sql_database.h"
+#include "utils/logger.h"
+#include <errno.h>
-namespace policy {
+namespace utils {
namespace dbms {
+ CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+
class SetBindInteger {
public:
explicit SetBindInteger(qdb_binding_t* array)
@@ -112,6 +116,7 @@ bool SQLQuery::Prepare(const std::string& query) {
query_ = query;
statement_ = qdb_stmt_init(db_->conn(), query.c_str(), query.length() + 1);
if (statement_ == -1) {
+ LOG4CXX_DEBUG(logger_, "Prepare error: " << strerror(errno));
error_ = Error::ERROR;
return false;
}
@@ -240,6 +245,23 @@ int SQLQuery::GetInteger(int pos) const {
return 0;
}
+uint32_t SQLQuery::GetUInteger(int pos) const {
+ void* ret = qdb_cell(result_, current_row_, pos);
+ if (rows_ !=0 && ret) {
+ return *static_cast<uint32_t*>(ret);
+ }
+ return 0;
+}
+
+int64_t SQLQuery::GetLongInt(int pos) const {
+ void* ret = qdb_cell(result_, current_row_, pos);
+ if (rows_ !=0 && ret) {
+ return *static_cast<int64_t*>(ret);
+ }
+ return 0;
+}
+
+
double SQLQuery::GetDouble(int pos) const {
void* ret = qdb_cell(result_, current_row_, pos);
if (rows_ !=0 && ret) {
@@ -274,5 +296,5 @@ int64_t SQLQuery::LastInsertId() const {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
diff --git a/src/components/utils/src/signals_linux.cc b/src/components/utils/src/signals_linux.cc
index 2e598d1b0f..274c254716 100644
--- a/src/components/utils/src/signals_linux.cc
+++ b/src/components/utils/src/signals_linux.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2016, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -35,29 +35,49 @@
#include "utils/signals.h"
-namespace utils {
+bool utils::UnsibscribeFromTermination() {
+ // Disable some system signals receiving in thread
+ // by blocking those signals
+ // (system signals processes only in the main thread)
+ // Mustn't block all signals!
+ // See "Advanced Programming in the UNIX Environment, 3rd Edition"
+ // (http://poincare.matf.bg.ac.rs/~ivana//courses/ps/sistemi_knjige/pomocno/apue.pdf,
+ // "12.8. Threads and Signals".
+ sigset_t signal_set;
+ sigemptyset(&signal_set);
+ sigaddset(&signal_set, SIGINT);
+ sigaddset(&signal_set, SIGTERM);
-bool SubscribeToTerminateSignal(sighandler_t func) {
+ return !pthread_sigmask(SIG_BLOCK, &signal_set, NULL);
+}
+
+namespace {
+bool CatchSIGSEGV(sighandler_t handler) {
struct sigaction act;
- act.sa_handler = func;
+
+ act.sa_handler = handler;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
- bool sigint_subscribed = (sigaction(SIGINT, &act, NULL) == 0);
- bool sigterm_subscribed = (sigaction(SIGTERM, &act, NULL) == 0);
-
- return sigint_subscribed && sigterm_subscribed;
+ return !sigaction(SIGSEGV, &act, NULL);
}
+} // namespace
-bool SubscribeToFaultSignal(sighandler_t func) {
- struct sigaction act;
- act.sa_handler = func;
- sigemptyset(&act.sa_mask);
- act.sa_flags = SA_RESETHAND; // we only want to catch SIGSEGV once to flush logger queue
+bool utils::WaitTerminationSignals(sighandler_t sig_handler) {
+ sigset_t signal_set;
+ int sig = -1;
- bool sigsegv_subscribed = (sigaction(SIGSEGV, &act, NULL) == 0);
+ sigemptyset(&signal_set);
+ sigaddset(&signal_set, SIGINT);
+ sigaddset(&signal_set, SIGTERM);
- return sigsegv_subscribed;
-}
+ if (!CatchSIGSEGV(sig_handler)) {
+ return false;
+ }
-} // namespace utils
+ if (!sigwait(&signal_set, &sig)) {
+ sig_handler(sig);
+ return true;
+ }
+ return false;
+}
diff --git a/src/components/policy/src/policy/sqlite_wrapper/CMakeLists.txt b/src/components/utils/src/sqlite_wrapper/CMakeLists.txt
index 9007f84745..9a3f3cdd0f 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/CMakeLists.txt
+++ b/src/components/utils/src/sqlite_wrapper/CMakeLists.txt
@@ -32,12 +32,12 @@ set(target dbms)
find_package(Sqlite3 REQUIRED)
-include_directories(include)
+include_directories(${COMPONENTS_DIR}/utils/include/utils)
set(SOURCES
- src/sql_database.cc
- src/sql_query.cc
- src/sql_error.cc
+ ./sql_database.cc
+ ./sql_query.cc
+ ./sql_error.cc
)
add_library(${target} ${SOURCES})
diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc b/src/components/utils/src/sqlite_wrapper/sql_database.cc
index 6a1d70f005..88e43c3675 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/src/sql_database.cc
+++ b/src/components/utils/src/sqlite_wrapper/sql_database.cc
@@ -33,7 +33,7 @@
#include "sqlite_wrapper/sql_database.h"
#include <sqlite3.h>
-namespace policy {
+namespace utils {
namespace dbms {
const std::string SQLDatabase::kInMemory = ":memory:";
@@ -107,8 +107,12 @@ void SQLDatabase::set_path(const std::string& path) {
databasename_ = path + databasename_;
}
+std::string SQLDatabase::get_path() const {
+ return databasename_;
+}
+
bool SQLDatabase::Backup() {
return true;
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_error.cc b/src/components/utils/src/sqlite_wrapper/sql_error.cc
index 6ee82cc23b..791d3455f1 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/src/sql_error.cc
+++ b/src/components/utils/src/sqlite_wrapper/sql_error.cc
@@ -32,7 +32,7 @@
#include "sqlite_wrapper/sql_error.h"
-namespace policy {
+namespace utils {
namespace dbms {
SQLError::SQLError(Error number, const std::string& text)
@@ -149,5 +149,5 @@ std::string SQLError::text() const {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
diff --git a/src/components/policy/src/policy/sqlite_wrapper/src/sql_query.cc b/src/components/utils/src/sqlite_wrapper/sql_query.cc
index d6a643a5d2..ba2af76663 100644
--- a/src/components/policy/src/policy/sqlite_wrapper/src/sql_query.cc
+++ b/src/components/utils/src/sqlite_wrapper/sql_query.cc
@@ -35,7 +35,7 @@
#include <cassert>
#include "sqlite_wrapper/sql_database.h"
-namespace policy {
+namespace utils {
namespace dbms {
SQLQuery::SQLQuery(SQLDatabase* db)
@@ -121,6 +121,16 @@ int SQLQuery::GetInteger(int pos) const {
return sqlite3_column_int(statement_, pos);
}
+uint32_t SQLQuery::GetUInteger(int pos) const {
+ return static_cast<uint32_t>(
+ sqlite3_column_int64(statement_, pos));
+}
+
+int64_t SQLQuery::GetLongInt(int pos) const {
+ return static_cast<int64_t>(
+ sqlite3_column_int64(statement_, pos));
+}
+
double SQLQuery::GetDouble(int pos) const {
return sqlite3_column_double(statement_, pos);
}
@@ -153,5 +163,5 @@ int64_t SQLQuery::LastInsertId() const {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
diff --git a/src/components/utils/src/threads/async_runner.cc b/src/components/utils/src/threads/async_runner.cc
index 4a00317911..f580eebaf0 100644
--- a/src/components/utils/src/threads/async_runner.cc
+++ b/src/components/utils/src/threads/async_runner.cc
@@ -38,7 +38,7 @@
namespace threads {
-CREATE_LOGGERPTR_GLOBAL(logger_, "AsyncRunner");
+CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
AsyncRunner::AsyncRunner(const std::string &thread_name)
: executor_(new AsyncRunnerDelegate) {
diff --git a/src/components/utils/src/threads/posix_thread.cc b/src/components/utils/src/threads/posix_thread.cc
index 3972a40eb1..5e8d609b67 100644
--- a/src/components/utils/src/threads/posix_thread.cc
+++ b/src/components/utils/src/threads/posix_thread.cc
@@ -34,14 +34,10 @@
#include <limits.h>
#include <stddef.h>
#include <signal.h>
-
-#ifdef BUILD_TESTS
-// Temporary fix for UnitTest until APPLINK-9987 is resolved
-#include <unistd.h>
-#endif
+#include <pthread.h>
+#include <sched.h>
#include "utils/threads/thread.h"
-#include "pthread.h"
#include "utils/atomic.h"
#include "utils/threads/thread_delegate.h"
#include "utils/logger.h"
@@ -82,8 +78,6 @@ void* Thread::threadFunc(void* arg) {
// running = 1
// finalized = 1
pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
- LOG4CXX_DEBUG(logger_,
- "Thread #" << pthread_self() << " started successfully");
threads::Thread* thread = reinterpret_cast<Thread*>(arg);
DCHECK(thread);
@@ -98,7 +92,8 @@ void* Thread::threadFunc(void* arg) {
thread->run_cond_.Wait(thread->state_lock_);
LOG4CXX_DEBUG(
logger_,
- "Thread #" << pthread_self() << " execute. " << "stopped_ = " << thread->stopped_ << "; finalized_ = " << thread->finalized_);
+ "Thread #" << pthread_self() << " execute. " << "stopped_ = "
+ << thread->stopped_ << "; finalized_ = " << thread->finalized_);
if (!thread->stopped_ && !thread->finalized_) {
thread->isThreadRunning_ = true;
pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
@@ -131,8 +126,9 @@ void Thread::SetNameForId(const PlatformThreadHandle& thread_id,
const int rc = pthread_setname_np(thread_id, name.c_str());
if (rc != EOK) {
LOG4CXX_WARN(
- logger_,
- "Couldn't set pthread name \"" << name << "\", error code " << rc << " (" << strerror(rc) << ")");
+ logger_,
+ "Couldn't set pthread name \"" << name << "\", error code "
+ << rc << " (" << strerror(rc) << ")");
}
}
@@ -183,16 +179,18 @@ bool Thread::start(const ThreadOptions& options) {
int pthread_result = pthread_attr_init(&attributes);
if (pthread_result != EOK) {
LOG4CXX_WARN(
- logger_,
- "Couldn't init pthread attributes. Error code = " << pthread_result << " (\"" << strerror(pthread_result) << "\")");
+ logger_,
+ "Couldn't init pthread attributes. Error code = "<< pthread_result
+ << " (\"" << strerror(pthread_result) << "\")");
}
if (!thread_options_.is_joinable()) {
pthread_result = pthread_attr_setdetachstate(&attributes, PTHREAD_CREATE_DETACHED);
if (pthread_result != EOK) {
LOG4CXX_WARN(
- logger_,
- "Couldn't set detach state attribute. Error code = " << pthread_result << " (\"" << strerror(pthread_result) << "\")");
+ logger_,
+ "Couldn't set detach state attribute. Error code = " << pthread_result
+ << " (\"" << strerror(pthread_result) << "\")");
thread_options_.is_joinable(false);
}
}
@@ -202,11 +200,11 @@ bool Thread::start(const ThreadOptions& options) {
pthread_result = pthread_attr_setstacksize(&attributes, stack_size);
if (pthread_result != EOK) {
LOG4CXX_WARN(
- logger_,
- "Couldn't set stacksize = " << stack_size << ". Error code = " << pthread_result << " (\"" << strerror(pthread_result) << "\")");
+ logger_,
+ "Couldn't set stacksize = " << stack_size << ". Error code = "
+ << pthread_result << " (\"" << strerror(pthread_result) << "\")");
}
- }
- else {
+ } else {
ThreadOptions thread_options_temp(Thread::kMinStackSize, thread_options_.is_joinable());
thread_options_ = thread_options_temp;
}
@@ -224,18 +222,23 @@ bool Thread::start(const ThreadOptions& options) {
} else {
LOG4CXX_ERROR(
logger_,
- "Couldn't create thread " << name_ << ". Error code = " << pthread_result << " (\"" << strerror(pthread_result) << "\")");
+ "Couldn't create thread " << name_ << ". Error code = "
+ << pthread_result <<" (\"" << strerror(pthread_result) << "\")");
}
}
stopped_ = false;
run_cond_.NotifyOne();
- LOG4CXX_DEBUG(
- logger_,
- "Thread " << name_ << " #" << handle_ << " started. pthread_result = " << pthread_result);
+ LOG4CXX_DEBUG(logger_,
+ "Thread " << name_ << " #" << handle_<< " started." <<
+ " pthread_result = " << pthread_result);
pthread_attr_destroy(&attributes);
return pthread_result == EOK;
}
+void Thread::yield() {
+ sched_yield();
+}
+
void Thread::stop() {
LOG4CXX_AUTO_TRACE(logger_);
sync_primitives::AutoLock auto_lock(state_lock_);
@@ -243,7 +246,7 @@ void Thread::stop() {
stopped_ = true;
LOG4CXX_DEBUG(logger_, "Stopping thread #" << handle_
- << " \"" << name_ << " \"");
+ << " \"" << name_ << "\"");
if (delegate_ && isThreadRunning_) {
delegate_->exitThreadMain();
@@ -263,6 +266,8 @@ void Thread::join() {
run_cond_.NotifyOne();
if (isThreadRunning_) {
if (!pthread_equal(pthread_self(), handle_)) {
+ LOG4CXX_DEBUG(logger_, "Waiting for #"<< handle_
+ << " finished iteration in thread #" << pthread_self());
state_cond_.Wait(auto_lock);
}
}
diff --git a/src/components/utils/src/threads/thread_delegate.cc b/src/components/utils/src/threads/thread_delegate.cc
index 1436ea3377..0e71ca3f59 100644
--- a/src/components/utils/src/threads/thread_delegate.cc
+++ b/src/components/utils/src/threads/thread_delegate.cc
@@ -56,7 +56,7 @@ void ThreadDelegate::exitThreadMain() {
}
void ThreadDelegate::set_thread(Thread *thread) {
- DCHECK(thread && !thread->is_running());
+ DCHECK(thread);
thread_ = thread;
}
diff --git a/src/components/utils/src/timer.cc b/src/components/utils/src/timer.cc
new file mode 100644
index 0000000000..701c36c45c
--- /dev/null
+++ b/src/components/utils/src/timer.cc
@@ -0,0 +1,218 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "utils/timer.h"
+
+#include <ctime>
+#include <cerrno>
+#include <cstring>
+
+#include "utils/timer_task.h"
+#include "utils/date_time.h"
+#include "utils/macro.h"
+
+CREATE_LOGGERPTR_GLOBAL(logger_, "Utils")
+
+using date_time::DateTime;
+
+namespace timer {
+
+// Function HandlePosixTimer is not in anonymous namespace
+// because we need to set this func as friend to Timer
+// and for setting friend function must be located in same namespace with class
+void HandlePosixTimer(sigval signal_value) {
+ LOG4CXX_AUTO_TRACE(logger_);
+
+ DCHECK_OR_RETURN_VOID(signal_value.sival_ptr)
+
+ timer::Timer* timer = static_cast<timer::Timer*>(signal_value.sival_ptr);
+ timer->OnTimeout();
+}
+} // namespace timer
+
+namespace {
+const int kErrorCode = -1;
+
+itimerspec MillisecondsToItimerspec(const timer::Milliseconds miliseconds) {
+ struct itimerspec result;
+
+ result.it_value.tv_sec = miliseconds / DateTime::MILLISECONDS_IN_SECOND;
+ result.it_value.tv_nsec = (miliseconds % DateTime::MILLISECONDS_IN_SECOND) *
+ DateTime::NANOSECONDS_IN_MILLISECOND;
+ result.it_interval.tv_sec = 0;
+ result.it_interval.tv_nsec = 0;
+
+ return result;
+}
+
+timer_t StartPosixTimer(timer::Timer& trackable,
+ const timer::Milliseconds timeout) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ timer_t internal_timer = NULL;
+
+ sigevent signal_event;
+ signal_event.sigev_notify = SIGEV_THREAD;
+ signal_event.sigev_notify_attributes = NULL;
+ signal_event.sigev_value.sival_ptr = static_cast<void*>(&trackable);
+ signal_event.sigev_notify_function = timer::HandlePosixTimer;
+
+ if (timer_create(CLOCK_REALTIME, &signal_event, &internal_timer) ==
+ kErrorCode) {
+ int error_code = errno;
+ LOG4CXX_FATAL(logger_,
+ "Can`t create posix_timer. Error("
+ << error_code << "): " << strerror(error_code));
+ return NULL;
+ }
+ const itimerspec itimer = MillisecondsToItimerspec(timeout);
+
+ if (timer_settime(internal_timer, 0, &itimer, NULL) == kErrorCode) {
+ int error_code = errno;
+ UNUSED(error_code);
+ LOG4CXX_FATAL(logger_,
+ "Can`t set timeout to posix_timer. Error("
+ << error_code << "): " << strerror(error_code));
+ return NULL;
+ }
+ return internal_timer;
+}
+
+bool StopPosixTimer(timer_t timer) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ const int resultCode = timer_delete(timer);
+ if (kErrorCode == resultCode) {
+ int error_code = errno;
+ LOG4CXX_ERROR(logger_,
+ "Can`t delete posix_timer. Error("
+ << error_code << "): " << strerror(error_code));
+ return false;
+ }
+ return true;
+}
+} // namespace
+
+timer::Timer::Timer(const std::string& name, const TimerTask* task_for_tracking)
+ : name_(name)
+ , task_(task_for_tracking)
+ , repeatable_(false)
+ , timeout_ms_(0u)
+ , is_running_(false)
+ , timer_(NULL) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ DCHECK(!name_.empty());
+ DCHECK(task_);
+}
+
+timer::Timer::~Timer() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_, "Timer is to be destroyed " << name_);
+ Stop();
+ sync_primitives::AutoLock auto_lock(task_lock_);
+ DCHECK(task_);
+ delete task_;
+}
+
+void timer::Timer::Start(const Milliseconds timeout, const bool repeatable) {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(lock_);
+ SetTimeoutUnsafe(timeout);
+ repeatable_ = repeatable;
+ if (is_running_) {
+ const bool stop_result = StopUnsafe();
+ DCHECK_OR_RETURN_VOID(stop_result);
+ }
+ StartUnsafe();
+}
+
+void timer::Timer::Stop() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ sync_primitives::AutoLock auto_lock(lock_);
+ repeatable_ = false;
+ if (is_running_) {
+ const bool stop_result = StopUnsafe();
+ DCHECK(stop_result);
+ }
+}
+
+bool timer::Timer::IsRunning() const {
+ sync_primitives::AutoLock auto_lock(lock_);
+ return is_running_;
+}
+
+void timer::Timer::OnTimeout() {
+ LOG4CXX_AUTO_TRACE(logger_);
+ LOG4CXX_DEBUG(logger_,
+ "Timer has finished counting. Timeout(ms): "
+ << static_cast<uint32_t>(timeout_ms_));
+ {
+ // Task locked by own lock because from this task in callback we can
+ // call Stop of this timer and get DeadLock
+ sync_primitives::AutoLock auto_lock(task_lock_);
+ DCHECK(task_);
+ task_->run();
+ }
+ sync_primitives::AutoLock auto_lock(lock_);
+ if (is_running_) {
+ const bool stop_result = StopUnsafe();
+ DCHECK_OR_RETURN_VOID(stop_result);
+ }
+ if (repeatable_) {
+ StartUnsafe();
+ }
+}
+
+void timer::Timer::SetTimeoutUnsafe(const timer::Milliseconds timeout) {
+ timeout_ms_ = (0u != timeout) ? timeout : 1u;
+}
+
+void timer::Timer::StartUnsafe() {
+ LOG4CXX_DEBUG(logger_, "Creating posix_timer in " << name_);
+ // Create new posix timer
+ timer_ = StartPosixTimer(*this, timeout_ms_);
+ DCHECK_OR_RETURN_VOID(timer_);
+ is_running_ = true;
+}
+
+bool timer::Timer::StopUnsafe() {
+ LOG4CXX_DEBUG(logger_, "Stopping timer " << name_);
+ // Destroing of posix timer
+ if (StopPosixTimer(timer_)) {
+ is_running_ = false;
+ return true;
+ }
+ return false;
+}
+
+timer::Milliseconds timer::Timer::GetTimeout() const {
+ sync_primitives::AutoLock auto_lock(lock_);
+ return timeout_ms_;
+}
diff --git a/src/components/utils/test/CMakeLists.txt b/src/components/utils/test/CMakeLists.txt
index d194f7628a..22da78228b 100644
--- a/src/components/utils/test/CMakeLists.txt
+++ b/src/components/utils/test/CMakeLists.txt
@@ -43,12 +43,11 @@ include_directories (
set(testSources
messagemeter_test.cc
file_system_test.cc
- #date_time_test.cc
+ date_time_test.cc
system_test.cc
- signals_linux_test.cc
thread_validator_test.cc
conditional_variable_test.cc
- #message_queue_test.cc
+ message_queue_test.cc
resource_usage_test.cc
bitstream_test.cc
prioritized_queue_test.cc
@@ -57,27 +56,30 @@ set(testSources
singleton_test.cc
#posix_thread_test.cc
stl_utils_test.cc
- #timer_thread_test.cc
rwlock_posix_test.cc
async_runner_test.cc
- #shared_ptr_test.cc
- #scope_guard_test.cc
- #atomic_object_test.cc
+ shared_ptr_test.cc
+ scope_guard_test.cc
+ atomic_object_test.cc
+ message_loop_thread_test.cc
+ custom_string_test.cc
+ timer_test.cc
)
set(testLibraries
gmock
Utils
Policy
+ ConfigProfile
)
-include_directories(${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct_ext)
+include_directories(${COMPONENTS_DIR}/policy/src/policy/policy_table/table_struct)
if (CMAKE_SYSTEM_NAME STREQUAL "QNX")
# --- Tests for QDB Wrapper
list (APPEND testSources
- # ./qdb_wrapper/sql_database_test.cc
- # ./qdb_wrapper/sql_query_test.cc
+ ./qdb_wrapper/sql_database_test.cc
+ ./qdb_wrapper/sql_query_test.cc
)
file(COPY qdbserver.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY test-qdb.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
@@ -86,12 +88,9 @@ else ()
# --- Tests for SQLite Wrapper
find_package(Sqlite3 REQUIRED)
list (APPEND testSources
- # ./sqlite_wrapper/sql_database_test.cc
- # ./sqlite_wrapper/sql_query_test.cc
- # generated_code_with_sqlite_test.cc
-
- # TODO{ALeshin} APPLINK-11132 AssertTrue in SetUpTestCase() return false
- #policy_manager_impl_stress_test.cc
+ ./sqlite_wrapper/sql_database_test.cc
+ ./sqlite_wrapper/sql_query_test.cc
+ generated_code_with_sqlite_test.cc
)
list (APPEND testLibraries sqlite3)
endif()
@@ -107,6 +106,7 @@ endif()
file(COPY testscript.sh DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY log4cxx.properties DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
+file(COPY smartDeviceLink.ini DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
create_test("utils_test" "${testSources}" "${testLibraries}")
diff --git a/src/components/utils/test/auto_trace_test.cc b/src/components/utils/test/auto_trace_test.cc
index a53f4aa1e0..e131caf7c2 100644
--- a/src/components/utils/test/auto_trace_test.cc
+++ b/src/components/utils/test/auto_trace_test.cc
@@ -30,27 +30,42 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
+#include <fstream>
+#include <ctime>
+
#include "gtest/gtest.h"
#include "utils/auto_trace.h"
-#include "logger.h"
-#include <fstream>
+#include "utils/logger.h"
+#include "config_profile/profile.h"
+#include "utils/log_message_loop_thread.h"
+#include "utils/threads/message_loop_thread.h"
+#include "utils/file_system.h"
+#include "utils/threads/thread.h"
+#include "utils/date_time.h"
+#include "utils/logger_status.h"
namespace test {
namespace components {
-namespace utils {
+namespace utils_test {
using namespace ::logger;
-CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog");
+CREATE_LOGGERPTR_GLOBAL(logger_, "AutoTraceTestLog")
void Preconditions() {
- //delete file with previous logs
const char* file_name = "AutoTraceTestLogFile.log";
- std::remove(file_name);
+ // Delete file with previous logs
+ if (file_system::FileExists(file_name)) {
+ ASSERT_TRUE(file_system::DeleteFile(file_name))
+ << "Can't delete AutoTraceTestLogFile.log";
+ }
}
void InitLogger() {
- INIT_LOGGER("log4cxx.properties");
+ // Set enabled logs
+ profile::Profile::instance()->config_file_name("smartDeviceLink.ini");
+ profile::Profile::instance()->UpdateValues();
+ INIT_LOGGER("log4cxx.properties", true); //DEINIT_LOGGER will be called in test_main.cc
}
void CreateDeleteAutoTrace(const std::string & testlog) {
@@ -58,8 +73,7 @@ void CreateDeleteAutoTrace(const std::string & testlog) {
LOG4CXX_DEBUG(logger_, testlog);
}
-bool CheckTraceInFile(const std::string & testlog) {
-
+bool CheckAutoTraceDebugInFile(const std::string & testlog) {
bool isLogFound = false;
std::string line;
@@ -81,22 +95,25 @@ bool CheckTraceInFile(const std::string & testlog) {
return isLogFound;
}
-void DeinitLogger() {
- DEINIT_LOGGER();
-}
-
-//TODO(VVeremjova) APPLINK-12832 Logger does not write debug information in file
-TEST(AutoTraceTest, DISABLED_Basic) {
+TEST(AutoTraceTest, AutoTrace_WriteToFile_ReadCorrectString) {
const std::string testlog =
- "Test trace is working!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!";
+ "Test trace is working!";
Preconditions();
InitLogger();
CreateDeleteAutoTrace(testlog);
- DeinitLogger();
- ASSERT_TRUE(CheckTraceInFile(testlog));
+ const TimevalStruct startTime = date_time::DateTime::getCurrentTime();
+ const int64_t timeout_msec = 10000;
+ // Waiting for empty Logger MessageQueue 10 seconds
+ LogMessageLoopThread loop_thread;
+ while (loop_thread.GetMessageQueueSize()) {
+ ASSERT_LT(date_time::DateTime::calculateTimeDiff(
+ date_time::DateTime::getCurrentTime(), startTime), timeout_msec);
+ threads::Thread::yield();
+ }
+ ASSERT_TRUE(CheckAutoTraceDebugInFile(testlog));
}
-} // namespace utils
+} // namespace utils_test
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/custom_string_test.cc b/src/components/utils/test/custom_string_test.cc
new file mode 100644
index 0000000000..8c42e9a513
--- /dev/null
+++ b/src/components/utils/test/custom_string_test.cc
@@ -0,0 +1,319 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <iostream>
+#include <string>
+#include "gtest/gtest.h"
+#include "custom_string.h"
+
+namespace custom_str = utils::custom_string;
+
+namespace test {
+namespace components {
+namespace utils {
+
+std::string CreateMultibyteString(uint8_t* array, size_t array_size) {
+ return std::string(array, array + array_size);
+}
+
+class CustomStringTest : public ::testing::TestWithParam<std::string> {
+ protected:
+ static void SetUpTestCase() {
+ const size_t kSizeStr = 8;
+ uint8_t array[] = {0xD0,
+ 0xA2,
+ 0xD0,
+ 0xB5,
+ 0xD1,
+ 0x81,
+ 0xD1,
+ 0x82}; // Array contains russian word "Тест"
+ mbstring1_ = CreateMultibyteString(array, kSizeStr);
+ mbstring2_ = mbstring1_ + "abc";
+ amount_symbols_mbstring1_ = 4; // amount of symbols from string mbstring1_
+ amount_symbols_mbstring2_ = 7; // amount of symbols from string mbstring2_
+ amount_bytes_mbstring1_ = mbstring1_.size();
+ amount_bytes_mbstring2_ = mbstring2_.size();
+ }
+
+ public:
+ static std::string mbstring1_; // String contains russian word "Тест"
+ static std::string
+ mbstring2_; // String contains russian word with ASCII symbols "Тестabc"
+ static size_t amount_symbols_mbstring1_;
+ static size_t amount_symbols_mbstring2_;
+ static size_t amount_bytes_mbstring1_;
+ static size_t amount_bytes_mbstring2_;
+};
+
+std::string CustomStringTest::mbstring1_ = "";
+std::string CustomStringTest::mbstring2_ = "";
+size_t CustomStringTest::amount_symbols_mbstring1_ = 0;
+size_t CustomStringTest::amount_symbols_mbstring2_ = 0;
+size_t CustomStringTest::amount_bytes_mbstring1_ = 0;
+size_t CustomStringTest::amount_bytes_mbstring2_ = 0;
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectSizeAndIsASCIIStringEQTrue) {
+ std::string str("Test string");
+ custom_str::CustomString obj(str);
+
+ EXPECT_EQ(str.size(), obj.size());
+ EXPECT_EQ(str.length(), obj.length());
+ EXPECT_EQ(str.size(), obj.length_bytes());
+ EXPECT_TRUE(obj.is_ascii_string());
+ EXPECT_FALSE(obj.empty());
+}
+
+TEST_F(CustomStringTest,
+ AddEmptyToCustomString_ExpectCorrectSizeAndIsASCIIStringEQTrue) {
+ std::string str;
+ custom_str::CustomString obj(str);
+
+ EXPECT_EQ(str.size(), obj.size());
+ EXPECT_EQ(str.length(), obj.length());
+ EXPECT_EQ(str.size(), obj.length_bytes());
+ EXPECT_TRUE(obj.is_ascii_string());
+ EXPECT_TRUE(obj.empty());
+}
+
+TEST_F(CustomStringTest,
+ AddEmptyToCustomString_ExpectCorrectWorkOfMethodAsMBString) {
+ std::string str;
+ custom_str::CustomString obj(str);
+ EXPECT_TRUE(str == obj.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfMethodAsMBString) {
+ std::string str("Test string");
+ custom_str::CustomString obj(str);
+ EXPECT_TRUE(str == obj.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfAppendOperator) {
+ custom_str::CustomString obj("Test string");
+ custom_str::CustomString obj1("abc");
+ custom_str::CustomString obj_empty;
+ std::string str("abc");
+ std::string str_empty;
+ std::string str_result("Test stringabc");
+ std::string str_result1("Test string");
+ custom_str::CustomString obj_result;
+ obj_result = obj + obj1;
+ EXPECT_TRUE(str_result == obj_result.AsMBString());
+ obj_result = obj + obj_empty;
+ EXPECT_TRUE(str_result1 == obj_result.AsMBString());
+ obj_result = obj + str;
+ EXPECT_TRUE(str_result == obj_result.AsMBString());
+ obj_result = obj + str_empty;
+ EXPECT_TRUE(str_result1 == obj_result.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddEmptyStringToCustomString_ExpectCorrectWorkOfAppendOperator) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj("abc");
+ custom_str::CustomString obj_empty1;
+ std::string str("abc");
+ std::string str_empty;
+ custom_str::CustomString obj_result;
+ obj_result = obj_empty + obj;
+ EXPECT_TRUE(str == obj_result.AsMBString());
+ obj_result = obj_empty + obj_empty1;
+ EXPECT_TRUE(str_empty == obj_result.AsMBString());
+ obj_result = obj_empty + str;
+ EXPECT_TRUE(str == obj_result.AsMBString());
+ obj_result = obj_empty + str_empty;
+ EXPECT_TRUE(str_empty == obj_result.AsMBString());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddASCIIAndEmptyStringToCustomString_ExpectCorrectWorkOfCompareOperator) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj_empty1;
+ custom_str::CustomString obj("abc");
+ custom_str::CustomString obj1("abc");
+ std::string str_empty;
+ std::string str("abc");
+
+ EXPECT_TRUE(obj_empty == obj_empty1);
+ EXPECT_FALSE(obj_empty == obj1);
+ EXPECT_TRUE(obj_empty == str_empty);
+ EXPECT_FALSE(obj_empty == str);
+ EXPECT_TRUE(obj == obj1);
+ EXPECT_TRUE(obj == str);
+ EXPECT_FALSE(obj == str_empty);
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIAndEmptyStringToCustomString_ExpectCorrectWorkOfCompareMethod) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj("abc");
+ std::string str_empty;
+ std::string str("abc");
+
+ EXPECT_TRUE(obj_empty.compare(str_empty) == 0);
+ EXPECT_TRUE(obj_empty.compare(str) != 0);
+ EXPECT_TRUE(obj_empty.compare("") == 0);
+ EXPECT_TRUE(obj_empty.compare("abc") != 0);
+ EXPECT_TRUE(obj.compare(str_empty) != 0);
+ EXPECT_TRUE(obj.compare(str) == 0);
+ EXPECT_TRUE(obj.compare("") != 0);
+ EXPECT_TRUE(obj.compare("abc") == 0);
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfAtMethod) {
+ std::string str("abc");
+ custom_str::CustomString obj(str);
+ for (size_t i = 0; i < obj.size(); ++i) {
+ EXPECT_TRUE(obj.at(i) == str[i]);
+ }
+}
+
+TEST_F(
+ CustomStringTest,
+ AddASCIIAndEmptyStringToCustomString_ExpectCorrectWorkOfCompareIgnoreCaseMethod) {
+ custom_str::CustomString obj_empty;
+ custom_str::CustomString obj_empty1;
+ custom_str::CustomString obj("abc");
+ custom_str::CustomString obj1("AbC");
+ custom_str::CustomString obj2("AbCd");
+
+ EXPECT_TRUE(obj_empty.CompareIgnoreCase(obj_empty1));
+ EXPECT_FALSE(obj_empty.CompareIgnoreCase(obj));
+ EXPECT_TRUE(obj.CompareIgnoreCase(obj1));
+ EXPECT_TRUE(obj.CompareIgnoreCase(obj));
+ EXPECT_FALSE(obj.CompareIgnoreCase(obj2));
+ EXPECT_FALSE(obj.CompareIgnoreCase(obj_empty));
+}
+
+TEST_F(CustomStringTest,
+ AddASCIIStringToCustomString_ExpectCorrectWorkOfToWStringMethod) {
+ custom_str::CustomString obj("abc");
+ std::wstring wstr(L"abc");
+ EXPECT_TRUE(wstr == obj.ToWString());
+}
+
+TEST_F(CustomStringTest,
+ AddUTF8StringToCustomString_ExpectCorrectSizeAndIsASCIIStringEQFalse) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ EXPECT_EQ(obj.size(), CustomStringTest::amount_symbols_mbstring1_);
+ EXPECT_EQ(obj.length(), CustomStringTest::amount_symbols_mbstring1_);
+ EXPECT_EQ(obj.length_bytes(), CustomStringTest::amount_bytes_mbstring1_);
+ EXPECT_FALSE(obj.is_ascii_string());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddMixingUTF8WithASCIIStringToCustomString_ExpectCorrectSizeAndIsASCIIStringEQFalse) {
+ custom_str::CustomString obj(CustomStringTest::mbstring2_);
+ EXPECT_EQ(obj.size(), CustomStringTest::amount_symbols_mbstring2_);
+ EXPECT_EQ(obj.length(), CustomStringTest::amount_symbols_mbstring2_);
+ EXPECT_EQ(obj.length_bytes(), CustomStringTest::amount_bytes_mbstring2_);
+ EXPECT_FALSE(obj.is_ascii_string());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddUTF8StringAndMixingUTF8WithASCIIToCustomString_ExpectCorrectWorkOfMethodAsMBString) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ EXPECT_TRUE(CustomStringTest::mbstring1_ == obj.AsMBString());
+ EXPECT_TRUE(CustomStringTest::mbstring2_ == obj1.AsMBString());
+}
+
+TEST_F(CustomStringTest,
+ AddUTF8StringToCustomString_ExpectCorrectConvertingToWString) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ std::wstring wstr1(L"Тест");
+ std::wstring wstr2(L"Тестabc");
+ EXPECT_TRUE(wstr1 == obj.ToWString());
+ EXPECT_TRUE(wstr2 == obj1.ToWString());
+}
+
+TEST_F(
+ CustomStringTest,
+ AddSameMultiByteStringsToCustomString_ExpectCorrectCaseSensetiveComparing) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj_1(CustomStringTest::mbstring1_);
+ EXPECT_TRUE(obj == obj_1);
+ EXPECT_TRUE(obj == CustomStringTest::mbstring1_);
+ EXPECT_EQ(0, obj.compare(CustomStringTest::mbstring1_.c_str()));
+ EXPECT_EQ(0, obj.compare(CustomStringTest::mbstring1_));
+}
+
+TEST_F(
+ CustomStringTest,
+ AddDiferenceMultiByteStringsToCustomString_ExpectCorrectCaseSensetiveComparing) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ EXPECT_FALSE(obj == obj1);
+ EXPECT_FALSE(obj == CustomStringTest::mbstring2_);
+ EXPECT_TRUE(obj.compare(CustomStringTest::mbstring2_) != 0);
+}
+
+TEST_F(
+ CustomStringTest,
+ AddDiferenceMultiByteStringsToCustomString_ExpectCorrectCaseInsensitiveComparing) {
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(CustomStringTest::mbstring2_);
+ EXPECT_FALSE(obj.CompareIgnoreCase(obj1));
+ EXPECT_FALSE(obj.CompareIgnoreCase(CustomStringTest::mbstring2_.c_str()));
+}
+
+TEST_F(
+ CustomStringTest,
+ AddSameMultiByteStringsToCustomString_ExpectCorrectCaseInsensitiveComparing) {
+ const size_t kSizeStr = 8;
+ uint8_t array[] = {0xD1,
+ 0x82,
+ 0xD0,
+ 0xB5,
+ 0xD1,
+ 0x81,
+ 0xD0,
+ 0xA2}; // String contains russian word "тесТ"
+ std::string mbstring = CreateMultibyteString(array, kSizeStr);
+ custom_str::CustomString obj(CustomStringTest::mbstring1_);
+ custom_str::CustomString obj1(mbstring);
+ EXPECT_TRUE(obj.CompareIgnoreCase(obj1));
+ EXPECT_TRUE(obj.CompareIgnoreCase(mbstring.c_str()));
+}
+
+} // namespace utils
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/date_time_test.cc b/src/components/utils/test/date_time_test.cc
index db2b101825..c5deba8f5c 100644
--- a/src/components/utils/test/date_time_test.cc
+++ b/src/components/utils/test/date_time_test.cc
@@ -60,7 +60,7 @@ TEST(DateTimeTest, GetSecs) {
//arrange
TimevalStruct time;
time.tv_sec = 1;
- time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
//assert
ASSERT_EQ(1, date_time::DateTime::getSecs(time));
@@ -70,11 +70,11 @@ TEST(DateTimeTest, GetmSecs) {
//arrange
TimevalStruct time;
time.tv_sec = 1;
- time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
int64_t expect_value = time.tv_sec
* date_time::DateTime::MILLISECONDS_IN_SECOND
- + time.tv_usec / date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ + time.tv_usec / date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
//assert
ASSERT_EQ(expect_value, date_time::DateTime::getmSecs(time));
}
@@ -87,7 +87,7 @@ TEST(DateTimeTest, GetuSecs) {
int64_t expect_value = time.tv_sec
* date_time::DateTime::MILLISECONDS_IN_SECOND
- * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS + time.tv_usec;
+ * date_time::DateTime::MICROSECONDS_IN_MILLISECOND + time.tv_usec;
//assert
ASSERT_EQ(expect_value, date_time::DateTime::getuSecs(time));
}
@@ -99,7 +99,7 @@ TEST(DateTimeTest, GetuSecsmSecs) {
time.tv_usec = 6;
int64_t expect_value = date_time::DateTime::getuSecs(time)
- / date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ / date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
//assert
ASSERT_EQ(expect_value, date_time::DateTime::getmSecs(time));
@@ -110,7 +110,7 @@ TEST(DateTimeTest, CalculateTimeSpan) {
const TimevalStruct time = date_time::DateTime::getCurrentTime();
const uint32_t sleep_time_mSec = 10;
- usleep(sleep_time_mSec * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS);
+ usleep(sleep_time_mSec * date_time::DateTime::MICROSECONDS_IN_MILLISECOND);
//assert
ASSERT_GE(date_time::DateTime::calculateTimeSpan(time), sleep_time_mSec);
@@ -121,11 +121,11 @@ TEST(DateTimeTest, CalculateTimeDiff) {
//arrange
TimevalStruct time1;
time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
TimevalStruct time2;
time2.tv_sec = 3;
- time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
//time2 to time1
TimevalStruct diff1;
@@ -153,11 +153,11 @@ TEST(DateTimeTest, CalculateTimeDiff) {
TEST(DateTimeTest, CalculateEqualTimeDiff) {
TimevalStruct time1;
time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
TimevalStruct time2;
time2.tv_sec = 1;
- time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time2.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time2, time1));
ASSERT_EQ(0, date_time::DateTime::calculateTimeDiff(time1, time2));
@@ -168,11 +168,11 @@ TEST(DateTimeTest, compareTime) {
//arrange
TimevalStruct time1;
time1.tv_sec = 1;
- time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time1.tv_usec = 2 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
TimevalStruct time2;
time2.tv_sec = 2;
- time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time2.tv_usec = 4 * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
//assert
ASSERT_EQ(LESS, date_time::DateTime::compareTime(time1, time2));
diff --git a/src/components/utils/test/file_system_test.cc b/src/components/utils/test/file_system_test.cc
index 4e36608f9f..1d90721680 100644
--- a/src/components/utils/test/file_system_test.cc
+++ b/src/components/utils/test/file_system_test.cc
@@ -32,6 +32,9 @@
#include <algorithm>
#include <fstream>
+#include <vector>
+#include <string>
+
#include "gtest/gtest.h"
#include "utils/file_system.h"
@@ -39,10 +42,24 @@ namespace test {
namespace components {
namespace utils {
+typedef std::vector<std::string> StringArray;
+
using namespace file_system;
-TEST(FileSystemTest, CreateDeleteDirectory) {
+namespace {
+StringArray MergeStringsToArray(const std::string& first,
+ const std::string& second) {
+ StringArray array_of_strings;
+ array_of_strings.reserve(2);
+
+ array_of_strings.push_back(first);
+ array_of_strings.push_back(second);
+ return array_of_strings;
+}
+}
+
+TEST(FileSystemTest, CreateDeleteDirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
// Directory creation
CreateDirectory("./Test directory");
@@ -69,12 +86,12 @@ TEST(FileSystemTest, CreateDirectoryTwice) {
// Directory removing
EXPECT_TRUE(RemoveDirectory("./Test directory", false));
- //try delete directory again
+ // Try to delete directory again
EXPECT_FALSE(RemoveDirectory("./Test directory", false));
EXPECT_FALSE(DirectoryExists("./Test directory"));
}
-TEST(FileSystemTest,DeleteDirectoryRecursively) {
+TEST(FileSystemTest, DeleteDirectoryRecursively) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
// Create directories
CreateDirectory("./Test directory");
@@ -119,9 +136,8 @@ TEST(FileSystemTest, CreateDirectoryRecursivelyDeleteRecursively) {
TEST(FileSystemTest, TwiceCreateDirectoryRecursivelyDeleteRecursivelyOnce) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
// Create directories recursively
- EXPECT_TRUE(
- CreateDirectoryRecursively(
- "./Test directory/Test directory 2/Test directory 3"));
+ EXPECT_TRUE(CreateDirectoryRecursively(
+ "./Test directory/Test directory 2/Test directory 3"));
// Check that all directories are created
EXPECT_TRUE(DirectoryExists("./Test directory"));
@@ -136,9 +152,8 @@ TEST(FileSystemTest, TwiceCreateDirectoryRecursivelyDeleteRecursivelyOnce) {
IsDirectory("./Test directory/Test directory 2/Test directory 3"));
// Create directories recursively second time
- EXPECT_TRUE(
- CreateDirectoryRecursively(
- "./Test directory/Test directory 2/Test directory 3"));
+ EXPECT_TRUE(CreateDirectoryRecursively(
+ "./Test directory/Test directory 2/Test directory 3"));
EXPECT_TRUE(DirectoryExists("./Test directory"));
@@ -167,7 +182,7 @@ TEST(FileSystemTest, CreateDeleteFile) {
// Delete file
EXPECT_TRUE(DeleteFile("./test file"));
- //try delete file again
+ // Try to delete file again
EXPECT_FALSE(DeleteFile("./test file"));
EXPECT_FALSE(FileExists("./test file"));
}
@@ -264,11 +279,11 @@ TEST(FileSystemTest, OpenFileWriteInFileStream) {
delete test_file;
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
-// Check data
+ // Check data
for (uint i = 0; i < data_size; ++i) {
EXPECT_EQ(data[i], result[i]);
}
@@ -300,7 +315,7 @@ TEST(FileSystemTest, CannotWriteInClosedFileStream) {
delete test_file;
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_TRUE(result.empty());
@@ -327,7 +342,7 @@ TEST(FileSystemTest, CreateWriteInFileStream_CreateFileAgain_FileRewritten) {
Close(test_file);
delete test_file;
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -351,7 +366,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFile_FileStreamNotClosed) {
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -363,7 +378,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFile_FileStreamNotClosed) {
Close(test_file);
delete test_file;
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -371,7 +386,8 @@ TEST(FileSystemTest, CreateFileStream_WriteInFile_FileStreamNotClosed) {
EXPECT_FALSE(FileExists("./test file"));
}
-TEST(FileSystemTest, CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLastData) {
+TEST(FileSystemTest,
+ CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLastData) {
ASSERT_FALSE(FileExists("./test file"));
// Create and open file
@@ -380,7 +396,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLa
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -399,7 +415,7 @@ TEST(FileSystemTest, CreateFileStream_WriteInFileWriteInFileStream_FileIncludeLa
Close(test_file);
delete test_file;
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -451,7 +467,7 @@ TEST(FileSystemTest, WriteInFilestreamTwice_FileRewritten) {
delete test_file;
delete test_file_2;
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
// Check data
@@ -503,7 +519,7 @@ TEST(FileSystemTest, WriteInFilestreamConsequentially_FileRewritten) {
delete test_file;
delete test_file_2;
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -529,7 +545,7 @@ TEST(FileSystemTest, CreateFileTwiceWriteInFileTwice) {
EXPECT_TRUE(FileExists("./test file"));
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -540,7 +556,7 @@ TEST(FileSystemTest, CreateFileTwiceWriteInFileTwice) {
EXPECT_TRUE(CreateFile("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (uint i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -549,7 +565,7 @@ TEST(FileSystemTest, CreateFileTwiceWriteInFileTwice) {
EXPECT_TRUE(Write("./test file", data_2));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -574,21 +590,21 @@ TEST(FileSystemTest, WriteInFileTwiceFileRewritten) {
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
EXPECT_TRUE(Write("./test file", data));
// Write data to file again
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (uint i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
EXPECT_TRUE(Write("./test file", data_2));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -610,7 +626,7 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_TRUE(FileExists("./test file"));
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -619,7 +635,7 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_TRUE(Write("./test file", data));
// Write in file second time
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (int i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -628,11 +644,11 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_TRUE(Write("./test file", data_2, std::ios_base::app));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
- std::vector < uint8_t > data_check;
+ std::vector<uint8_t> data_check;
for (int i = 0; i < 2 * data_size; ++i) {
data_check.push_back(i);
}
@@ -647,7 +663,8 @@ TEST(FileSystemTest, WriteDataInTheEndOfFile) {
EXPECT_FALSE(FileExists("./test file"));
}
-TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBothData) {
+TEST(FileSystemTest,
+ WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBothData) {
ASSERT_FALSE(FileExists("./test file"));
// Create and open file
@@ -656,7 +673,7 @@ TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBoth
// Write data in file
uint32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (uint i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -669,7 +686,7 @@ TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBoth
delete test_file;
// Write in file second time
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (uint i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -678,11 +695,11 @@ TEST(FileSystemTest, WriteInFileStream_WriteInFileInTheEndOfFile_FileIncludeBoth
EXPECT_TRUE(Write("./test file", data_2, std::ios_base::app));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
- std::vector < uint8_t > data_check;
+ std::vector<uint8_t> data_check;
for (uint i = 0; i < 2 * data_size; ++i) {
data_check.push_back(i);
}
@@ -717,7 +734,7 @@ TEST(FileSystemTest, OpenFileStreamForRead_WriteInFileStream) {
EXPECT_FALSE(test_file->is_open());
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -738,7 +755,7 @@ TEST(FileSystemTest, OpenFileStreamForRead_WriteInFileStream) {
TEST(FileSystemTest, WriteFileNotExists) {
ASSERT_FALSE(FileExists("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
// File now exists
@@ -751,7 +768,7 @@ TEST(FileSystemTest, WriteFileReadFile) {
ASSERT_FALSE(FileExists("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
@@ -770,12 +787,12 @@ TEST(FileSystemTest, WriteBinaryDataReadBinaryFile) {
ASSERT_FALSE(FileExists("./test file"));
EXPECT_TRUE(CreateFile("./test file"));
- uint8_t tmp[] = { 1, 2, 3, 4};
+ uint8_t tmp[] = {1, 2, 3, 4};
std::vector<uint8_t> data(tmp, tmp + 4);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
// Read data from file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
EXPECT_EQ(data, result);
@@ -790,7 +807,7 @@ TEST(FileSystemTest, WriteBinaryDataTwice_FileRewritten) {
EXPECT_TRUE(FileExists("./test file"));
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -798,7 +815,7 @@ TEST(FileSystemTest, WriteBinaryDataTwice_FileRewritten) {
EXPECT_TRUE(WriteBinaryFile("./test file", data));
// Write in file second time
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (int i = 0; i < data_size; ++i) {
data_2.push_back(i + data_size);
}
@@ -807,7 +824,7 @@ TEST(FileSystemTest, WriteBinaryDataTwice_FileRewritten) {
EXPECT_TRUE(WriteBinaryFile("./test file", data_2));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -825,7 +842,7 @@ TEST(FileSystemTest, WriteBinaryDataFileNotExists) {
ASSERT_FALSE(FileExists("./test file"));
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -839,13 +856,13 @@ TEST(FileSystemTest, WriteBinaryDataFileNotExists) {
TEST(FileSystemTest, WriteDataAsBinaryData) {
ASSERT_FALSE(FileExists("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
ASSERT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -867,7 +884,7 @@ TEST(FileSystemTest, WriteEmptyData) {
ASSERT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_TRUE(result.empty());
@@ -884,7 +901,7 @@ TEST(FileSystemTest, WriteEmptyDataAsBinaryData) {
ASSERT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_TRUE(result.empty());
@@ -896,14 +913,14 @@ TEST(FileSystemTest, WriteBinaryData_WriteDataInTheEndOfFile) {
ASSERT_FALSE(FileExists("./test file"));
// Write binary file
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
ASSERT_TRUE(FileExists("./test file"));
// Write in file second time
int32_t data_size = 4;
- std::vector < uint8_t > data_2;
+ std::vector<uint8_t> data_2;
for (int i = 0; i < data_size; ++i) {
data_2.push_back(i);
}
@@ -912,7 +929,7 @@ TEST(FileSystemTest, WriteBinaryData_WriteDataInTheEndOfFile) {
EXPECT_TRUE(Write("./test file", data_2, std::ios_base::app));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -934,7 +951,7 @@ TEST(FileSystemTest, CreateFile_WriteDataWithFlagOpenForReading) {
EXPECT_TRUE(CreateFile("./test file"));
// Write data in file
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -942,7 +959,7 @@ TEST(FileSystemTest, CreateFile_WriteDataWithFlagOpenForReading) {
EXPECT_TRUE(FileExists("./test file"));
// Check file
- std::vector < uint8_t > result;
+ std::vector<uint8_t> result;
EXPECT_TRUE(ReadBinaryFile("./test file", result));
EXPECT_FALSE(result.empty());
@@ -956,12 +973,13 @@ TEST(FileSystemTest, CreateFile_WriteDataWithFlagOpenForReading) {
EXPECT_FALSE(FileExists("./test file"));
}
-TEST(FileSystemTest, FileDoesNotCreated_WriteFileWithFlagOpenForReadingIsImpossible) {
+TEST(FileSystemTest,
+ FileIsntCreated_WriteFileWithFlagOpenForReadingIsImpossible) {
ASSERT_FALSE(FileExists("./test file"));
// Write data in file is impossible
int32_t data_size = 4;
- std::vector < uint8_t > data;
+ std::vector<uint8_t> data;
for (int i = 0; i < data_size; ++i) {
data.push_back(i);
}
@@ -974,7 +992,7 @@ TEST(FileSystemTest, WriteFileGetSize) {
EXPECT_TRUE(CreateFile("./test file"));
EXPECT_EQ(0, FileSize("./test file"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./test file", data));
@@ -1007,7 +1025,7 @@ TEST(FileSystemTest, GetFileModificationTime) {
uint64_t modif_time = GetFileModificationTime("./test file");
EXPECT_LE(0ul, modif_time);
- std::vector < uint8_t > data(1, 1);
+ std::vector<uint8_t> data(1, 1);
EXPECT_TRUE(WriteBinaryFile("./test file", data));
EXPECT_LE(0ul, GetFileModificationTime("./test file"));
@@ -1021,7 +1039,7 @@ TEST(FileSystemTest, ListFiles) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectory("./Test directory");
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_TRUE(list.empty());
@@ -1046,7 +1064,7 @@ TEST(FileSystemTest, ListFilesIncludeSubdirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectoryRecursively("./Test directory/Test directory 2/");
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_FALSE(list.empty());
EXPECT_EQ(1u, list.size());
@@ -1060,7 +1078,7 @@ TEST(FileSystemTest, ListFilesDoesNotIncludeFilesInSubdirectory) {
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectoryRecursively("./Test directory/Test directory 2/");
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_FALSE(list.empty());
@@ -1079,14 +1097,13 @@ TEST(FileSystemTest, ListFilesDoesNotIncludeFilesInSubdirectory) {
}
TEST(FileSystemTest, GetAvailableDiskSpace) {
-
// Get available disk space before directory with file creaction and after
uint64_t available_space = GetAvailableDiskSpace(".");
EXPECT_NE(0u, available_space);
ASSERT_FALSE(DirectoryExists("./Test directory"));
CreateDirectory("./Test directory");
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./Test directory/test file", data));
@@ -1115,7 +1132,7 @@ TEST(FileSystemTest, DirectorySize) {
// Get size of nonempty directory with empty file
EXPECT_EQ(0u, DirectorySize("./Test directory"));
- unsigned char tmp[] = { 't', 'e', 's', 't' };
+ unsigned char tmp[] = {'t', 'e', 's', 't'};
std::vector<unsigned char> data(tmp, tmp + 4);
EXPECT_TRUE(Write("./Test directory/test file", data));
@@ -1159,7 +1176,7 @@ TEST(FileSystemTest, DeleteAllContentInDirectory) {
DirectoryExists("./Test directory/Test directory 2/Test directory 3"));
EXPECT_FALSE(DirectoryExists("./Test directory/Test directory 2"));
- std::vector < std::string > list;
+ std::vector<std::string> list;
list = ListFiles("./Test directory");
EXPECT_TRUE(list.empty());
@@ -1169,6 +1186,91 @@ TEST(FileSystemTest, DeleteAllContentInDirectory) {
EXPECT_FALSE(DirectoryExists("./Test directory"));
}
+TEST(FileSystemTest, GetAbsolutePath) {
+ const std::string& abs_path = GetAbsolutePath(".");
+ // Getting absolute current path from system
+ const std::string& absolute_current_path = CurrentWorkingDirectory();
+ EXPECT_EQ('/', abs_path[0]);
+ EXPECT_EQ(absolute_current_path, abs_path);
+}
+
+TEST(FileSystemTest,
+ GetAbsolutePath_InvalidOrEmptyPathName_EmptyAbsolutePathName) {
+ // Array of invalid paths
+ const StringArray rel_path = MergeStringsToArray("not_exists_dir", " ");
+
+ // Check
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ("", path_for_check);
+ }
+}
+
+TEST(FileSystemTest, GetAbsolutePath_ValidRelPaths_CorrectAbsolutePath) {
+ // Array of relative dirs
+ const StringArray rel_path = MergeStringsToArray(
+ "first_level_path", "first_level_path/second_level_path1");
+
+ // Create some directories in current
+ CreateDirectoryRecursively(rel_path[1]);
+ // Get absolute current dir
+ const std::string& absolute_current_dir = GetAbsolutePath(".");
+ // Check
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ // Concating rel_path to current dir path
+ const std::string& correct_absolute_path =
+ absolute_current_dir + "/" + rel_path[i];
+ // Get absolute path for rel dir
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ(correct_absolute_path, path_for_check);
+ }
+ // Cleanup after test case
+ if (DirectoryExists(rel_path[0])) {
+ RemoveDirectory(rel_path[0], true);
+ }
+}
+
+TEST(FileSystemTest,
+ GetAbsolutePath_ValidRelPathsFromParrentDir_CorrectAbsolutePath) {
+ // Array of relative dirs
+ const StringArray rel_path = MergeStringsToArray(
+ "../first_level_path", "../first_level_path/second_level_path1");
+
+ // Create some directories in parrent of this
+ CreateDirectoryRecursively(rel_path[1]);
+
+ // Get absolute parrent dir
+ const std::string& absolute_parrent_dir = GetAbsolutePath("../");
+ // Check
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ // Concatenation rel_path to current dir path
+ const std::string& relative_dir_name = rel_path[i].substr(3);
+ const std::string& correct_absolute_path =
+ absolute_parrent_dir + "/" + relative_dir_name;
+ // Get absolute path for rel dir
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ(correct_absolute_path, path_for_check);
+ }
+ // Cleanup after test case
+ if (DirectoryExists(rel_path[0])) {
+ RemoveDirectory(rel_path[0], true);
+ }
+}
+
+TEST(FileSystemTest, GetAbsolutePath_TrickiPath_CorrectAbsolutePath) {
+ // Array of relative dirs
+ const StringArray rel_path =
+ MergeStringsToArray("../src/../../application_manager/../utils/test",
+ "../../../components/utils/test");
+
+ const std::string& absolute_current_path = CurrentWorkingDirectory();
+ for (size_t i = 0; i < rel_path.size(); ++i) {
+ // Get absolute path for rel dir
+ const std::string& path_for_check = GetAbsolutePath(rel_path[i]);
+ EXPECT_EQ(absolute_current_path, path_for_check);
+ }
+}
+
} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/policy/test/generated_code_with_sqlite_test.cc b/src/components/utils/test/generated_code_with_sqlite_test.cc
index 76737c366f..d75d924321 100644
--- a/src/components/policy/test/generated_code_with_sqlite_test.cc
+++ b/src/components/utils/test/generated_code_with_sqlite_test.cc
@@ -70,7 +70,7 @@ const std::string GeneratedCodeTest::kEndpointsCreation =
const std::string GeneratedCodeTest::kEndpointsContent =
"INSERT INTO Endpoints "
- "VALUES (1, '0x07', null, 'http://test.example.com', 1)";
+ "VALUES (1, '0x07', null, 'http://url.example.com', 1)";
const std::string GeneratedCodeTest::kAppPoliciesCreation =
"CREATE TABLE AppPolicies ("
@@ -101,7 +101,7 @@ TEST_F(GeneratedCodeTest, FindSectionEndpoints_OpenDBSetDefaultUrl_ExpectDefault
std::string url = ep["0x07"]["default"].front();
//assert
- EXPECT_EQ("http://test.example.com", url);
+ EXPECT_EQ("http://url.example.com", url);
}
TEST_F(GeneratedCodeTest, RemoveSectionEndpoints_RemoveSectionEndpoints_Expect0EndPoints) {
diff --git a/src/components/policy/test/include/generated_code_with_sqlite_test.h b/src/components/utils/test/include/generated_code_with_sqlite_test.h
index ed231e92d3..4ce14be649 100644
--- a/src/components/policy/test/include/generated_code_with_sqlite_test.h
+++ b/src/components/utils/test/include/generated_code_with_sqlite_test.h
@@ -39,7 +39,7 @@
#include "sqlite_wrapper/sql_database.h"
namespace policy_table = rpc::policy_table_interface_base;
-namespace dbms = policy::dbms;
+namespace dbms = utils::dbms;
namespace rpc {
namespace policy_table_interface_base {
diff --git a/src/components/utils/test/include/test_handler.h b/src/components/utils/test/include/test_handler.h
new file mode 100644
index 0000000000..34127b7bdd
--- /dev/null
+++ b/src/components/utils/test/include/test_handler.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2015, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include <queue>
+
+#include "utils/macro.h"
+#include "utils/threads/message_loop_thread.h"
+
+namespace test {
+namespace components {
+namespace utils_test {
+
+typedef std::queue<bool> BoolQueue;
+typedef threads::MessageLoopThread<BoolQueue> TestLoopThread;
+
+class TestHandler : public TestLoopThread::Handler {
+ virtual void Handle(const BoolQueue::value_type test_value) OVERRIDE {}
+};
+
+} // namespace utils_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/include/utils/mock_timer_task.h b/src/components/utils/test/include/utils/mock_timer_task.h
new file mode 100644
index 0000000000..06ac893c81
--- /dev/null
+++ b/src/components/utils/test/include/utils/mock_timer_task.h
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_TIMER_TASK_H_
+#define SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_TIMER_TASK_H_
+
+#include "gmock/gmock.h"
+#include "utils/timer_task.h"
+
+namespace test {
+namespace components {
+namespace timer_test {
+
+class MockTimerTask : public timer::TimerTask {
+ public:
+ MOCK_CONST_METHOD0(run, void());
+};
+
+} // namespace timer_test
+} // namespace components
+} // namespace test
+
+#endif // SRC_COMPONENTS_UTILS_TEST_INCLUDE_UTILS_MOCK_TIMER_TASK_H_
diff --git a/src/components/utils/test/log_message_loop_thread_test.cc b/src/components/utils/test/log_message_loop_thread_test.cc
index 789bf62f45..d457325d4d 100644
--- a/src/components/utils/test/log_message_loop_thread_test.cc
+++ b/src/components/utils/test/log_message_loop_thread_test.cc
@@ -42,32 +42,14 @@ namespace utils {
using namespace ::logger;
using ::testing::_;
-TEST(LogMessageLoopThread,CreateLogMessageSingleton) {
- //if logger_status is LoggerThreadNotCreated or LoggerThreadCreated,
- // creation of singleton will be impossible
- logger::logger_status = CreatingLoggerThread;
-
- LogMessageLoopThread *instance_1 = LogMessageLoopThread::instance();
- LogMessageLoopThread *instance_2 = LogMessageLoopThread::instance();
-
- //assert
- EXPECT_EQ(instance_1, instance_2);
-
- LogMessageLoopThread::destroy();
-
- EXPECT_FALSE(LogMessageLoopThread::exists());
- logger::logger_status = LoggerThreadNotCreated;
-}
-
TEST(LogMessageLoopThread, DestroyLogMessage_loggerStatusDeletingLogger) {
logger::logger_status = CreatingLoggerThread;
- LogMessageLoopThread::instance();
-
+ LogMessageLoopThread* loop_thread = new LogMessageLoopThread();
//assert
EXPECT_EQ(CreatingLoggerThread, logger::logger_status);
//act
- LogMessageLoopThread::destroy();
+ delete loop_thread;
//assert
EXPECT_EQ(DeletingLoggerThread, logger::logger_status);
@@ -85,9 +67,9 @@ TEST(LogMessageLoopThread, HandleNeverCalled) {
MockLogMessageTest mmock;
EXPECT_CALL(mmock,Handle(_)).Times(0);
- LogMessageLoopThread::instance();
+ LogMessageLoopThread* loop_thread = new LogMessageLoopThread();
- LogMessageLoopThread::destroy();
+ delete loop_thread;
logger::logger_status = LoggerThreadNotCreated;
}
diff --git a/src/components/utils/test/signals_linux_test.cc b/src/components/utils/test/message_loop_thread_test.cc
index 263f240ec8..7778755c68 100644
--- a/src/components/utils/test/signals_linux_test.cc
+++ b/src/components/utils/test/message_loop_thread_test.cc
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, Ford Motor Company
+ * Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -30,26 +30,23 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <unistd.h>
-#include <assert.h>
#include "gtest/gtest.h"
-#include "utils/signals.h"
+#include "test_handler.h"
namespace test {
namespace components {
-namespace utils {
+namespace utils_test {
-void handler(int sig) {
-}
+TEST(MessageLoopThreadTest, GetMessageQueueSize_AddValueToQueue_CorrectSize) {
+ TestHandler test_handler;
+ TestLoopThread message_loop_thread("test", &test_handler);
-TEST(SignalsLinuxTest, SubscribeToTerminateSignal_Positive) {
- ASSERT_TRUE(::utils::SubscribeToTerminateSignal(handler));
-}
+ ASSERT_EQ(0u, message_loop_thread.GetMessageQueueSize());
-TEST(SignalsLinuxTest, SubscribeToFaultSignal_Positive) {
- ASSERT_TRUE(::utils::SubscribeToFaultSignal(handler));
+ message_loop_thread.PostMessage(true);
+ ASSERT_EQ(1u, message_loop_thread.GetMessageQueueSize());
}
-} // namespace utils
-} // namespace components
-} // namespace test
+} // namespace utils_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/messagemeter_test.cc b/src/components/utils/test/messagemeter_test.cc
index 6c13ab345e..0db947e564 100644
--- a/src/components/utils/test/messagemeter_test.cc
+++ b/src/components/utils/test/messagemeter_test.cc
@@ -1,5 +1,5 @@
/*
-* Copyright (c) 2014, Ford Motor Company
+* Copyright (c) 2015, Ford Motor Company
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -57,7 +57,7 @@ const TimePair testing_time_pairs[] = { TimePair(0, 50),
class MessageMeterTest: public ::testing::TestWithParam<TimePair> {
protected:
void SetUp() OVERRIDE {
- usecs = date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ usecs = date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
id1 = 0x0;
id2 = 0xABCDEF;
id3 = 0xFEBCDA;
@@ -73,8 +73,7 @@ class MessageMeterTest: public ::testing::TestWithParam<TimePair> {
<< "Wrong test case with null range value";
meter.set_time_range(time_range);
- // Get range in msec less than original for correct waitng in tests
- time_range_msecs = date_time::DateTime::getmSecs(time_range) * 0.95;
+ time_range_msecs = date_time::DateTime::getmSecs(time_range);
}
void TearDown() OVERRIDE {
}
@@ -100,7 +99,7 @@ TEST(MessageMeterTest, TimeRangeSetter) {
for (int sec = test_count_secs; sec >= 0; --sec) {
for (int msec = test_count_msecs; msec >= 0; --msec) {
time_range.tv_sec = sec;
- time_range.tv_usec = msec * date_time::DateTime::MICROSECONDS_IN_MILLISECONDS;
+ time_range.tv_usec = msec * date_time::DateTime::MICROSECONDS_IN_MILLISECOND;
// Setter TimevalStruct
meter.set_time_range(time_range);
EXPECT_EQ(time_range,
@@ -135,48 +134,66 @@ TEST(MessageMeterTest, AddingWithNullTimeRange) {
}
}
-TEST_P(MessageMeterTest, AddingOverPeriod) {
+TEST_P(MessageMeterTest, TrackMessage_AddingOverPeriod_CorrectCountOfMessages) {
size_t messages = 0;
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
// Add messages for less range period
- while (date_time::DateTime::calculateTimeSpan(start_time)
+ int64_t time_span;
+ while ((time_span = date_time::DateTime::calculateTimeSpan(start_time))
< time_range_msecs) {
++messages;
- EXPECT_EQ(messages,
- meter.TrackMessage(id1));
- EXPECT_EQ(messages,
- meter.Frequency(id1));
+
+ size_t tracked_frequency = meter.TrackMessage(id1);
+ size_t frequency = meter.Frequency(id1);
+
+ EXPECT_GE(messages, tracked_frequency)
+ << "Tracked messages can`t be over cycles.";
+
+ if (messages > frequency) {
+ EXPECT_GE(time_range_msecs, time_span);
+ break;
+ }
+ EXPECT_EQ(tracked_frequency, frequency);
}
}
-TEST_P(MessageMeterTest, AddingOverPeriod_MultiIds) {
+TEST_P(MessageMeterTest,
+ TrackMessage_AddingOverPeriodMultiIds_CorrectCountOfMessages) {
size_t messages = 0;
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
// Add messages for less range period
- while (date_time::DateTime::calculateTimeSpan(start_time)
+ int64_t time_span;
+ while ((time_span = date_time::DateTime::calculateTimeSpan(start_time))
< time_range_msecs) {
++messages;
- // 1st Connection
- EXPECT_EQ(messages,
- meter.TrackMessage(id1));
- EXPECT_EQ(messages,
- meter.Frequency(id1));
-
- // 2d Connection
- EXPECT_EQ(messages,
- meter.TrackMessage(id2));
- EXPECT_EQ(messages,
- meter.Frequency(id2));
- // 3d Connection
- EXPECT_EQ(messages,
- meter.TrackMessage(id3));
- EXPECT_EQ(messages,
- meter.Frequency(id3));
+ size_t tracked_frequency_id1 = meter.TrackMessage(id1);
+ size_t tracked_frequency_id2 = meter.TrackMessage(id2);
+ size_t tracked_frequency_id3 = meter.TrackMessage(id3);
+ size_t frequency_id1 = meter.Frequency(id1);
+ size_t frequency_id2 = meter.Frequency(id2);
+ size_t frequency_id3 = meter.Frequency(id3);
+
+ EXPECT_GE(messages, tracked_frequency_id1)
+ << "Tracked messages can`t be over cycles.";
+ EXPECT_GE(messages, tracked_frequency_id2)
+ << "Tracked messages can`t be over cycles.";
+ EXPECT_GE(messages, tracked_frequency_id3)
+ << "Tracked messages can`t be over cycles.";
+
+ if (messages > frequency_id1 ||
+ messages > frequency_id2 ||
+ messages > frequency_id3) {
+ EXPECT_GE(time_range_msecs, time_span);
+ break;
+ }
+ EXPECT_EQ(tracked_frequency_id1, frequency_id1);
+ EXPECT_EQ(tracked_frequency_id2, frequency_id2);
+ EXPECT_EQ(tracked_frequency_id3, frequency_id3);
}
}
-TEST_P(MessageMeterTest, CountingOverPeriod) {
+TEST_P(MessageMeterTest, Frequency_CountingOverPeriod_CorrectCountOfMessages) {
const size_t one_message = 1;
const TimevalStruct start_time = date_time::DateTime::getCurrentTime();
EXPECT_EQ(one_message,
@@ -185,17 +202,19 @@ TEST_P(MessageMeterTest, CountingOverPeriod) {
meter.TrackMessage(id2));
EXPECT_EQ(one_message,
meter.TrackMessage(id3));
- const int sleep_usecs = 500;
+
// Check messages count over period
- while (date_time::DateTime::calculateTimeSpan(start_time)
+ int64_t time_span;
+ while ((time_span = date_time::DateTime::calculateTimeSpan(start_time))
< time_range_msecs) {
- usleep(sleep_usecs);
- EXPECT_EQ(one_message,
- meter.Frequency(id1));
- EXPECT_EQ(one_message,
- meter.Frequency(id2));
- EXPECT_EQ(one_message,
- meter.Frequency(id3));
+ usleep(time_range_msecs);
+
+ if (one_message != meter.Frequency(id1) ||
+ one_message != meter.Frequency(id2) ||
+ one_message != meter.Frequency(id3)) {
+ EXPECT_GE(time_range_msecs, time_span);
+ break;
+ }
}
}
diff --git a/src/components/policy/test/qdb_wrapper/sql_database_test.cc b/src/components/utils/test/qdb_wrapper/sql_database_test.cc
index a732128f64..881141f18c 100644
--- a/src/components/policy/test/qdb_wrapper/sql_database_test.cc
+++ b/src/components/utils/test/qdb_wrapper/sql_database_test.cc
@@ -36,16 +36,16 @@
#include "qdb_wrapper/sql_error.h"
#include "qdb_wrapper/sql_database.h"
-using ::policy::dbms::SQLError;
-using ::policy::dbms::SQLDatabase;
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
namespace test {
namespace components {
-namespace policy {
+namespace utils {
namespace dbms {
::testing::AssertionResult IsError(SQLError error) {
- if (error.number() != ::policy::dbms::OK) {
+ if (error.number() != ::utils::dbms::OK) {
return ::testing::AssertionSuccess() << error.text();
} else {
return ::testing::AssertionFailure() << error.text();
@@ -134,6 +134,6 @@ TEST(SQLDatabaseTest, BadTransaction) {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/policy/test/qdb_wrapper/sql_query_test.cc b/src/components/utils/test/qdb_wrapper/sql_query_test.cc
index 122241ea1f..4d880a4cda 100644
--- a/src/components/policy/test/qdb_wrapper/sql_query_test.cc
+++ b/src/components/utils/test/qdb_wrapper/sql_query_test.cc
@@ -38,13 +38,13 @@
#include "qdb_wrapper/sql_database.h"
#include "qdb_wrapper/sql_query.h"
-using ::policy::dbms::SQLError;
-using ::policy::dbms::SQLDatabase;
-using ::policy::dbms::SQLQuery;
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLQuery;
namespace test {
namespace components {
-namespace policy {
+namespace utils {
namespace dbms {
class SQLQueryTest : public ::testing::Test {
@@ -296,6 +296,6 @@ TEST_F(SQLQueryTest, DoublePrepare) {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/smartDeviceLink.ini b/src/components/utils/test/smartDeviceLink.ini
new file mode 100644
index 0000000000..8172b3dea6
--- /dev/null
+++ b/src/components/utils/test/smartDeviceLink.ini
@@ -0,0 +1,19 @@
+; The INI-file consists of different chapters.
+; Each chapter begins with the line containing
+; the name in square brackets. Syntax:
+; [chapter]
+; The chapters consists of a set of items with a
+; assigned value. The syntax is:
+; item=value
+; All white spaces an second encounters of chapters
+; or items will be ignored.
+; Remarks start with semicolon or star as first character.
+; It is allowed for names of chapters and items to
+; contain semicolon and star. Possible syntax is:
+; [ chapter ] ;Remark
+; item = value ;Remark
+
+[MAIN]
+
+; All logging event could be dropped by setting $LogsEnabled to false
+LogsEnabled = true
diff --git a/src/components/policy/test/sqlite_wrapper/sql_database_test.cc b/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
index 3bb633b2b1..ab72fb0eff 100644
--- a/src/components/policy/test/sqlite_wrapper/sql_database_test.cc
+++ b/src/components/utils/test/sqlite_wrapper/sql_database_test.cc
@@ -33,16 +33,16 @@
#include "sqlite_wrapper/sql_error.h"
#include "sqlite_wrapper/sql_database.h"
-using ::policy::dbms::SQLError;
-using ::policy::dbms::SQLDatabase;
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
namespace test {
namespace components {
-namespace policy {
+namespace utils {
namespace dbms {
::testing::AssertionResult IsError(SQLError error) {
- if (error.number() != ::policy::dbms::OK) {
+ if (error.number() != ::utils::dbms::OK) {
return ::testing::AssertionSuccess() << error.text();
} else {
return ::testing::AssertionFailure() << error.text();
@@ -224,6 +224,6 @@ TEST(SQLDatabaseTest, IsReadWrite_FirstOpenDBIsRWSecondIsNot) {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/policy/test/sqlite_wrapper/sql_query_test.cc b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
index 83a3bf00cf..07aff6127e 100644
--- a/src/components/policy/test/sqlite_wrapper/sql_query_test.cc
+++ b/src/components/utils/test/sqlite_wrapper/sql_query_test.cc
@@ -38,13 +38,13 @@
#include "sqlite_wrapper/sql_database.h"
#include "sqlite_wrapper/sql_query.h"
-using ::policy::dbms::SQLError;
-using ::policy::dbms::SQLDatabase;
-using ::policy::dbms::SQLQuery;
+using ::utils::dbms::SQLError;
+using ::utils::dbms::SQLDatabase;
+using ::utils::dbms::SQLQuery;
namespace test {
namespace components {
-namespace policy {
+namespace utils {
namespace dbms {
class SQLQueryTest : public ::testing::Test {
@@ -69,7 +69,7 @@ class SQLQueryTest : public ::testing::Test {
}
::testing::AssertionResult IsError(SQLError error) {
- if (error.number() != ::policy::dbms::OK) {
+ if (error.number() != ::utils::dbms::OK) {
return ::testing::AssertionSuccess() << error.text();
} else {
return ::testing::AssertionFailure() << error.text();
@@ -77,7 +77,7 @@ class SQLQueryTest : public ::testing::Test {
}
::testing::AssertionResult IsDone(SQLError error) {
- if (error.number() == ::policy::dbms::DONE) {
+ if (error.number() == ::utils::dbms::DONE) {
return ::testing::AssertionSuccess() << error.text();
} else {
return ::testing::AssertionFailure() << error.text();
@@ -85,7 +85,7 @@ class SQLQueryTest : public ::testing::Test {
}
::testing::AssertionResult IsRow(SQLError error) {
- if (error.number() == ::policy::dbms::ROW) {
+ if (error.number() == ::utils::dbms::ROW) {
return ::testing::AssertionSuccess() << error.text();
} else {
return ::testing::AssertionFailure() << error.text();
@@ -370,6 +370,6 @@ TEST_F(SQLQueryTest, DoublePrepare_TwicePrepareQuery_ActWithoutErrors) {
}
} // namespace dbms
-} // namespace policy
+} // namespace utils
} // namespace components
} // namespace test
diff --git a/src/components/utils/test/timer_test.cc b/src/components/utils/test/timer_test.cc
new file mode 100644
index 0000000000..13bf5eeb0d
--- /dev/null
+++ b/src/components/utils/test/timer_test.cc
@@ -0,0 +1,250 @@
+/*
+ * Copyright (c) 2016, Ford Motor Company
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ *
+ * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided with the
+ * distribution.
+ *
+ * Neither the name of the Ford Motor Company nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "gtest/gtest.h"
+#include "utils/timer.h"
+#include "utils/mock_timer_task.h"
+#include "utils/conditional_variable.h"
+#include "utils/lock.h"
+#include "utils/macro.h"
+#include "utils/timer_task_impl.h"
+
+namespace test {
+namespace components {
+namespace timer_test {
+namespace {
+
+sync_primitives::Lock test_lock;
+sync_primitives::ConditionalVariable lock_monitor;
+const uint32_t kDefaultTimeout = 30u;
+const std::string kTimerName = "test_timer";
+
+class TestTask : public timer::TimerTask {
+ public:
+ TestTask() : calls_count_(0u) {}
+
+ void run() const OVERRIDE {
+ sync_primitives::AutoLock auto_lock(test_lock);
+ ++calls_count_;
+ lock_monitor.NotifyOne();
+ }
+
+ uint GetCallsCount() const {
+ return calls_count_;
+ }
+
+ private:
+ mutable uint calls_count_;
+};
+
+class FakeClassWithTimer {
+ public:
+ FakeClassWithTimer()
+ : calls_count_(0u)
+ , internal_timer_("test_timer",
+ new timer::TimerTaskImpl<FakeClassWithTimer>(
+ this, &FakeClassWithTimer::OnTimer)) {
+ internal_timer_.Start(kDefaultTimeout, true);
+ }
+
+ void OnTimer() {
+ sync_primitives::AutoLock auto_lock_(test_lock);
+ internal_timer_.Stop();
+ ++calls_count_;
+ lock_monitor.NotifyOne();
+ }
+
+ bool IsTimerRunning() const {
+ return internal_timer_.IsRunning();
+ }
+
+ uint GetCallsCount() const {
+ return calls_count_;
+ }
+
+ private:
+ uint calls_count_;
+ timer::Timer internal_timer_;
+};
+} // namespace
+
+class TimerTest : public testing::Test {
+ protected:
+ void SetUp() OVERRIDE {
+ timeout_ = kDefaultTimeout;
+ repeatable_ = false;
+ // Will be destroyed in Timer Destructor
+ test_task_ = new MockTimerTask();
+ }
+ bool repeatable_;
+ MockTimerTask* test_task_;
+ uint32_t timeout_;
+};
+
+TEST_F(TimerTest, Start_ZeroTimeout_CorrectTimeout) {
+ // Preconditions
+ timer::Timer test_timer(kTimerName, test_task_);
+ // Actions
+ test_timer.Start(0u, repeatable_);
+ // Expects
+ EXPECT_EQ(1u, test_timer.GetTimeout());
+
+ test_timer.Stop();
+}
+
+TEST_F(TimerTest, Start_NoLoop_OneCall) {
+ // Preconditions
+ test_lock.Acquire();
+ TestTask* task = new TestTask();
+ timer::Timer test_timer(kTimerName, task);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ ASSERT_TRUE(test_timer.IsRunning());
+ // Wait for call
+ lock_monitor.Wait(test_lock);
+ test_lock.Release();
+ EXPECT_FALSE(test_timer.IsRunning());
+ EXPECT_EQ(1u, task->GetCallsCount());
+}
+
+TEST_F(TimerTest, Start_Loop_3Calls) {
+ // Preconditions
+ uint loops_count = 3u;
+ repeatable_ = true;
+ test_lock.Acquire();
+ TestTask* task = new TestTask();
+ timer::Timer test_timer(kTimerName, task);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ for (uint i = loops_count; i; --i) {
+ lock_monitor.Wait(test_lock);
+ }
+ test_lock.Release();
+ test_timer.Stop();
+
+ EXPECT_EQ(loops_count, task->GetCallsCount());
+}
+
+TEST_F(TimerTest, Start_Runned_RunnedWithNewTimeout) {
+ // Preconditions
+ timer::Timer test_timer(kTimerName, test_task_);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ // Expects
+ ASSERT_EQ(timeout_, test_timer.GetTimeout());
+ ASSERT_TRUE(test_timer.IsRunning());
+ // Actions
+ timeout_ = 1000u;
+ test_timer.Start(timeout_, repeatable_);
+ // Expects
+ ASSERT_EQ(timeout_, test_timer.GetTimeout());
+ ASSERT_TRUE(test_timer.IsRunning());
+}
+
+TEST_F(TimerTest, Start_NotRunned_RunnedWithNewTimeout) {
+ // Preconditions
+ timer::Timer test_timer(kTimerName, test_task_);
+ // Expects
+ ASSERT_EQ(0u, test_timer.GetTimeout());
+ ASSERT_FALSE(test_timer.IsRunning());
+ // Actions
+ timeout_ = 1000u;
+ test_timer.Start(timeout_, repeatable_);
+ // Expects
+ ASSERT_EQ(timeout_, test_timer.GetTimeout());
+ ASSERT_TRUE(test_timer.IsRunning());
+}
+
+TEST_F(TimerTest, Stop_FirstLoop_NoCall) {
+ // Preconditions
+ timer::Timer test_timer(kTimerName, test_task_);
+ // Expects
+ EXPECT_CALL(*test_task_, run()).Times(0);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ test_timer.Stop();
+}
+
+TEST_F(TimerTest, Stop_SecondLoop_OneCall) {
+ // Preconditions
+ test_lock.Acquire();
+ TestTask* task = new TestTask();
+ timer::Timer test_timer(kTimerName, task);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ ASSERT_TRUE(test_timer.IsRunning());
+ // Wait for Starting second loop
+ lock_monitor.Wait(test_lock);
+ test_timer.Stop();
+ test_lock.Release();
+ // Expects
+ EXPECT_EQ(1u, task->GetCallsCount());
+}
+
+TEST_F(TimerTest, IsRunning_Started_True) {
+ // Preconditions
+ timer::Timer test_timer(kTimerName, test_task_);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ // Expects
+ EXPECT_TRUE(test_timer.IsRunning());
+}
+
+TEST_F(TimerTest, IsRunning_Stoped_False) {
+ // Preconditions
+ timer::Timer test_timer(kTimerName, test_task_);
+ // Actions
+ test_timer.Start(timeout_, repeatable_);
+ ASSERT_TRUE(test_timer.IsRunning());
+ test_timer.Stop();
+ // Expects
+ EXPECT_FALSE(test_timer.IsRunning());
+}
+
+TEST_F(TimerTest, IsRunning_Suspended_FalseAndOneCall) {
+ // Preconditions
+ test_lock.Acquire();
+ FakeClassWithTimer fake_class;
+ // Expects
+ ASSERT_EQ(0u, fake_class.GetCallsCount());
+ ASSERT_TRUE(fake_class.IsTimerRunning());
+ // Wait for end of loop
+ lock_monitor.Wait(test_lock);
+ test_lock.Release();
+ // Expects
+ ASSERT_EQ(1u, fake_class.GetCallsCount());
+ ASSERT_FALSE(fake_class.IsTimerRunning());
+}
+
+} // namespace timer_test
+} // namespace components
+} // namespace test
diff --git a/src/components/utils/test/timer_thread_test.cc b/src/components/utils/test/timer_thread_test.cc
deleted file mode 100644
index 6a758873f4..0000000000
--- a/src/components/utils/test/timer_thread_test.cc
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- * Copyright (c) 2015, Ford Motor Company
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following
- * disclaimer in the documentation and/or other materials provided with the
- * distribution.
- *
- * Neither the name of the Ford Motor Company nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include <pthread.h>
-#include <iostream>
-
-#include "lock.h"
-#include "macro.h"
-
-#include "gtest/gtest.h"
-#include "utils/conditional_variable.h"
-#include "utils/timer_thread.h"
-
-namespace test {
-namespace components {
-namespace utils {
-
-using namespace timer;
-using namespace sync_primitives;
-
-class TimerThreadTest : public ::testing::Test {
- public:
- TimerThreadTest()
- : check_val(0),
- val1(3),
- val2(4),
- wait_val(3000) {
- }
-
- void function() {
- AutoLock alock(lock_);
- ++check_val;
- condvar_.NotifyOne();
- }
-
- protected:
- uint32_t check_val;
- Lock lock_;
- ConditionalVariable condvar_;
- const uint32_t val1;
- const uint32_t val2;
- const uint32_t wait_val;
-};
-
-TEST_F(TimerThreadTest, StartTimerThreadWithTimeoutOneSec_ExpectSuccessfullInvokeCallbackFuncOnTimeout) {
- // Create Timer with TimerDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- false);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- condvar_.WaitFor(alock, wait_val);
- EXPECT_EQ(1u, check_val);
-}
-
-TEST_F(TimerThreadTest, StartTimerThreadWithTimeoutOneSecInLoop_ExpectSuccessfullInvokeCallbackFuncOnEveryTimeout) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- while (check_val < val2) {
- condvar_.WaitFor(alock, wait_val);
- }
- // Check callback function was called 4 times
- EXPECT_EQ(val2, check_val);
-}
-
-TEST_F(TimerThreadTest, StopStartedTimerThreadWithTimeoutOneSecInLoop_ExpectSuccessfullStop) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- // Stop timer on 3rd second
- while (check_val < val2) {
- if (check_val == val1) {
- timer.stop();
- break;
- }
- condvar_.WaitFor(alock, wait_val);
- }
- EXPECT_EQ(val1, check_val);
-}
-
-TEST_F(TimerThreadTest, ChangeTimeoutForStartedTimerThreadWithTimeoutOneSecInLoop_ExpectSuccessfullStop) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- // Change timer timeout
- while (check_val < val2) {
- if (check_val == val1) {
- timer.updateTimeOut(200);
- }
- condvar_.WaitFor(alock, wait_val);
- }
- EXPECT_EQ(val2, check_val);
-}
-
-TEST_F(TimerThreadTest, CheckStartedTimerIsRunning_ExpectTrue) {
- // Create Timer with TimerLooperDeleagate
- TimerThread<TimerThreadTest> timer("Test", this, &TimerThreadTest::function,
- true);
- AutoLock alock(lock_);
- EXPECT_EQ(0u, check_val);
- timer.start(100);
- // Change timer timeout on 3rd second
- while (check_val < val1) {
- condvar_.WaitFor(alock, wait_val);
- // Check start is running
- EXPECT_TRUE(timer.isRunning());
- }
- EXPECT_EQ(val1, check_val);
-}
-
-} // namespace utils
-} // namespace components
-} // namespace test
-
diff --git a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
index 2b372021c2..d13ac29c9b 100755
--- a/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
+++ b/tools/InterfaceGenerator/generator/generators/SmartFactoryBase.py
@@ -1223,7 +1223,7 @@ class CodeGenerator(object):
_hpp_schema_file_tempalte = string.Template(
u'''/**\n'''
- u''' * @file ${class_name}.hpp\n'''
+ u''' * @file ${class_name}.h\n'''
u''' * @brief Generated class ${class_name} header file.\n'''
u''' *\n'''
u''' * This class is a part of SmartObjects solution. It provides\n'''
@@ -1280,7 +1280,7 @@ class CodeGenerator(object):
u'''#ifndef $guard\n'''
u'''#define $guard\n'''
u'''\n'''
- u'''#include "formatters/CSmartFactory.hpp"\n'''
+ u'''#include "formatters/CSmartFactory.h"\n'''
u'''#include "smart_objects/smart_schema.h"\n'''
u'''#include "smart_objects/schema_item.h"\n'''
u'''#include "utils/shared_ptr.h"\n'''
diff --git a/tools/InterfaceGenerator/generator/parsers/RPCBase.py b/tools/InterfaceGenerator/generator/parsers/RPCBase.py
index 2b3db62d56..22f3fd2c2d 100755
--- a/tools/InterfaceGenerator/generator/parsers/RPCBase.py
+++ b/tools/InterfaceGenerator/generator/parsers/RPCBase.py
@@ -568,7 +568,8 @@ class Parser(object):
default_value = self._get_bool_from_string(default_value);
param_type = Model.Boolean(default_value=default_value)
elif type_name == "Integer" or \
- type_name == "Float":
+ type_name == "Float" or \
+ type_name == "Double" :
min_value = self._extract_optional_number_attrib(
attrib, "minvalue", int if type_name == "Integer" else float)
max_value = self._extract_optional_number_attrib(
diff --git a/tools/Utils/generate_test_certificates.py b/tools/Utils/generate_test_certificates.py
new file mode 100755
index 0000000000..73b6f53cc8
--- /dev/null
+++ b/tools/Utils/generate_test_certificates.py
@@ -0,0 +1,279 @@
+#!/usr/bin/env python2
+# -*- coding: utf-8 -*-
+
+"""Generate certificates for testing
+ Usage:
+ generate_test_certificate.py --dir=<name of directory>
+"""
+
+import os
+import subprocess
+import tempfile
+from argparse import ArgumentParser
+from subprocess import check_call
+
+def run(command, *args):
+ """Application caller
+ wrap console call 'command args'
+ """
+ args_str = " " + " ".join(str(s) for s in list(args[0]))
+ if len(args_str) > 0 :
+ command += " " + args_str
+ print "Running", command
+ retcode = check_call(command, shell=True)
+ if retcode < 0:
+ raise RuntimeError("Child was terminated by signal")
+
+def openssl(*args):
+ """OpenSSL caller
+ wrap console call 'openssl args'
+ """
+ run("openssl", args)
+
+def gen_rsa_key(out_key_file, key_size):
+ """Private key generator
+ wrap console call 'openssl genrsa -out $out_key_file $key_size'
+ """
+ openssl("genrsa", "-out", out_key_file, key_size)
+
+def gen_root_cert(out_cert_file, key_file, days, answer):
+ """Root certificate generator
+ wrap console call 'openssl req -x509 -new -key $key_file -days $days -out $out_cert_file -subj $answer'
+ """
+ openssl("req -x509 -new -key", key_file, "-days", days, "-out", out_cert_file, "-subj", answer)
+
+def gen_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, answer):
+ """Certificate generator
+ wrap console call
+ 'openssl req -new -key $key_file -days $days -out $out_cert_file -subj $answer'
+ 'openssl x509 -req -in $out_cert_file -CA $ca_cert_file -CAkey ca_key_file -CAcreateserial -out $out_cert_file -days 5000'
+ """
+ request_file = out_cert_file + ".req"
+ openssl("req -new -key", key_file, "-days", days, "-out", request_file, "-subj", answer)
+
+ openssl("x509 -hash -req -in", request_file, "-CA", ca_cert_file, "-CAkey", ca_key_file, \
+ "-CAcreateserial -out", out_cert_file, "-days", days)
+
+def gen_expire_cert(out_cert_file, key_file, ca_cert_file, ca_key_file, days, answer):
+ """Expired certificate generator
+ wrap console call
+ 'openssl req -new -key $key_file -days $days -out $out_cert_file -subj $answer'
+ 'openssl ca -batch -config $config_file_path -in $request_file -out $out_cert_file,
+ "-cert", ca_cert_file, "-keyfile", ca_key_file, "-startdate 150101000000Z -enddate 150314092653Z'
+ """
+ request_file = out_cert_file + ".req"
+ openssl("req -new -key", key_file, "-days", days, "-out", request_file, "-subj", answer)
+
+ # Create temporary files needed for expired certificate generation
+ temp_dir = tempfile.mkdtemp()
+ config_file_path = os.path.join(temp_dir, "database.conf")
+ database_file_path = os.path.join(temp_dir, "database")
+ serial_file_path = os.path.join(temp_dir, "serial")
+ # create file
+ open(database_file_path, 'w').close()
+
+ serial_file = open(serial_file_path, 'w')
+ serial_file.write("01")
+ serial_file.close();
+
+ current_dir = os.getcwd()
+ config_file = open(config_file_path, 'w')
+ config_file.write(
+ """[ ca ]
+ default_ca = ca_default
+
+ [ ca_default ]
+ dir = %s""" % (temp_dir, ) + """
+ certs = %s""" % (current_dir, ) + """
+ new_certs_dir = %s""" % (current_dir, ) + """
+ database = %s""" % (database_file_path, ) + """
+ serial = %s""" % (serial_file_path, ) + """
+ RANDFILE = $dir/ca.db.rand
+ certificate = %s""" % (os.path.abspath(ca_cert_file), ) + """
+ private_key = %s""" % (os.path.abspath(ca_key_file), ) + """
+ default_days = 365
+ default_crl_days = 30
+ default_md = md5
+ preserve = no
+ policy = generic_policy
+ [ generic_policy ]
+ countryName = optional
+ stateOrProvinceName = optional
+ localityName = optional
+ organizationName = optional
+ organizationalUnitName = optional
+ commonName = supplied
+ emailAddress = optional\n""")
+ config_file.close();
+
+ openssl("ca -batch -config", config_file_path, "-in", request_file, "-out", out_cert_file,
+ "-startdate 150101000000Z -enddate 150314092653Z")
+
+def gen_pkcs12(out, key_file, cert_file, verification_certificate) :
+ """Pem to PKCS#12 standard
+ wrap console call
+ 'openssl pkcs12 -export -out $out -inkey $key_file -in $cert_file -name 'SPT key and certificates' -certfile $certs'
+ """
+ openssl("pkcs12 -export -out", out, "-inkey", key_file, "-in", cert_file, \
+ "-name 'SPT key and certificates'", "-CAfile ", verification_certificate, \
+ " -passout pass:")
+
+ """
+ Encode certificate $out to base 64
+ """
+ with open(out, "rb") as cert:
+ with open(out + ".enc", "wb") as enc_cert:
+ enc_cert.write(cert.read().encode("base64"))
+
+def answers(name, app_id, country, state, locality, organization, unit, email) :
+ """Answer string generator
+ Generate answer for certificate creation with openssl
+ Country argument need to be 2 symbol size
+ """
+ if len(country) != 2 :
+ raise ValueError("Country argument need to be 2 symbol size")
+ answer ="'/C={0}/ST={1}/L={2}/O={3}".format(country, state, locality, organization)
+ answer +="/OU={0}/CN={1}/emailAddress={2}'".format(unit, name, email)
+ if len(app_id) > 0:
+ answer += "/serialNumber={0}".format(app_id)
+ return answer
+
+def concat_files(out_file_name, *args) :
+ print "Concatenate text files", args, "into", out_file_name
+ with open(out_file_name, 'w') as outfile:
+ for fname in args :
+ with open(fname) as infile :
+ outfile.write(infile.read())
+
+
+def main():
+ soft_verify_file = os.path.join("server", "server_root.key")
+ arg_parser = ArgumentParser(description='Welcome to SDL test certificate generator.')
+ arg_parser.add_argument('-d', '--dir', help="directory for certificate generating")
+ arg_parser.add_argument('-s', '--soft', help="do not override existing certificates if '%s' exists" % soft_verify_file, action='store_true' )
+ args = arg_parser.parse_args()
+ if args.dir:
+ if not os.path.exists(args.dir):
+ raise OSError("Input directory does not exist")
+ os.chdir(args.dir)
+ if args.soft:
+ if os.path.exists(soft_verify_file):
+ print "Root key file '%s' exists. Generation skipped according to soft mode." % (soft_verify_file, )
+ return
+
+ server_root_answer = answers("server_root", "", "US", "California", "Silicon Valley", "CAcert.org", "CAcert", "sample@cacert.org")
+ client_root_answer = answers("client_root", "", "US", "California", "Silicon Valley", "CAcert.org", "CAcert", "sample@cacert.org")
+ ford_server_answer = answers("FORD", "", "US", "Michigan", "Detroit", "FORD_SERVER", "FORD_SDL_SERVER" ,"sample@ford.com")
+ ford_client_answer = answers("FORD_CLIENT", "", "US", "Michigan", "Detroit", "FORD_CLIENT", "FORD_SDL_CLIENT" ,"sample@ford.com")
+ client_answer = answers("client", "SPT", "RU", "Russia", "St. Petersburg", "Luxoft", "HeadUnit" ,"sample@luxoft.com")
+ server_answer = answers("server", "SPT", "RU", "Russia", "St. Petersburg", "Luxoft", "Mobile" ,"sample@luxoft.com")
+ server_unsigned_answer = answers("server", "SPT", "RU", "Russia", "St. Petersburg", "Luxoft", "Mobile_unsigned" ,"sample@luxoft.com")
+ server_expired_answer = answers("server", "SPT", "RU", "Russia", "St. Petersburg", "Luxoft", "Mobile_expired" ,"sample@luxoft.com")
+ client_unsigned_answer = answers("client", "SPT", "RU", "Russia", "St. Petersburg", "Luxoft", "Mobile_unsigned" ,"sample@luxoft.com")
+ client_expired_answer = answers("client", "SPT", "RU", "Russia", "St. Petersburg", "Luxoft", "Mobile_expired" ,"sample@luxoft.com")
+ days = 10000
+
+ server_dir = "server"
+ client_dir = "client"
+ if not os.path.exists(server_dir):
+ os.mkdir(server_dir)
+ if not os.path.exists(client_dir):
+ os.mkdir(client_dir)
+
+ print " --== Root certificate generating SERVER==-- "
+ server_root_key_file = os.path.join(server_dir, "server_root.key")
+ assert soft_verify_file == server_root_key_file, 'Update soft key file path'
+ server_root_cert_file = os.path.join(server_dir, "server_root.crt")
+ gen_rsa_key(server_root_key_file, 2048)
+ gen_root_cert(server_root_cert_file, server_root_key_file, days, server_root_answer)
+
+ print " --== Root certificate generating CLIENT==-- "
+ client_root_key_file = os.path.join(client_dir, "client_root.key")
+ client_root_cert_file = os.path.join(client_dir, "client_root.crt")
+ gen_rsa_key(client_root_key_file, 2048)
+ gen_root_cert(client_root_cert_file, client_root_key_file, days, client_root_answer)
+
+ print
+ print " --== Ford server CA certificate generating ==-- "
+ ford_server_key_file = os.path.join(server_dir, "ford_server.key")
+ ford_server_cert_file = os.path.join(server_dir, "ford_server.crt")
+ gen_rsa_key(ford_server_key_file, 2048)
+ gen_cert(ford_server_cert_file, ford_server_key_file, server_root_cert_file, server_root_key_file, days, ford_server_answer)
+
+ print
+ print " --== Ford client CA certificate generating ==-- "
+ ford_client_key_file = os.path.join(client_dir, "ford_client.key")
+ ford_client_cert_file = os.path.join(client_dir, "ford_client.crt")
+ gen_rsa_key(ford_client_key_file, 2048)
+ gen_cert(ford_client_cert_file, ford_client_key_file, client_root_cert_file, client_root_key_file, days, ford_client_answer)
+
+ print
+ print " --== SDL and SPT adjustment ==-- "
+ server_verification_ca_cert_file = os.path.join(server_dir, "server_verification_ca_cetrificates.crt")
+ client_verification_ca_cert_file = os.path.join(client_dir, "client_verification_ca_cetrificates.crt")
+ concat_files(server_verification_ca_cert_file, server_root_cert_file, ford_server_cert_file)
+ concat_files(client_verification_ca_cert_file, client_root_cert_file, ford_client_cert_file)
+
+
+ print
+ print " --== Client certificate generating ==-- "
+ client_key_file = os.path.join(client_dir, "client.key")
+ client_cert_file = os.path.join(client_dir, "client.crt")
+ gen_rsa_key(client_key_file, 2048)
+ gen_cert(client_cert_file, client_key_file, ford_client_cert_file, ford_client_key_file, days, client_answer)
+
+
+ print
+ print " --== Server certificate generating ==-- "
+ server_key_file = os.path.join(server_dir, "server.key")
+ server_cert_file = os.path.join(server_dir, "server.crt")
+ server_pkcs12_file = os.path.join(server_dir, "spt_credential.p12")
+ gen_rsa_key(server_key_file, 2048)
+ gen_cert(server_cert_file, server_key_file, ford_server_cert_file, ford_server_key_file, days, server_answer)
+ gen_pkcs12(server_pkcs12_file, server_key_file, server_cert_file, client_verification_ca_cert_file)
+
+ print
+ print " --== Server unsigned certificate generating ==-- "
+ server_unsigned_cert_file = os.path.join(server_dir, "server_unsigned.crt")
+ server_pkcs12_unsigned_file = os.path.join(server_dir, "spt_credential_unsigned.p12")
+ gen_root_cert(server_unsigned_cert_file, server_key_file, days, server_unsigned_answer)
+ gen_pkcs12(server_pkcs12_unsigned_file, server_key_file, server_unsigned_cert_file, client_verification_ca_cert_file)
+
+ print
+ print " --== Server expired certificate generating ==-- "
+ server_expired_cert_file = os.path.join(server_dir, "server_expired.crt")
+ server_pkcs12_expired_file = os.path.join(server_dir, "spt_credential_expired.p12")
+ gen_expire_cert(server_expired_cert_file, server_key_file, ford_server_cert_file, ford_server_key_file, days, server_expired_answer)
+ gen_pkcs12(server_pkcs12_expired_file, server_key_file, server_expired_cert_file, client_verification_ca_cert_file)
+
+
+ print
+ print " --== Client pkcs12 certificate generating ==-- "
+ client_key_file = os.path.join(client_dir, "client.key")
+ client_cert_file = os.path.join(client_dir, "client.crt")
+ client_pkcs12_file = os.path.join(client_dir, "client_credential.p12")
+ gen_rsa_key(client_key_file, 2048)
+ gen_cert(client_cert_file, client_key_file, ford_client_cert_file, ford_client_key_file, days, client_answer)
+ gen_pkcs12(client_pkcs12_file, client_key_file, client_cert_file, server_verification_ca_cert_file)
+
+ print
+ print " --== Client pkcs12 unsigned certificate generating ==-- "
+ client_unsigned_cert_file = os.path.join(client_dir, "client_unsigned.crt")
+ client_pkcs12_unsigned_file = os.path.join(client_dir, "client_credential_unsigned.p12")
+ gen_root_cert(client_unsigned_cert_file, client_key_file, days, client_unsigned_answer)
+ gen_pkcs12(client_pkcs12_unsigned_file, client_key_file, client_unsigned_cert_file, server_verification_ca_cert_file)
+
+ print
+ print " --== Client pkcs12 expired certificate generating ==-- "
+ client_expired_cert_file = os.path.join(client_dir, "client_expired.crt")
+ client_pkcs12_expired_file = os.path.join(client_dir, "client_credential_expired.p12")
+ gen_expire_cert(client_expired_cert_file, client_key_file, ford_client_cert_file, ford_client_key_file, days, client_expired_answer)
+ gen_pkcs12(client_pkcs12_expired_file, client_key_file, client_expired_cert_file, server_verification_ca_cert_file)
+
+ subprocess.call(["c_rehash", server_dir])
+ subprocess.call(["c_rehash", client_dir])
+ print
+ print "All certificates have been generated"
+
+if __name__ == "__main__":
+ main()